Curl command example

Example 1: curl get example

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

Example 2: curl example

curl --request POST \
  --url https://api.sendgrid.com/v3/mail/send \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{"personalizations": [{"to": [{"email": "[email protected]"}]}],"from": {"email": "[email protected]"},"subject": "Hello, World!","content": [{"type": "text/plain", "value": "Heya!"}]}'

Example 3: how to use curl command in ubuntu

curl -o vue-v2.6.10.js https://cdn.jsdelivr.net/npm/vue/dist/vue.js

Example 4: how to use curl command in ubuntu

curl -O http://mirrors.edge.kernel.org/archlinux/iso/2018.06.01/archlinux-2018.06.01-x86_64.iso  \     -O https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.4.0-amd64-netinst.iso

Example 5: curl command

#usage:
curl 
#it returns the raw text of the page (or anything else) at  in the internet
#to stdout
#examples:
#put the output into 
curl  > 
#to search for 
curl  | grep //
#to uncompress the output
curl  | gunzip

#you get the hang of it.

#helpful if you are testing a server :)
#be sure to be on bash or powershell!

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

Tags:

Misc Example