‘HTTP/1.1 406 Not Acceptable’ response from API when using CURL

Reply
L3 Networker

‘HTTP/1.1 406 Not Acceptable’ response from API when using CURL

I am running curl against the API URL where I have VM-1000-HV PAN (7.0.1) and getting ‘HTTP/1.1 406 Not Acceptable’ response (see output below). The same URL works fine in the browser (just copied and pasted to Chrome), so it is correct.

 

$ curl -v --insecure "https://10.95.2.234/esp/restapi.esp?type=op&cmd=<show><running><resource-monitor><second></second></resource-monitor></running></show>&key=LUFRPT0wOFBSTWxOdGIvazFxRkc2b2VpZnNnTUEyc1E9QnRPY0ZGNWhMd3Rya3l6VndyZnVhUT09 ="
* About to connect() to 10.95.2.234 port 443 (#0)
*   Trying 10.95.2.234... connected
* Connected to 10.95.2.234 (10.95.2.234) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
*       subject: E=support@paloaltonetworks.com,CN=localhost,OU=Support,O=Palo Alto Networks,L=Sunnyvale,ST=CA,C=US
*       start date: Jul 12 22:18:24 2010 GMT
*       expire date: Jul 11 22:18:24 2020 GMT
*       common name: localhost
*       issuer: E=support@paloaltonetworks.com,CN=localhost,OU=Support,O=Palo Alto Networks,L=Sunnyvale,ST=CA,C=US
> GET /esp/restapi.esp?type=op&cmd=<show><running><resource-monitor><second></second></resource-monitor></running></show>&key=LUFRPT0wOFBSTWxOdGIvazFxRkc2b2VpZnNnTUEyc1E9QnRPY0ZGNWhMd3Rya3l6VndyZnVhUT09 = HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.95.2.234
> Accept: */*
>
< HTTP/1.1 406 Not Acceptable
< Server:
< Date: Thu, 14 Apr 2016 14:28:55 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< ETag: "2b27-5c-5596c066"
< X-FRAME-OPTIONS: SAMEORIGIN
<
* Connection #0 to host 10.95.2.234 left intact
* Closing connection #0
[irek@nms01m ~]$

 

L3 Networker

Re: ‘HTTP/1.1 406 Not Acceptable’ response from API when using CURL

I've added -H "Accept: text/javascript, text/html, application/xml, */*" to curl but still the same error. At least I see Accept header set correctly in the request

 

> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.18 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.95.2.234
> Accept: text/javascript, text/html, application/xml, */*
> 
< HTTP/1.1 406 Not Acceptable
< Server: 
< Date: Thu, 14 Apr 2016 16:56:32 GMT
< Content-Type: text/html
< Transfer-Encoding: chunked
< Connection: keep-alive
< ETag: "2b27-5c-5596c066"
< X-FRAME-OPTIONS: SAMEORIGIN
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!