``Use this instruction to view, add, modify, or remove phone number block types.

Getting ApplicationInstanceToken

Before viewing/adding/modifying/removing phone number block types, obtain ApplicationInstanceToken using the pem.APS.getApplicationInstanceToken OA Public API method. For example, the following Python script will return APS token for application instance ID passed to the script:

[root@poa API]# cat pem.APS.getApplicationInstanceToken.py
import sys
from poaupdater import openapi,  uLogging

uLogging.log_to_console = False

api = openapi.OpenAPI()

result = api.pem.APS.getApplicationInstanceToken( application_instance_id = int(sys.argv[1]) );

print result['aps_token']
[root@poa API]#

Usage:

[root@poa API]# python pem.APS.getApplicationInstanceToken.py 6
JEFFUy0xMjgtQ0JDJFF0Z2RHZ2tHTjNpM3NVUExIUmNlcVE9PSRmT1pCRXNHSkNnRzhaNGFqalNrZEphQUpqQlpqVHphSFFjOHRaOUVEQk1XVmt0S2F0V0RWRVNkS0ZaeU9GOEo0S3NERGx0amFiVHdVNWRoMXdsYkNXdHVyZ01lc0xIdlgxQXpXVW9zaHVzN3M4bDBVekRFS3pHZkR1TFBOZGVhK0JxaC9qdlBVU0VZdGxhb2tLWEhrY1B1eDVOVTRNYzVMbkZkcU1MUFVYazhDQnBzQ1NPU2ZCdmExS2w1RXAya2NTNTN0THBkZ0NVelIrQVNXdFNVS2JiSS8zOVFuMCt6RXRvMXN1VERoRlp5RUtqdXl0OEl4MTRvaWRRTWJsK3ROJDlmZGYwZjNlMDVmNzIxNGJjNWMyMjVhM2I4NTQ4ZmQzYWJmNzAzNmM=
[root@poa API]#

Then, use the obtained value to call APSC methods.

Note: ApplicationInstanceToken has an expiration time and it might expire.

Viewing Phone Number Block Types

To view existing phone number block types, perform the following request:

    # curl -i -k "https://<MN IP>:6308/aps/2/resources/?implementing(http://www.parallels.com/LyncHPv2/phoneNumberBlockType)" -X GET -H "APS-Token: $ApplicationInstanceToken"

Adding New Phone Number Block Type

To add a new phone number block type, follow these steps:

  1. Get the Phone Number Provider resource with curl:

    # curl -i -k "https://<MN IP>:6308/aps/2/resources/?implementing(http://www.parallels.com/LyncHPv2/phoneNumberProvider)" -X GET -H "APS-Token: $ApplicationInstanceToken"
    
  2. Create file (for example request.json) with the following content:

    { "aps": { "type": "http://www.parallels.com/LyncHPv2/phoneNumberBlockType/1.0" }, "name": "5 number block type ($1 per 1 month)", "description": "A block of 5 phone numbers will be allocated for your organization", "blockType": "5 number block", "blockSize": 5 }

  3. Perform the following request:

    # curl -i -k "https://<MN IP>:6308/aps/2/resources/$PhoneNumberProvider.ID/blockTypes" -X POST -H "Content-Type: application/json" -H "Accept: application/json, text/javascript" -d@PATH_TO_FILE -H "APS-Token: $ApplicationInstanceToken"
    

Where PATH_TO_FILE is path to file with POST data created on step 2.

Modifying Phone Number Block Type

To modify a phone number block type, perform the following request:

  1. Create file (for example request.json) with the following content:

    { "name": "50 number block type", "blockSize": 50 }

  2. Perform the following request:

    # curl -i -k "https://<MN IP>:6308/aps/2/resources/$PhoneNumberBlockType.ID" -X PUT -H "Content-Type: application/json" -H "Accept: application/json, text/javascript" -d@PATH_TO_FILE -H "APS-Token: $ApplicationInstanceToken"
    

Where PATH_TO_FILE is path to file with POST data created on step 1.

Removing Phone Number Block Type

To remove a phone number block type, follow these steps:

  1. Check that all phone number blocks related to this phone number block type are removed.
  2. Check that all 'Application Service Reference' Resource Types based on this phone number block type are removed.
  3. Perform the following request:

    # curl -i -k "https://<MN IP>:6308/aps/2/resources/$PhoneNumberBlockType.ID" -X DELETE -H "APS-Token: $ApplicationInstanceToken"
    

In the steps above:

  • PROVIDER_INSTANCE_ID - the ID of the application instance from Provider Control Panel.
  • <MN_IP> - the IP address of the Management Node.
  • ApplicationInstanceToken - the token of the application instance.
  • PhoneNumberBlockType.ID - the ID of the phone number block type.
  • PhoneNumberProvider.ID - the ID of the phone number provider.

Internal content

Link on internal Article