Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>1. I always thought that using GET is not a good idea and that it's better to use POST.</p> </blockquote> <p>Use GET for reading information, POST for writing information. GET requests shouldn't modify server-side state, while POST requests can safely do so. In general use GET for reads and POST for writes. Your API should probably use a mixture of both, depending on which each specific API call does.</p> <blockquote> <p>2. The API I'm coding requires a key, and I don't think it's a good idea to send it in the URL. So is it possible to mix both POST parameters and URL parameters?</p> </blockquote> <p>Sending data via POST doesn't add any level of security at all. GET requests are no less insecure than POST requests; they are identical. For transferring private data, use SSL.</p> <blockquote> <p>3. Another problem is that I hear URLs have a max length, so I guess that would make GET out of the way, or is there a workaround</p> </blockquote> <p>There is no maximum URL length defined by the HTTP standard, though <a href="http://www.boutell.com/newfaq/misc/urllength.html">some browsers</a> impose one. This probably doesn't matter when generating GET requests via JavaScript, but if you're seriously concerned about it you probably should rethink your API. GET requests shouldn't be sending that much data to the server.</p> <blockquote> <p>4. The only problem I'm seeing with POST (and which I'm guessing is why a site like twitter went with GET) is that the request can't be made directly from the browser. Correct me if I'm wrong on this.</p> </blockquote> <p>Your browser can generate POST requests just as easily as GET requests, it's simply harder to submit POST requests via the address bar.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload