curl send get request code example

Example 1: curl post json

curl -X POST -H "Content-Type: application/json" \
 -d '{"username":"abc","password":"abc"}' \
 https://api.example.com/v2/login

Example 2: curl post request

curl -d "user=user1&pass=abcd" -X POST https://example.com/login

Example 3: curl get example

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://hostname/resource

Example 4: curl post

curl --data '' https://example.com/resource.cgi

curl -X POST https://example.com/resource.cgi

curl --request POST https://example.com/resource.cgi

Example 5: curl in api

curl is a command line client to send request and
get respond from command line, so it's basically 
it's just way to send a request and response. Where you
send it we call it client. But with postman we can do more
than just sending request end respond.
This tool is preferred for automation, 
since it is designed to work without user interaction.
curl can transfer multiple file at once.
Also A lot of API documentation provide curl
command for example when we run the request and
Postman can easily import curl command without you
manually typing the whole part of the request.

Example 6: curl command

curl --header "Authorization: key=AAAAbh_xxx-nI:APBAwd91bGn1OssamQlG4R1v84yXOv-6oynz1i4eNltzQLd5ojIiFSHvnCFHJyA33QcRfeAMa5As2mjfEjkRA_XA-YM8gsqEQssm3Ykrn8FSBEwwwkot5KPWY0zMefYB1RZj1ZlZfsWy" --header "Content-Type: application/json" -d '{"to": "f8UQCp0VHqCrBR0Yeiwx0:APA91bHuqLN7Wp40U2Wt8LS3VcRipttiViYF4TXHKP1Rusdov542XEgUYaVk9GIAEM3Q2kHcME5D85BsyWg7vk3H3oLhKJdNQLSNyoxzfnhGAvuQo4BiTZ43sIdVGQ7t86WQDn6s9HBj", "data": {"status": "New information!!!"}}' https://fcm.googleapis.com/fcm/send