Skip to content

Instantly share code, notes, and snippets.

@tshego3
Last active December 30, 2023 23:16
Show Gist options
  • Save tshego3/c933540807db48030d9748f326e90d69 to your computer and use it in GitHub Desktop.
Save tshego3/c933540807db48030d9748f326e90d69 to your computer and use it in GitHub Desktop.
CURL REST API Requests
curl -i -X GET "http://localhost:3000/" -H "accept: */*" -H "Content-Type: application/json"

curl -i -X GET "http://localhost:3000/{id}" -H "accept: */*" -H "Content-Type: application/json"

curl -i -X GET "http://localhost:3000/{id}" -H "accept: */*" -H "Authorization: Bearer eyJhbGciOiJ...."  -H "Content-Type: application/json"

curl -i -X POST "http://localhost:3000/" -H "accept: */*" -H "Content-Type: application/json" -d "{\"author\":\"Test Author\",\"books\":[{\"title\":\"Test Title\",\"year\":2007}]}"

curl -i -X POST "https://repository-manager-server.netlify.app/api/nexuses/" -H "accept: */*" -H "Content-Type: application/json" -d "{\"nexus\":\"Material Components Web - Codelabs Master - MDC-101 Starter\",\"raw_nexus\":\"https://codelabs.developers.google.com/codelabs/mdc-101-web/#1\"}"

curl -i -X POST "https://repository-manager-server.netlify.app/api/nexuses/" -H "accept: */*" -H "Content-Type: application/json" -d "{\"nexus\":\"MDC Web on other frameworks\",\"raw_nexus\":\"https://m2.material.io/develop/web/guides/framework-wrappers\"}"

curl -i -X POST "https://repository-manager-server.netlify.app/api/nexuses/" -H "accept: */*" -H "Content-Type: application/json" -d "{\"nexus\":\"Material Web Components for Angular\",\"raw_nexus\":\"https://trimox.github.io/angular-mdc-web/#/angular-mdc-web/home\"}"

curl -i -X PUT "http://localhost:3000/{id}" -H "accept: */*" -H "Content-Type: application/json" -d "{\"author\":\"Sample Author\",\"books\":[{\"title\":\"Sample Title\",\"year\":2008}]}"

curl -i -X PATCH "http://localhost:3000/{id}" -H "accept: */*" -H "Content-Type: application/json" -d "{\"author\":\"Sample Author\",\"books\":[{\"title\":\"Sample Title\",\"year\":2008}]}"

curl -i -X DELETE "http://localhost:3000/{id}" -H "accept: */*" -H "Content-Type: application/json"

curl -i -X POST "https://login.microsoftonline.com/{tenantid}/oauth2/token" -F "grant_type=client_credentials" -F "client_id={clientid}" -F "client_secret={clientsecret}" -F "resource=https://monitoring.azure.com/"

curl -i -X POST "https://{region}.monitoring.azure.com/{resourceid}" -H "Content-Type: application/json" -H "Authorization: Bearer eyJhbGciOiJ...." -d @file.json

curl -i -X POST "http://localhost:3000/{id}" -H "accept: */*" -H "Authorization: Bearer eyJhbGciOiJ...." -F "data=@path/to/local/file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment