cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2237
Views
0
Helpful
4
Replies

SDWAN API Response is not in JSON

piyush.singh02
Community Member

Hi Team,

While making an API call to the SandBox SDWAN instance(Always On) using Postman response is not coming in JSON, It's coming as html. 

 

In my request header is in Application/JSON only. Am I missing something here ?  Thanks 

 

 

1 Accepted Solution

Accepted Solutions

 

Sure see, below. You can grab the same environment file from the code exchange link I posted above. One thing is noticed from your output is you are doing a POST request, where I am trying a GET request,

 

Screenshot 2020-08-04 at 12.07.56.png

 

I tried the POST requested with the following JSON body (Get 10,000 alarms from the previous six hours using the query below) No issues seen here.

 

{
  "query": {
    "condition": "AND",
    "rules": [
      {
        "value": [
          "6"
        ],
        "field": "entry_time",
        "type": "date",
        "operator": "last_n_hours"
      }
    ]
  },
  "size": 10000
}

Screenshot 2020-08-04 at 12.13.18.png

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

View solution in original post

4 Replies 4

Hey there, i update this postman collection https://developer.cisco.com/codeexchange/github/repo/CiscoDevNet/Postman-for-AlwaysOn-Cisco-SD-WAN and added the parameter you have (alarms). On my postman client, I have the option of changing the data format. You can do this by clicking on, pretty and updating this to JSON. See below.

 

Hope this helps!

 

Screenshot 2020-08-04 at 09.02.14.png

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi, Thanks for you response.

I am using the JSON only on pretty but it's coming as html only, please see snapshot here.

 

Do you think this is environment specific issue ? Can you share your request API headers. I kept it content type:application/json only 

 

html Response .jpg

 

 

 

Sure see, below. You can grab the same environment file from the code exchange link I posted above. One thing is noticed from your output is you are doing a POST request, where I am trying a GET request,

 

Screenshot 2020-08-04 at 12.07.56.png

 

I tried the POST requested with the following JSON body (Get 10,000 alarms from the previous six hours using the query below) No issues seen here.

 

{
  "query": {
    "condition": "AND",
    "rules": [
      {
        "value": [
          "6"
        ],
        "field": "entry_time",
        "type": "date",
        "operator": "last_n_hours"
      }
    ]
  },
  "size": 10000
}

Screenshot 2020-08-04 at 12.13.18.png

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io

Hi, Looks like some issue in my local environment only.

 

I tried in my colleague's system & it seems to be working fine as expected. 

 

Just FYI, I am trying post call only. 

 

Thanks for you support