basic curl code example

Example 1: 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 2: curl command

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

#you get the hang of it.

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

Tags:

Misc Example