cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1405
Views
0
Helpful
3
Replies

rest api query without operations container in response?

peter.z.larsson
Level 1
Level 1

Using REST API you get the operations container. Is there a flag for omitting the operations container in the response (both the built in and user defined in the yang service)?

I use pyangbind to create an service Object in my application. I don't want to include the operations part in my object. 

I handle it now but its a bit messy...

 

Example(postman):

URL: GET https://10.12.10.75:8888/api/config/lan5-l1:lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb

HEADER: accept/application/vnd.yang.data+json

Response:

{
"lan5-l3-uc:lan5-l3-uc-service": {
"sp-name": "bitcom",
"service-type": "bb",
"spid": 15,
"nni": [
{
"device-name": "gbg0-spser-1"
},
{
"device-name": "gsl-spser-1"
}
],
"subscriber-termination": [
{
"primary-bng": "kt-bng-01"
},
{
"primary-bng": "lib-bng-01"
},
{
"primary-bng": "mtc-bng-01"
},
{
"primary-bng": "sv-bng-01"
}
],
"operations": {
"check-sync": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/check-sync",
"deep-check-sync": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/deep-check-sync",
"re-deploy": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/re-deploy",
"reactive-re-deploy": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/reactive-re-deploy",
"touch": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/touch",
"get-modifications": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/get-modifications",
"un-deploy": "/api/config/lan5/lan5-l3-uc:lan5-l3-uc-service/bitcom,bb/_operations/un-deploy"
}
}
}

 

2 Accepted Solutions

Accepted Solutions

richsun
Cisco Employee
Cisco Employee

Append the following to the end of your URL should exclude operations

?operations=false

I tried it using  https://wwwin-github.cisco.com/nsopl/rest-api-explorer like this:

/api/config/devices/device/DEVICE1?operations=false

View solution in original post

Thanks!

As an addition if there are user created operations nested in the request the following works as well:

<path>?deep&operations=false

View solution in original post

3 Replies 3

richsun
Cisco Employee
Cisco Employee

Append the following to the end of your URL should exclude operations

?operations=false

I tried it using  https://wwwin-github.cisco.com/nsopl/rest-api-explorer like this:

/api/config/devices/device/DEVICE1?operations=false

Thanks!

As an addition if there are user created operations nested in the request the following works as well:

<path>?deep&operations=false

Yes,   <path>?deep&operations=false  will work.

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?