IDs
An ID never changes for the thing that it names. You can keep it in your own systems.
| Resource | ID | Example |
|---|---|---|
| User, Hunt Group, IVR | An integer | 11 |
| Number | Its digits, with the country code and no plus | 442030269550 |
| Call | A string | 0_3333414810@192.168.0.149 |
| Leg | A string | 2AD2070D B0A44C2D 289C04DC 289C04DC |
| Data Session | A string | 30616228 |
An ID is not the extension
Section titled “An ID is not the extension”A User has an id and an extension. The extension is what a person dials, and your admin can change it. The id stays the same.
URL-encode an ID in a path
Section titled “URL-encode an ID in a path”A Call ID can hold @ and :, and a Leg ID holds spaces. Encode each ID before you put it in a path.
# 0_3333414810@192.168.0.149curl "https://api.customer.onsim.uk/v1/calls/0_3333414810%40192.168.0.149" \ -H "x-api-key: $ONSIM_API_KEY"In JavaScript, use encodeURIComponent. encodeURI is for a whole address, and it leaves @, : and / as they are.
const path = `/v1/calls/${encodeURIComponent(call.id)}/recordings/${encodeURIComponent(leg.id)}`A phone makes the ID of its call, so a Call ID can show the private address of that phone on your network. Only you see it.
The path gives an ID its kind
Section titled “The path gives an ID its kind”The same integer space serves Users, Hunt Groups and IVRs. The ID of a Hunt Group is not found under /v1/users, and answers 404 there.
An IVR with no extension has no ID. No list shows it.