Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cURL - Invalid character is found in given range 'start' - 'stop'

Tags:

rest

http

curl

api

I'm making a restful api call, but I'm getting an error.

Warning: Invalid character is found in given range. A specified range MUST 
Warning: have only digits in 'start'-'stop'. The server's response to this 
Warning: request is uncertain.
HTTP/1.1 200 OK
Date: Thu, 22 Aug 2013 17:43:19 GMT
Server: Apache
Content-Length: 208
Allow: GET, HEAD, POST
Vary: Authorization
Content-Type: application/json

Has anyone seen this WARNING error before about an invalid character? How do I fix it?

I was calling:

curl https://my/url/for/api --include -H "Content-Type:application/json" -request POST '{ \"type\": \"code\", \"objects\" : [ \"123456\" ] } ' -u user:pass

More info:

extra response at the end of return

curl: (6) Could not resolve host: POST; nodename nor servname provided, or not known

curl: (3) [globbing] nested braces not supported at pos 33
like image 700
Marcus Avatar asked Feb 15 '23 11:02

Marcus


1 Answers

I had a similar situation - my curl request was essentially working, and returning the information I needed, but with warnings, using the following code:

curl -request http://...

It turned out to be the -request parameter, which I'd incorrectly typed. It either needs to be something like:

curl --request GET http://...

or simply not there at all (because GET is the default):

curl http://...
like image 133
James Ford Avatar answered Apr 07 '23 06:04

James Ford