Sunday, November 4, 2018

curl example

In my freelance job, I have tasked which I need to call the API using curl. I don't have any much knowledge of it but I think I got some idea.

Basically, the API is called by a PDA mobile device where a user can enter the information and will send through JSON format and call the API.

But the API call will not always return success. The first task which I want to do is to store that raw json into the server, which I already finish implemented.

The second one is to call the API through curl and passing the failed raw JSON. So before will run the curl, a user who only has SSH access to a server can able to edit the raw JSON and run curl to call API with edited raw JSON.

here's the curl syntax:

curl -vX POST http://206.189.159.4:8080/chicken/api/order/create -d @json/20181008-180947_PDA_1.json --header "Content-Type: application/json"


let me explain more:
-v = verbose
X = request
-d = data json file (i don't know why there is @ at the beginning)
--header "Content-Type: application/json" = i think its understandable as we pass json file here



Eureka!

No comments:

Post a Comment

free online comma separating tool

https://delim.co/#