Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
devTea26394276dSeems fine to me, makes reading it easier as well
TempestasLudi921276dWell, one would use a GET request for fetching search results. You could however allow a POST to an endpoint like /search, that would return a token like /search/a1b2c3d4, which in turn could be used to get the search results, I guess?
Brolls3632275dHonestly? REST is a broken fucking mess, and the fact there are so many questions on it all over the place speaks to that.
For something that is supposed to be stateless, the solution of posting a search “request” and getting a resource identifier for the results which you then fetch is logically sound, but in practice just a nightmare, not least because of the introduction of additional reliance on the data store.
I’d honestly say to hell with it, accept a post request, and take a JSON payload describing the search (parameters and all) and just spit back the response.
zarazas29275dIf you have time maybe take a look at graphql. Especially if you have many parameters it might be the right solution for you
tamusjroyce133275dI let loopback.io handle some of that. Soap/xml was way too heavy. Rest is way to light / under-developed.
I’m not a fan of sql-like url querying. Might as well pass actual sql. And rely on a sanitizing library. But that is just me.
TempestasLudi921275d@TRex Okay, couple of questions:
- Why did you tag me in it? It does not seem to specifically concern me;
- What language is this? I don't really recognize it;
- Why did you post it? OP asked whether it would be acceptable to fetch stuff via a POST request, not how one would implement a backend that would support it. He implies that he can do the actual coding of the frontend/backend himself ;-)
cursee19169265dGET URL has character limits. So yeah, if it's really long, you should go with POST.
Your Job Suck?
Take a quick quiz from Triplebyte to skip the job search hassles and jump to final interviews at hot tech firms
Get a Better Job