Link an application to a phone number
const url = 'https://api.siprtc.io/v1/Accounts/AC000000000000000000/PhoneNumbers/%2B15555550100';const options = { method: 'PATCH', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"action":"number_app_association","application_id":1024,"modified_by":"jane@example.com"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.siprtc.io/v1/Accounts/AC000000000000000000/PhoneNumbers/%2B15555550100 \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "action": "number_app_association", "application_id": 1024, "modified_by": "jane@example.com" }'Links an application to a number so that the application handles the number’s inbound calls and messages (action number_app_association), or unlinks it (action number_app_deassociation). The application must belong to the account the number is assigned to or to you; a parent account’s application with global scope may also be linked to a child’s number. Unlinking sets the application ID to -1 and ignores application_id. The number must be on your account (or, for a vendor, in its inventory) and have a subscription; it may be written with or without + and spaces.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Your Auth ID.
Example
AC000000000000000000The number.
Example
+15555550100Request Bodyrequired
Section titled “ Request Bodyrequired ”Link or unlink action
object
Number_app_association to link application_id, number_app_deassociation to unlink.
Example
number_app_associationID of the application to link. It must belong to the number’s account or to you (or be a global application of the parent). Ignored when unlinking.
Example
1024Optional name of the person making the change, recorded in the audit log.
Example
jane@example.comResponses
Section titled “ Responses ”Linked or unlinked: status success
object
Human-readable result or error.
Success or failed.
Example
{ "message": "phone number not found", "status": "failed"}Body not valid JSON, unknown action (Request action is not valid), or unlinking failed
object
Human-readable result or error.
Success or failed.
Example
{ "message": "phone number not found", "status": "failed"}Missing or invalid credentials (returned by the API gateway)
Example generated
exampleThe application does not belong to the number’s account or to you
object
Human-readable result or error.
Success or failed.
Example
{ "message": "phone number not found", "status": "failed"}Number, subscription or application not found
object
Human-readable result or error.
Success or failed.
Example
{ "message": "phone number not found", "status": "failed"}