| Time |
S |
Nick |
Message |
| 00:36 |
|
|
tbsf joined #rest |
| 00:48 |
|
|
tbsf joined #rest |
| 01:27 |
|
|
fuzzyhorns joined #rest |
| 01:54 |
|
|
tbsf joined #rest |
| 02:13 |
|
|
FiveBroDeepBook joined #rest |
| 02:13 |
|
|
FiveBroDeepBook left #rest |
| 02:19 |
|
|
tbsf joined #rest |
| 02:36 |
|
|
tbsf joined #rest |
| 02:48 |
|
|
tbsf joined #rest |
| 03:03 |
|
|
tbsf joined #rest |
| 04:04 |
|
|
tbsf joined #rest |
| 05:07 |
|
|
tbsf joined #rest |
| 07:06 |
|
|
FiveBroDeepBook joined #rest |
| 07:56 |
|
|
FiveBroDeepBook left #rest |
| 08:11 |
|
|
wsieroci joined #rest |
| 10:43 |
|
|
wsieroci joined #rest |
| 13:00 |
|
|
FiveBroDeepBook joined #rest |
| 13:00 |
|
|
FiveBroDeepBook left #rest |
| 14:12 |
|
|
tbsf joined #rest |
| 14:46 |
|
|
wsieroci joined #rest |
| 15:14 |
|
|
tbsf joined #rest |
| 15:57 |
|
|
fuzzyhorns joined #rest |
| 16:04 |
|
|
tbsf joined #rest |
| 16:05 |
|
|
d1z joined #rest |
| 16:05 |
|
d1z |
hello |
| 16:05 |
|
d1z |
I think a friend of mine who is a really good developer, has a confusion as to how PUT and POST map into a restful api |
| 16:06 |
|
d1z |
he tells me that POST is used to create a new object through the api, and PUT is used when you want to update that object |
| 16:07 |
|
d1z |
however I'm seeing the api of ns1.com, and they have it backwards (or right, depending on who's wrong). They use PUT to create a brand new zone or record, and then use POST to update them |
| 16:07 |
|
d1z |
who is right? |
| 16:08 |
|
asdf |
d1z, you can use the RFC as a reference - https://tools.ietf.org/html/rfc7231#section-4.3.3 |
| 16:08 |
|
asdf |
there you can read that when you send a POST, the resource itself decides what to do; and PUT is used to create or update the target resource |
| 16:08 |
|
asdf |
indeed, it is very common for a "collection" kind of resource to create a new item inside it when it receives a POST |
| 16:09 |
|
asdf |
it'd be pretty rare to do updates via POST, though |
| 16:10 |
|
asdf |
(just because why would you use a "catch-all" POST, where there are dedicated ways to do updates - ie. PUT or PATCH) |
| 16:10 |
|
asdf |
s/where/when/ |
| 16:12 |
|
d1z |
asdf: https://ns1.com/api/#records |
| 16:13 |
|
d1z |
Then they have it backwards. They use PUT to create a new record||zone and POST to update a record||zone |
| 16:13 |
|
asdf |
sure, it's technically still compliant with that rfc - if the resource chooses what to do, it can choose to update itself on a POST :) |
| 16:14 |
|
asdf |
the point about PUT is, it creates-or-updates _the target resource_; so it's fine to PUT /foo/bar/42 to create the /foo/bar/42 resource, but it'd be silly to PUT /foo/bar to create /foo/bar/42 |
| 16:14 |
|
d1z |
still, I wonder what would be the reason for doing it that way |
| 16:15 |
|
asdf |
i suppose it's because they're taking the "PUT replaces the whole state of the resource" part very literally, and they want to allow partial updates |
| 16:16 |
|
asdf |
that part isn't very important IMO - if you PUT something, there's no guarantees you'll get that exact representation back on a following GET - someone (the server itself?) might've changed the state in the meantime |
| 16:16 |
|
asdf |
(the rfc talks about that in the PUT section, too) |
| 16:18 |
|
pdurbin |
d1z: if you ask the ns1 devs for the reasons why and get an answer, please let us know. I can only assume they thought through this stuff a bit. |
| 16:22 |
|
|
_ollie joined #rest |
| 16:51 |
|
|
Haudegen joined #rest |
| 17:14 |
|
|
tbsf joined #rest |
| 17:33 |
|
|
d1z joined #rest |
| 18:11 |
|
|
Haudegen joined #rest |
| 19:03 |
|
|
Haudegen joined #rest |
| 19:28 |
|
|
d1z joined #rest |
| 20:09 |
|
|
tbsf joined #rest |
| 20:36 |
|
|
d1z joined #rest |
| 21:23 |
|
|
d1z joined #rest |
| 21:49 |
|
|
d1z joined #rest |
| 22:00 |
|
|
timg__ joined #rest |
| 22:11 |
|
|
tbsf joined #rest |
| 23:51 |
|
|
tbsf joined #rest |