Show the next hop for a specific route
/rest/{version}/admin/test/lrt
Request
-
version:
REST API version string.
Available values: v1.2
-
lrtName:
Specifies the name of the local route table.
-
maxElements(optional):
The maximum number of configuration element instances that is returned in a paged response. If there are not maxInstances element instances in the requested result set, then the response contains fewer instances than maxInstances. The maxElements range is between 1 and 100.
-
offset(optional):
When requesting multiple instances of a configuration element type that supports paging and a subset of all configured element instances is desired, offset must be supplied and specifies, using a 1-based index, the first instance that is returned in the response.
-
user:
Specifies the name of the user within the local route table.
-
Authorization:
The value in the Authorization header must be the string "
Bearer {access token}
", where{access token}
is a valid, unexpired token received in response to a prior/rest/{version}/auth/token
request.
Response
200 Response
400 Response
401 Response
403 Response
404 Response
Examples
Example of Accessing the API with cURL
The following example shows how to get the next hop from the local route table by submitting a GET request on the REST resource using cURL. For more information about cURL, see Use cURL.
curl -X GET \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.1/admin/test/lrt?lrtName=LRT1&user=370"
Note:
The local-route-config element must have been already configured.Example of Accessing the API with Python
The following example shows how to get the next hop from the local route table by submitting a GET request on the REST resource using Python. This example assumes you have a valid token stored in the token
variable. For an example of authenticating with Python, see Authenticate.
import requests
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
url = "https://" + sbcip + "/rest/v1.1/admin/test/lrt?lrtName=LRT1&user=370"
resp = requests.get(url, headers=headers)
Example of the Response Body
The following example shows the contents of the response body in XML format.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<testLrt>
<UserName>370</UserName>
<EntryType>E164</EntryType>
<Priority>1</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierE!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>2</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierD!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>3</Priority>
<Weight>20</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierC!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>4</Priority>
<Weight>30</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierB!</NextHop>
<NextHopType>regexp</NextHopType>
<Priority>5</Priority>
<Weight>40</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierA!</NextHop>
<NextHopType>regexp</NextHopType>
</testLrt>
</data>
<messages/>
<links/>
</response>
Example 2 of Accessing API
The following shows another example of accessing this API endpoint and its response.
Use the maxElements
parameter to specify the number of elements to return and the offset
parameter to specify where to start fetching the entries. The offset
parameter uses a 1-based index. When using paging, the <links>
element contains links to the next page. If there are no pages left, the <links>
element is empty.
curl -X GET \
--header "Accept: application/xml" \
--header "Authorization: Bearer $TOKEN" \
"https://${SBCIP}/rest/v1.1/admin/test/lrt?lrtName=LRT1&user=370&maxElements=1&offset=2"
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
<data>
<testLrt>
<UserName>370</UserName>
<EntryType>E164</EntryType>
<Priority>2</Priority>
<Weight>10</Weight>
<NextHop>!^.*$!sip:\0@SAG-CarrierD!</NextHop>
<NextHopType>regexp</NextHopType>
</testLrt>
</data>
<messages/>
<links>
<link>https://10.0.0.3/rest/v1.1/admin/test/lrt?lrtName=LRT1&user=370&offset=3&maxElements=1</link>
</links>
</response>