greptilian logo

IRC log for #rest, 2014-12-19

https://trygvis.io/rest-wiki/

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

All times shown according to UTC.

Time S Nick Message
01:36 talios joined #rest
02:20 lufi joined #rest
03:03 lufi joined #rest
03:15 lemur joined #rest
03:53 tr3onlin_ joined #rest
04:03 lufi joined #rest
04:21 lufi joined #rest
04:43 tr3online joined #rest
05:03 lufi joined #rest
05:43 lufi joined #rest
06:17 lemur joined #rest
06:17 lemur joined #rest
06:28 Jarda in my API I have this resource/route called /expenses
06:28 Jarda and expenses can be added by POSTing to /expenses with a json object
06:28 Jarda now I have to add bulk upload from various formats (csv/xml etc)
06:29 Jarda I could of course use the same POST to /expenses and difference from content-type request header
06:29 Jarda but then the response will be a problem
06:30 Jarda now my responses are JSON objects with a 201 status code and Location header
06:30 Jarda and if I bulk upload to the same resource then I can't return just one object nor a location header
06:31 Jarda should I just create a new 'virtual' resource where to upload
06:31 Jarda like POST /expenses/_batch ?
06:32 Jarda and that could then just return something like {"message": "OK", "created_count": 142} ?
06:42 lufi joined #rest
07:12 lufi joined #rest
07:39 lufi joined #rest
08:05 lufi joined #rest
08:11 lemur joined #rest
08:17 proteusguy joined #rest
08:23 lufi joined #rest
08:38 trygvis Jarda: that would work
09:02 tr3online joined #rest
09:04 trygvis I think I would definitely lmake ma
09:04 trygvis ops
09:04 trygvis make a batch endpoint for something like that
09:04 marcoslamuria joined #rest
09:12 marcoslamuria joined #rest
09:21 graste joined #rest
09:23 lufi joined #rest
09:37 interop_madness joined #rest
10:19 lufi joined #rest
10:23 marcoslamuria joined #rest
10:36 marcoslamuria joined #rest
10:39 Left_Turn joined #rest
10:53 interop_madness i don't seem to find a good way to map searching functionality to a REST resource. i could only come up with POST myserver/myresource/search (with search constraints inside the body), or GET /myserver/myresource/search?constr​aint1=value1&constraint2=value2...   any better ideas?
11:03 tr3online joined #rest
11:10 trygvis that's your main options
11:10 trygvis but this all comes down to what your hypermedia can express
11:37 Jarda I have done 'cached' searches
11:38 Jarda POST /search with search terms in body
11:38 Jarda it responds with a redirect to /search/134134
11:38 Jarda and GETtin /search/134134 always returns the same results
11:38 Jarda I hate it when going through paginated results and the results change between pages
11:39 Jarda so I either miss some of the results or get sometimes doubles
11:40 trygvis yeah. but I would default to the technique I talked about yesterday. don't use page=nn, use after_id=xyz
11:40 trygvis it's the same thing as using the indexes to get fast paging in postgresql :)
11:41 Jarda yeah I have never thought of that
11:41 Jarda but then that won't work with ordered results
11:41 trygvis sure it wil
11:41 trygvis l
11:42 trygvis I usually either sort by either id or lastUpdatedDate
11:42 Jarda how about orderBy=name
11:43 Jarda even with lastUpdatedDate you can't workaround the problem that you might miss some search results if the dataset changes
11:43 trygvis how is that a problem?
11:43 trygvis I also have createdDate so you can constrain it with it having a createdDate before <timestamp> too
11:44 Jarda well maybe that's just my personal taste
11:44 Jarda but I don't like that when (UI-wise) I go through paginated results I might miss some results
11:44 trygvis this is a networked service so you will have to describe if stuff can change in your feeds
11:44 Jarda or I get same results multiple times
11:44 trygvis yeah, that is a problem
11:48 trygvis if you want something perfect you will have to save the result set somewhere
11:48 Jarda yes
11:48 trygvis (note how all of these solutions shows how important it is that the server creates the URL!)
11:49 Jarda I have done stuff where I save the search result set to redis
11:49 Jarda and then POSTing to the result url will refresh the search
11:50 trygvis what does the client post to get the update?
11:50 trygvis sounds almost like a subscription more than a normal search
11:52 trygvis couldn't the client just use one of those headers who's name I can think of now to request a fresh version?
11:54 Jarda If-None-Match
11:54 Jarda that's actually a very good question
11:54 Jarda Why didn't I use ETag + If-None-Match :D
11:54 trygvis no, that doesn't force a refresh. it just tells the client to reuse what it has
11:54 trygvis but it's a good combination
11:54 Jarda oh
11:54 Jarda I got these mixed now
11:54 trygvis http://tools.ietf.org/html/rfc2616#section-14.9
11:54 Jarda mabe it's cache headers
11:54 Jarda I would have to use
11:55 trygvis min-fresh seems like what you want
11:55 trygvis the upside is that you can use a generic http cache in front too
11:55 Jarda mmm, yeah
12:38 Left_Turn joined #rest
12:47 lufi joined #rest
13:05 tr3online joined #rest
13:44 nkoza joined #rest
13:56 Mxyzpltk joined #rest
14:06 tr3online joined #rest
14:47 marcoslamuria joined #rest
15:07 tr3online joined #rest
16:16 quimrstorres joined #rest
17:08 marcoslamuria joined #rest
17:08 tr3online joined #rest
17:12 mezod joined #rest
17:20 proteusguy joined #rest
17:33 fumanchu_ joined #rest
17:54 proteusguy joined #rest
17:54 Mxyzpltk joined #rest
18:08 scflode joined #rest
18:30 rosstuck joined #rest
18:33 marcoslamuria joined #rest
18:36 rosstuck joined #rest
18:47 tr3online joined #rest
19:05 tmoore_ joined #rest
19:09 ekroon__ joined #rest
19:48 scflode joined #rest
19:59 graste joined #rest
20:01 Mxyzpltk joined #rest
20:05 rosstuck joined #rest
20:20 whartung joined #rest
20:23 graste joined #rest
21:09 graste joined #rest
21:20 graste joined #rest
21:30 graste joined #rest
22:41 proteusguy joined #rest

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

https://trygvis.io/rest-wiki/