greptilian logo

IRC log for #rest, 2017-11-29

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
04:48 Juggie left #rest
07:38 Haudegen joined #rest
19:30 wsieroci joined #rest
20:54 wsieroci joined #rest
21:00 Left_Turn joined #rest
21:33 Kingsy joined #rest
21:34 Kingsy anyone around?
21:35 whartung si
21:38 Kingsy I have a question about url design, would this be a good place to ask this? This is a channel for RESTful http APIs right?
21:39 whartung you can ask, but I particularly don’t really care about uri design. I pay very little attention to it, as it’s more a distraction than anything else.
21:39 whartung I beat the “URIs are opaque” drum.
21:39 Kingsy well, riddle me this.
21:40 Kingsy I have a two actions, /user (which returns a user object or collection of) and a /autocomplete/user?filter1=1&filter2=2 endpoint which returns an autocomplete object filled with user information
21:40 Kingsy looking at most docs restful urls should always be the name of the resource
21:41 Kingsy which means /autocomplete/user is wrong, but an autocomplete isnt a "thing"
21:41 whartung resources are named — it’s a key criteria of what makes them a resource.
21:41 whartung why is that wrong?
21:41 Kingsy but I do need to namespace those actions somehow because the objct they return are totally different, albeit they share the same information
21:42 Kingsy because shouldnt the url start with the resource name? in thsi case "user"
21:42 whartung the ENTIRE URL is the resource name.
21:42 whartung not just pieces.
21:43 Kingsy well, given the tqo urls I have just mentioned, what would be your naming convention?
21:43 Kingsy ../user /user/autocomplete?... ?
21:43 whartung why do you think /autocomplete/user is wrong?
21:44 whartung do you have a url that returns a list of users?
21:44 Kingsy because you are not trying to GET or POST an autocomplete, you are trying to GET the user, in an autocomplete format
21:44 Kingsy however like I say
21:44 Kingsy I might be misunderstanding this
21:45 whartung so, why not do a GET on /users and pass in the “autocomplete format” for the media type?
21:45 whartung because, isn’t an autocomplete list just a list of users?
21:45 Kingsy whartung: it is!!! this makes more sense!!
21:45 Kingsy however...
21:46 Kingsy this poses a problem, I have a UserController and an AutocompleteController and it feels like they should be in the same controller now...
21:47 whartung perhaps
21:47 Kingsy hmm damn that does make sense.
21:47 whartung thank heavens for refactoring and cut and paste!
21:47 Kingsy just screws my framework strcture
21:47 whartung sorry
21:48 Kingsy its not just that, I have even seperated them into two different bundles ebcause it uses a totally different data source to populate the objects even though the data is similar.
21:49 whartung ok
21:49 Kingsy whartung: can you think of another way to logically separate them?
21:49 Kingsy hehe kinda clutching at straws
21:50 whartung well, I don’t see them as separate — I think of an autocomplete as just a list of users (perhaps a lightweight list, but...)
21:50 Kingsy yeah you are absolutely right.
21:50 Kingsy I need to merge the bundels... damn damn damn.. heh
21:55 Kingsy is there a general convention for media types?
21:56 Kingsy obviously "autocomplete" isnt in the list of attempted media types.
21:56 whartung text/x-user-autocomplete
21:56 whartung nothing wrong with that
21:57 Kingsy now i just need to think of a nice way to parse that type and run a service function without a if..elseif..elseif...else crappy statement.
21:58 whartung https://stackoverflow.com/questions/7846900/rest-api-having-same-object-but-light
21:58 whartung that’s my opinion there
21:58 whartung so you don’t need a dedicated type
21:58 Kingsy yup! it makes perfect sense tbh
21:58 Kingsy exactly the infromation I was looking for!
21:59 whartung text/html that just returned <ul><li>Bob</li><li>Bobby</li></ul>
22:00 Kingsy well, it only returns json, so I am guessing it will be json/x-user-autocomplete
22:00 whartung whatever floats your boat :)
22:00 whartung I point out the post for the “;lite” aspect
22:02 whartung so, you know, application/json;autocomplete for example
22:05 Kingsy ahh ok, makes more sense. thanks
22:09 Kingsy whartung: you a php programmer by chance?
22:09 whartung nope, I can’t even spell PHP
22:10 Kingsy hahah

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

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