HTTP and GraphQL Flashcards

1
Q

What is the difference between put and patch? When would you want to use put instead of post, when would you want to use patch instead of post?

A

Put will update a single item:
PUT /device-management/devices/{id}

Whereas POST will create a new device:
POST /device-management/devices

Patch will update a single device, but payload is different
PATCH /device-management/devices/{id}

PUT /device-management/devices/{id} 
{
  address: 'plot 1',
  owner: 'segun',
  type: 'duplex',
  color: 'green',
  rooms: '5',
  kitchens: '1',
  windows: 20
}

PATCH /device-management/devices/{id}
{
windows: 21
}

Failed requests are not retried.

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