Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

curl (3) and "URL using bad/illegal format or missing URL"

Tags:

url

curl

I have been trying to figure out why i cant run this piece of code for a while now.

curl -X POST '<a href="http://tp-api.herokuapp.com/beacons/" rel="nofollow">tp-api-server.herokuapp.com/beacons</a>' -H 'Content-Type: application/json' -d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}' 

Output:

curl: (3) URL using bad/illegal format or missing URL

All help would be appreciated

like image 378
Ryder-azadi Avatar asked Nov 01 '25 18:11

Ryder-azadi


1 Answers

You can't just put an HTML anchor link in the command. Remove this and put the URL at the end of the command:

curl -X POST
-H 'Content-Type: application/json'
-d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}'
http://tp-api.herokuapp.com/beacons/

One liner:

curl -X POST -H 'Content-Type: application/json' -d '{"beacons": [{"id": "a", "location": [10, 0]}, {"id": "b", "location": [0, 10]}, {"id": "c", "location": [0, 0]} ]}' http://tp-api.herokuapp.com/beacons/
like image 176
v25 Avatar answered Nov 04 '25 13:11

v25