Skip to main content
Solved

How to get labels for inventory numbers

  • July 9, 2026
  • 5 replies
  • 133 views

.Net SDK (from NuGet)

I am trying to get a list of all phones, somewhat similar to what is shown  on Phone System>>Phone Numbers>>All Numbers. The purpose is a simple lookup to be used with the from/to numbers in the call log.

The columns i think i want are: Number, Name, Assigned to, Type, Primary, UsageType

Assigned To seems to comes from Client.Restapi.Account.Extension.List(). I can create a dictionary, using id as the .key and .name as the value. Though the api lists .primary, the .net SDK does not return it.

[On a side note, the Try it out returns only 2 records. The actual call does return them all.]

Client.Restapi.V2.Accounts.PhoneNumbers.Get() has .callerIdName, .phoneNumber, .type, .usageType. It also has .extension.id which can be used to get the name from the dictionary. It does not have .label/.name, nor does it have .primary.

Client.Restapi.Account.PhoneNumber.List, does have .label and .primary, however, it only returns the In Use numbers, and leaves out the ones in Inventory.

Because the primary number has to be in use, i guess i could make the V1 call to search for the primary number. It would also give me the labels for the In Use numbers.

That leaves me with a couple questions:

  1. Is there a way (via this sdk) to get the labels for Inventory numbers?
  2. Am i going about this the right way?

Best answer by Tyler850957020

.NET SDK you will need to use the batchGet() method:
 

https://github.com/ringcentral/RingCentral.Net/blob/master/RingCentral.Tests/BatchGetTest.cs#L59

5 replies

  • Author
  • The First Step
  • July 10, 2026

Although Client.Restapi.Account.PhoneNumber.List excepts a parameter for usageType, Inventory is not one of them. I tried every checkbox on the api page, and none of them would return those numbers. Passing Inventory as the usage type in the call gave an invalid usage type error.

Also a V1 call, Client.Restapi.Account.PhoneNumber(id).Get() will return Inventory numbers. (The V2 call also leaves out .primary and .label.) I can make one call per number (with the appropriate delay), or, use the bulk format: Client.Restapi.Account.PhoneNumber(id1,id2,id3,...id30).Get(). (Which, through testing, the error message told me the limit was 30 numbers.) However, the bulk call raises an exception:

RingCentral.JsonDeserializeException: 'Unable to deserialize json string to type RingCentral.CompanyPhoneNumberInfo

Unexpected character encountered while parsing number: o. Path '', line 1, position 3.

(The website’s Try it out shows the return, but not formatted.)

It then conveniently lists the entire response, which i can simply capture in try/catch.


PhongVu
Community Manager
Forum|alt.badge.img
  • Community Manager
  • July 13, 2026

Hi, I can confirm that the List Account Phone Numbers V2 API does not return the label and the primary flag. I will fire a ticket asking the platform team to fix the issue, but this will take some time.

Meanwhile, you can use the List Company Phone Numbers V1 APIto read other usage types numbers. And use the V2 API to read only inventory numbers (usageType=Inventory) then use the phone number Id to call the Get Phone Number API to get the number details. This is just a workaround solution. I will post here to notify you when the V2 API is fixed.


  • Author
  • The First Step
  • July 13, 2026

Hi, I can confirm that the List Account Phone Numbers V2 API does not return the label and the primary flag. I will fire a ticket asking the platform team to fix the issue, but this will take some time.

Thank you for confirming and reporting. I appreciate that.

  

Meanwhile, you can use the List Company Phone Numbers V1 APIto read other usage types numbers. And use the V2 API to read only inventory numbers (usageType=Inventory) then use the phone number Id to call the Get Phone Number API to get the number details. This is just a workaround solution. I will post here to notify you when the V2 API is fixed.

We have 45 numbers in inventory. Instead of calling list on the in-use numbers and determining which are not in-use to make the other call, i feel that it make more sense to just use Get Phone Number on all our numbers. At 30 per bulk call, we’d only be making 4 calls anyway.

The response from the bulk call causes some interesting behavior: The website just shows the response instead of formatting a a json tree. The .net sdk raises an exception with the response.



  • Author
  • The First Step
  • July 14, 2026

Ty! My bad. I didn’t read the ReadMe well enough. I see the batch section now that points out the two methods to handle batches by pointing to the example code. I have tested them both and see they work well.