Skip to content

Instantly share code, notes, and snippets.

curl http://localhost:3000/friends?sort=-first-name\
| jq '.data | map(.attributes)'
curl http://localhost:3000/friends?sort=first-name\
| jq '.data | map(.attributes)'
curl -X GET http://localhost:3000/friends/2?include=loans.article\
--data-urlencode 'fields[friends]=first-name,last-name' \
--data-urlencode 'fields[loans]=id,notes' \
--data-urlencode 'fields[articles]=id' | jq
curl -X GET http://localhost:3000/friends/2\
--data-urlencode 'fields[friends]=first-name,last-name' | jq
curl http://localhost:3000/friends/2/relationships/loans -X PATCH \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":[{"id":"2", "type":"loans"}]}' -i
curl http://localhost:3000/loans -X POST \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":{"type": "loans","attributes": {"notes": "Minor issue with the throttle","returned": false},"relationships":{"article": {"data":{"type": "articles", "id": "2"}}}}}'
curl http://localhost:3000/articles -X POST \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":{"type":"articles","attributes":{"name": "Honda CRF450R","available":"true"}}}'
curl http://localhost:3000/friends/2/relationships/loans -X PATCH \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":[]}' -i
curl http://localhost:3000/friends/2/relationships/loans -X PATCH \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":[]}' | jq
curl http://localhost:3000/friends/2/relationships/loans -X POST \
-H 'Content-Type: application/vnd.api+json' \
--data-binary '{"data":[{"id":"1", "type":"loans"}]}' -i