Curl Command
In this post, we will learn about basic curl command with helps of example.
In this post, we will learn about basic curl command with helps of example.
GET CALL
GET API call without parameters
curl -X GET "https://example.com" -H "accept: application/json"
GET API call with parameter curl -X GET "https://example.com?parameter1=parameter1¶meter2=parameter2" -H "accept: application/json"
POST CALL
POST API call without parameter
curl -X POST "https://example.com" -H "accept: application/json"
POST API call with parameter
curl -X POST "https://example.com" -H "accept: application/json" -H "Content-Type: application/json" -d "{ "parameter1": "parameter1", "parameter2": "parameter2"}"
PATCH CALL
PATCH API call with parameter
curl -X PATCH "https://example.com/path_parameter" -H "accept: application/json" -H "Content-Type: application/json" -d "{'body_parameter1': 'body_parameter1', 'body_parameter1': 'body_parameter1'}"
PUT CALL
PUT API call with parameter
curl -X PUT "https://example.com" -H "accept: application/json" -H "Content-Type: application/json" -d "{'parameter1': 'parameter1', 'parameter1': 'parameter1'}"
DELETE CALL
curl -X DELETE "https://example.com/path_parameter" -H "accept: application/json"
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Comments
Post a Comment