greptilian logo

IRC log for #rest, 2016-05-24

#rest on freenode has been logged here from May 2014 until end of July 2018 but logging has been suspended because the channel has been riddled with spam since August 2018 with no end in site. See the following blog posts about the problem:

Until the spam problem has been dealt with and logging can resume, please visit our wiki at https://trygvis.io/rest-wiki/

Thanks.

| Channels | #rest index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

All times shown according to UTC.

Time S Nick Message
00:23 quimrstorres joined #rest
00:55 locks joined #rest
01:54 Coldblackice_ joined #rest
02:24 quimrstorres joined #rest
03:26 quimrstorres joined #rest
05:20 pindonga joined #rest
05:27 quimrsto_ joined #rest
06:19 saml joined #rest
06:20 rickharrison joined #rest
06:22 ramsey joined #rest
06:26 Macaveli joined #rest
06:43 quimrstorres joined #rest
06:49 Coldblackice_ joined #rest
07:11 timg__ joined #rest
09:15 nesselbosch joined #rest
10:19 rxo joined #rest
10:42 Macaveli joined #rest
10:49 Macaveli joined #rest
11:52 timg__ joined #rest
12:44 quimrsto_ joined #rest
14:01 saml_ joined #rest
15:35 tbsf joined #rest
15:45 saml_ joined #rest
15:55 Coldblackice_ joined #rest
16:01 tbsf_ joined #rest
16:06 saml_ joined #rest
16:22 ozette joined #rest
16:28 ozette left #rest
17:07 wsieroci joined #rest
17:57 bluezone joined #rest
18:57 quimrstorres joined #rest
19:13 eschmidbauer__ joined #rest
19:15 eschmidbauer__ left #rest
19:30 ezio joined #rest
19:30 ezio what action do i use for updating a record?
19:30 ezio from what i'm seeing i should be using post to create a new record
19:31 ezio and put to update ... but update is not idempotent?
19:31 ezio or something like that
19:31 ezio i'm assuming idempotence is being able to make the same request and always get the same result?
19:31 asdf update is often idempotent - the old resource is replaced with a new one; if you send the same new one again, the state on the server won't change
19:32 ezio g(f(x)) = f(x)
19:32 asdf do you mean updating by script? like sending a "increase the 'x' attribute by 1, but i dont care what it is currently"
19:32 asdf use PATCH for that if so
19:32 asdf (and some mediatype like eg. json-patch)
19:33 ezio no i was just saying what i understand of idempotence in a mathematical sense
19:33 ezio patch
19:33 asdf then yep it's that
19:33 asdf well, f(f(x))
19:34 ezio well yeah more generally g is the idempotent function
19:34 asdf in this case g would need to be the identity function - returning whatever argument it got: since you defined that g(x) must return x
19:34 ezio uhh okay so i should be using patch to just update the text in a blog
19:35 asdf but we talk about idempotence in the context of calling the same function multiple times
19:35 asdf update how? PUT is simpler: just send the new data
19:35 asdf PATCH is mainly for scripted operations like that (but sometimes it's dumbed down to just accepting a subset of attributes of the resource)
19:36 ezio yes but x can be a function
19:38 ezio what do you mean it's simpler
19:39 asdf the idea of PUT is simple: you send some data, and the existing resource is replaced with the data you sent, that's it
19:40 asdf the idea of PATCH on the other hand is that you send a "representation of changes" that are to be done. So, example: let's say your resource is a number, eg. the number 1 - now say you want to update it, so you can just PUT "2", and it gets replaced, done. However PATCH is for when you want to send something like "x+1" instead, to have the server evaluate that
19:40 asdf this is somewhat rarely done in practice but yeah that's the idea
19:40 ezio ah yes
19:40 ezio thank you
19:41 asdf what often happens in practice is, you have a resource like {a:1, b:2}, and people say that PUT will replace the resource: so you can PUT a "{a: 2, b: 3}
19:41 asdf but with PATCH, the new state will get merged into the old one, so you can PATCH "{b: 2}" and the 'a' would stay as it was before
19:42 asdf this is not as powerful as the 'script' idea
19:42 asdf so for example here's a mediatype that shows one way of writing these PATCH "scripts": http://jsonpatch.com/
20:29 quimrstorres joined #rest
20:30 quimrstorres joined #rest
20:34 quimrstorres joined #rest
20:46 Devastator_ joined #rest
20:49 quimrstorres joined #rest
21:10 quimrstorres joined #rest
22:17 quimrstorres joined #rest
22:56 fuzzyhorns joined #rest
23:57 fuzzyhorns joined #rest
23:58 fuzzyhorns joined #rest

| Channels | #rest index | Today | | Search | Google Search | Plain-Text | plain, newest first | summary

#rest on freenode has been logged here from May 2014 until end of July 2018 but logging has been suspended because the channel has been riddled with spam since August 2018 with no end in site. See the following blog posts about the problem:

Until the spam problem has been dealt with and logging can resume, please visit our wiki at https://trygvis.io/rest-wiki/

Thanks.