Telcobridges - Session Border Controllers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Need help with the syntax for adding NAPs with the API

Go down

Need help with the syntax for adding NAPs with the API Empty Need help with the syntax for adding NAPs with the API

Post by rmcnary Thu Jan 21, 2021 2:02 pm

Am using Postman
I can add one NAP using this POST

http://192.168.1.1:12358/configurations/config_2021-01-21/naps

With this in the body
{
    "name": "Customer_A",
    "sip_cfg": {
        "proxy_address": "10.10.10.10"
    },
    "default_profile": "Mitel",
    "sip_transport_servers": [
        "SIP_TS_WAN_5060"
    ],
    "port_ranges": [
        "Host.pr_WAN0"
    ]
}

But I am struggling trying to discover the proper syntax to add two or more NAPs in one command

{
    {
        "name": "Customer_B",
        "sip_cfg": {
            "proxy_address": "10.10.10.11"
        },
        "default_profile": "Mitel",
        "sip_transport_servers": [
            "SIP_TS_WAN_5060"
        ],
        "port_ranges": [
            "Host.pr_WAN0"
        ]
    },
    {
        "name": "Customer_C",
        "sip_cfg": {
            "proxy_address": "10.10.10.12"
        },
        "default_profile": "Mitel",
        "sip_transport_servers": [
            "SIP_TS_WAN_5060"
        ],
        "port_ranges": [
            "Host.pr_WAN0"
        ]
    }
}

Returns "message": "Nap creation failed: Name can't be blank."

So tried this

{
    "Customer_B": {
        "name": "Customer_B",
        "sip_cfg": {
            "proxy_address": "10.10.10.11"
        },
        "default_profile": "Mitel",
        "sip_transport_servers": [
            "SIP_TS_WAN_5060"
        ],
        "port_ranges": [
            "Host.pr_WAN0"
        ]
    },
    "Customer_C": {
        "name": "Customer_C",
        "sip_cfg": {
            "proxy_address": "10.10.10.12"
        },
        "default_profile": "Mitel",
        "sip_transport_servers": [
            "SIP_TS_WAN_5060"
        ],
        "port_ranges": [
            "Host.pr_WAN0"
        ]
    }
}

Same result
"message": "Nap creation failed: Name can't be blank."

Hoping someone can point me in the right direction
Thank you very much

rmcnary

Number of Messages : 3
Point : 7
Registration Date : 2019-11-01

Back to top Go down

Need help with the syntax for adding NAPs with the API Empty Re: Need help with the syntax for adding NAPs with the API

Post by Guest Wed Jan 27, 2021 8:33 am

Please follow the below steps and attached pictures respectively to add more than one NAP in one command using Postman:

1. Use POST with this URL http://10.7.29.12:12358/configurations/config_2021-01-22_Test/naps
2. Use the Body as Raw format and write the following one in the Body of Postman (as picture):

{
       "name": "{{name}}",
       "sip_cfg": {
           "proxy_address": "{{proxy_address}}"
       },
       "default_profile": "{{default_profile}}",
       "sip_transport_servers": [
           "{{sip_transport_servers}}"
       ],
       "port_ranges": [
           "{{port_ranges}}"
       ]
}

or,

{
       "name": "{{name}}",
       
           "proxy_address": "{{ proxy_address }}"
       
       "default_profile": "{{default_profile}}",
       "sip_transport_servers": [
           "{{sip_transport_servers}}"
       ],
       "port_ranges": [
           "{{port_ranges}}"
       ]
}

3. Click the ‘Send’ button to send the request.
4. You will get a response in the message body.
5. Save the request in a Collection as mentioned in the following steps.
6. Click ‘Create Collection’ to create a collection directory.
7. Name the collection directory.
8. Click ‘Save to collection directory name’.
9. Click the ‘Runner’ button. And it will open a new Postman window.
10. Click the Data ‘Select File’ for iteration by browsing the located folder in your PC where you have saved the iteration file in JSON format.
- In the last page of this document, I have written the JSON file content for you - named as ‘iteration for multiple NAPs configuration.json’. Please see and save that content in json format on your PC and select that file for iteration from Postman-Runner options.
- If there is a syntax error in the selected JSON file, then Postman will prompt an error message.
11. Select ‘Data File Type’ as application/JSON from the drop-down menu.
12. Click the ‘Preview’ button to see the Data in a table.
- If there is a syntax error in the selected JSON file, after clicking the ‘Preview’ button, Postman will prompt an error message with the specific line number to indicate where the syntax error is.
13. and scroll to see the full table.
14. Close the Preview.
15. Select the ‘collection directory name’ from the left sidebar where you have saved the request.
16. Select the required saved Request. (Deselect the others if there are many saved requests in the list. Otherwise, it might ruin your existing configuration).
17. Click the ‘Run’ button.
Then it will execute the command and you will find that the required result will be shown in Postman as per the ‘iteration for multiple NAPs configuration.json’ file.

Note: In the ‘iteration for multiple NAPs configuration.json’ file, there is iteration for only 2 naps, and you can increase the naps if you want there for iteration by editing the file and repeating the same code for a single nap and changing the nap’s name, other values or parameters in that.

* You can follow the same procedure to add more than one static Routes or others in one command using Postman.




*Note: Below is the Content of the ‘iteration for multiple NAPs configuration.json’ file. (Please create the same for test).


[
   {
   
       "name": "Customer_B",
       
           "proxy_address": "10.10.10.11"
       
       "default_profile": "Mitel",
       "sip_transport_servers": [
           "SIP_TS_WAN_5060"
       ],
       "port_ranges": [
           "Host.pr_WAN0"
       ]
   },
   {
       "name": "Customer_C",
       
           "proxy_address": "10.10.10.12"
       
       "default_profile": "Mitel",
       "sip_transport_servers": [
           "SIP_TS_WAN_5060"
       ],
       "port_ranges": [
           "Host.pr_WAN0"
       ]
   }
]

Please follow the pictures respectively:
Need help with the syntax for adding NAPs with the API 110
Need help with the syntax for adding NAPs with the API 210
Need help with the syntax for adding NAPs with the API 310
Need help with the syntax for adding NAPs with the API 410
Need help with the syntax for adding NAPs with the API 510
Need help with the syntax for adding NAPs with the API 610
Need help with the syntax for adding NAPs with the API 710
Need help with the syntax for adding NAPs with the API 810

Guest
Guest


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum