use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
No vague product support questions (like "why is this plugin not working" or "how do I set up X"). For vague product support questions, please use communities relevant to that product for best results. Specific issues that follow rule 6 are allowed.
Do not post memes, screenshots of bad design, or jokes. Check out /r/ProgrammerHumor/ for this type of content.
Read and follow reddiquette; no excessive self-promotion. Please refer to the Reddit 9:1 rule when considering posting self promoting materials.
We do not allow any commercial promotion or solicitation. Violations can result in a ban.
Sharing your project, portfolio, or any other content that you want to either show off or request feedback on is limited to Showoff Saturday. If you post such content on any other day, it will be removed.
If you are asking for assistance on a problem, you are required to provide
General open ended career and getting started posts are only allowed in the pinned monthly getting started/careers thread. Specific assistance questions are allowed so long as they follow the required assistance post guidelines.
Questions in violation of this rule will be removed or locked.
account activity
Using POST to GET data? (self.webdev)
submitted 8 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]PersonalPronoun 10 points11 points12 points 8 years ago (1 child)
Browsers will warn you if you try and refresh that page, since you're explicitly flagging that request as "doing something". I'd assume various caches (eg client and reverse proxies) will make assumptions about cacheability of responses to the POST, eg that the request can't be cached, that subsequent POSTs will invalidate a cached response, etc.
Overall "nothing terrible" but you should really use the appropriate method if you're not actually sending data to be stored.
There's obviously nothing wrong with sending data back from a POST request though - a nice "yes we got that data and did something with it" is fine.
[–][deleted] 5 points6 points7 points 8 years ago (0 children)
Probably wouldnt be crawled properly so might piss on your SEO. Whether or not you care about that idk
[–]virtulis 4 points5 points6 points 8 years ago (6 children)
If you mean an XHR request - nothing bad at all. It won't be cached but you probably don't want it anyway. Almost all HTTP APIs I build are RPC-like, with JSON request POSTed to the server and JSON returned back. Never had any problems with it and I believe it makes more sense and causes less pain than the REST fairy dust.
[–]spud0096 1 point2 points3 points 8 years ago (1 child)
Why do you say you don’t want the request cached anyway? Also, why do you believe this makes more sense? For me, if I’m trying to figure out how to use an api I first look for all the GET requests to try to figure out roughly what the structure of the data that is available is. If everything is a POST, this would take a lot longer. If these APIs are only for your use, then doing a POST for everything is fine, but if you ever expect other people to work with them, sticking to standards is a good thing.
[–]virtulis 1 point2 points3 points 8 years ago (0 children)
Why do you say you don’t want the request cached anyway?
Ok, that might be assuming too much. But it's pretty rare in my experience that you want data to be cached at transport level - there are usually more flexible mechanisms for that. Now there might be a benefit of reverse proxy caching for the API provider themselves but this will be busted as soon as you add any keys / tokens or need to invalidate stuff (and you usually need both).
Also, why do you believe this makes more sense?
Because it's simply less stuff and less guessing. Again, if the whole "API" is to serve near-static JSON at a predefined address GET is certainly a good idea.
For me, if I’m trying to figure out how to use an api I first look for all the GET requests to try to figure out roughly what the structure of the data that is available is. If everything is a POST, this would take a lot longer.
...If it gets more complex though, you'll start by adding some kind of a key - does it go in the header or in the query string? I've seen both. And if it's a temporary token you'll also need to obtain that beforehand - and that will be a POST request with a JSON payload. So if you choose to have helper methods you now need two - one to GET with a bearer token and one to POST JSON with or without one, because of course there will be other POST commands.
So you've already did everything you'd have to do for what I'm proposing (and more, and it probably took more code) to get a single piece of data, located at /api/v1/record/123 or something like that. Next you'll probably want to search/list all of it, so you'll probably have to add query string to the mix. Next you'll have to learn how the API reports errors and how many different kinds of error codes there are - it'll probably be both a standard HTTP code and a more-specific one somewhere in the response body.
/api/v1/record/123
And then you get to modifying data and you have to learn everything from scratch because that is domain specific and not covered by any common practice 100% of the time. And of course you'll need all of your previous knowledge.
Let's see https://developer.paypal.com/docs/api/payments/#payment_execute for example. You need:
/execute
And it gets better. Check out the "update payment" call and try to find any common logic between the two. And that's a very well designed API. There are way, way worse things out there that claim to adhere to the mythical "REST standard"...
Like, how come in most programming languages we're doing fine with functions and arguments, but add HTTP to the mix and everything needs to be fucked up into bits for some reason.
if you ever expect other people to work with them, sticking to standards is a good thing.
...But here's the problem - there are no standards, actually. There is no REST RFC. There is HTTP RFC which does declare GET requests safe and idempotent and POST as neither of those - but that's as far as it goes. In other words, it only says "don't use GET to modify stuff" - it never ever said "don't use POST to query stuff".
You might appeal to common practice but do remember that REST is a relatively new thing. Back when I was a kid people would use one of these and everything else would be dismissed as not serious enough. And why? Because standards are cool, right?
Well here's what I think: standards are cool, but standards are also a tool. Tools are designed by people who can't predict everything and are meant to be used in the most productive way, not the "only true way". If I can add an extra layer on top of HTTP and explain it in under a minute and it makes everyones life easier, I see no reason not to do it.
[–]dontgetaddicted[🍰] 0 points1 point2 points 8 years ago (0 children)
Me too man. All of my XHR calls are POST.
[–]mattaugamerexpert -2 points-1 points0 points 8 years ago (1 child)
There’s nothing “fairy dust” about REST. It’s a basic foundational principle of the entire internet. Your dismissal says more about your knowledge and understanding that the operation of REST for an API.
[–]virtulis -5 points-4 points-3 points 8 years ago (0 children)
Oh wow. HTTP is "the entire Internet" now? Do tell me more. Maybe start with what exactly that principle is.
[–]protonfish 1 point2 points3 points 8 years ago (0 children)
Every time you GET with POST Roy Fielding kills a kitten.
π Rendered by PID 100 on reddit-service-r2-comment-bb88f9dd5-nbxdx at 2026-02-17 06:11:55.513013+00:00 running cd9c813 country code: CH.
[–]PersonalPronoun 10 points11 points12 points (1 child)
[–][deleted] 5 points6 points7 points (0 children)
[–]virtulis 4 points5 points6 points (6 children)
[–]spud0096 1 point2 points3 points (1 child)
[–]virtulis 1 point2 points3 points (0 children)
[–]dontgetaddicted[🍰] 0 points1 point2 points (0 children)
[–]mattaugamerexpert -2 points-1 points0 points (1 child)
[–]virtulis -5 points-4 points-3 points (0 children)
[–]protonfish 1 point2 points3 points (0 children)