Here is the cheat sheet i made for HTTP for the Transfer assignment. It was easy to follow with clear instructions on what to do and what something does. And because of this it's also easy to reference back to on a later date in combination with the cheat sheet.
curl localhost:1901 --verbose: Show the head and body of the HTTP
HEAD: Don’t send any data back.
curl localhost:1901 --verbose --request HEAD /
GET: Give back something. curl localhost:1901 --verbose --request GET localhost:1901/wonder-woman
POST: Adds something to a resource. curl localhost:1901 --verbose --request POST --data '{"title":"Wonder Woman"}'
PUT: Places something exactly where you want it. curl localhost:1901 --verbose --request PUT localhost:1901/wonder-woman --data '{"title":"Wonder Woman","plot":"Diana fights a war"}'
PATCH: Changes only a few things. curl localhost:1901 --verbose --request POST --data '{"title":"Wonder Woman"}'
DELETE: Is used to remove things.
curl localhost:1901 --verbose --request DELETE localhost:1901/wonder-woman
HTTP status codes:
200: Everything is ok and is behaving as expected.
201: Succes code for new resources.
204: That content doesn't exist.
401: Unauthorized, you are not permitted to do that.
404: The data is not found.
405: You are not allowed to carry out that method.
410: Gone, there used to be something but it is gone
422: The request was valid but something was wrong with the error
HTTP headers:
Accept and Content-Type: Lets you see the data in different formats like xml and gzip. curl localhost:1901 --verbose --request GET / --header 'Accept: application/xml' curl localhost:1901 --verbose --request GET / --header 'Accept-Encoding: gzip'
Authorization: Makes sure you have the right authorisation to carry out a request. curl localhost:1901 --verbose --request DELETE localhost:1901/evil-dead --header 'Authorization: token 5b8822b29'
Here is the cheat sheet i made for HTTP for the Transfer assignment. It was easy to follow with clear instructions on what to do and what something does. And because of this it's also easy to reference back to on a later date in combination with the cheat sheet.
curl localhost:1901 --verbose
: Show the head and body of the HTTPHTTP methods:
curl localhost:1901 --verbose --request OPTIONS localhost:1901/wonder-woman
curl localhost:1901 --verbose --request HEAD /
curl localhost:1901 --verbose --request GET localhost:1901/wonder-woman
curl localhost:1901 --verbose --request POST --data '{"title":"Wonder Woman"}'
curl localhost:1901 --verbose --request PUT localhost:1901/wonder-woman --data '{"title":"Wonder Woman","plot":"Diana fights a war"}'
curl localhost:1901 --verbose --request POST --data '{"title":"Wonder Woman"}'
curl localhost:1901 --verbose --request DELETE localhost:1901/wonder-woman
HTTP status codes:
HTTP headers:
curl localhost:1901 --verbose --request GET / --header 'Accept: application/xml'
curl localhost:1901 --verbose --request GET / --header 'Accept-Encoding: gzip'
curl localhost:1901 --verbose --request DELETE localhost:1901/evil-dead --header 'Authorization: token 5b8822b29'