HTTP and RESTFUL services Flashcards

1
Q

POST

A

POST
you use POST to creat a resource and instruct the server to make a uniform resource identifier (URI) for it. For example, when you want to create anew article you would POST to /articles to make the file and get the URI, so you end up with /articles/1234/.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

PUT

A

PUT
PUT also creates resources, but it does so for a known URI. So, you can PUT to /articles/1234/. If the article doesn’t exist, PUT creates it. If it does exist, this HTTP verb updates it. While PUT seems nearly identical to POST, the difference between the two comes donw to idempotence.

Idempotence is a property that creates identical side effects whether you have one or many results. PUT has this characteristic, while POST creates new resources infinitely. In general, POST works best for resource creation, while PUT handles updates.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

PATCH

A

PATCH
This HTTP verb partially updates resources without sending the complete representation of it. When you’re working with complicated objects and resources, it’s a big deal to update more than you need to.

example:
{ “first_name”: “Claude”, “last_name”: “Elements”, “email”: “claude@cloud-elements.com”, “favorite_color”: “blue” }

PATCH allows you to change the color with: JSON :{ “favorite_color”: “purple” }.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

GET

A

The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

DELETE

A

The DELETE method deletes the specified resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly