what does POST stand for in an API header url? - api

I'm trying to access an API with the pattern POST /api/quotes/params?. . . and GET /api/quotes/3 but I don't know what the POST/GET are for. Am I supposed to replace them with something? I understand normal HTTP GET/POST requests but don't see the relevance in this caseā€¦ please help shed some light.

They are just normal HTTP methods. Generally, GET requests only fetch data, they don't modify anything on the server. POST requests are used to modify data by submiting a post body.
When should I use GET or POST method? What's the difference between them?
They just indicate how you should make your request and/or which methods are available for each endpoint.

Related

How can I filter requests to Google Cloud Storage depending on their HTTP headers?

My use case is that I have pretty large files (>2GB, these are Cloud Optimized Geotiffs) on Google Cloud Storage, which can be used in applications through HTTP range requests.
I would like to filter out requests that are missing the Range header.
This would avoid the case of users downloading the whole file. (I guess someone could still make a range request for the whole file with a bit of work, but i am not concerned about this.)
The documentation (https://firebase.google.com/docs/storage/security/rules-conditions#request_evaluation) says "HTTP headers and authentication state are also included", so I would expect to be able to use this information in the security rules.
Is it possible at all and if it is, how?
I cannot find any example of using HTTP headers in the security rules conditions. I have also tried the rules playground in Firebase, but didn't figure out how to access the request headers.
It doesn't seem like there's any way to access HTTP headers. The only request variables are those in the document
You can try the request.params variable which will be populated with query params present in the request
eg. <firebase storage url>?myParam=true -> request.params.myParam == "true" should work
No, it is not possible to filter requests depending on HTTP headers.
The request variable in the security rules does not include HTTP headers. (As stated by a firebaser in the comments of Roopa M's answer.) The documentation has been updated since this question was asked, and does not state any longer that this information is included.
Roopa M's answer gives an idea to filter requests based on query parameters, which might help you, but is independent from HTTP headers.
In order to really handle queries according to HTTP headers in the context of firebase, it is probably necessary to rely on a cloud function that will act as middleware. These have access to the full HTTP request if i am not mistaken.
Alternatively, this kind of rule should be reasonably easy to implement in a regular web server like Nginx, if you have the option to build your project in such an environment.

Main difference between GET and POST api calls?

I am getting confused with the difference with GET and POST.
Can you provide some good resource or explanation with examples.
I'm just getting started with this.
Thank you.
GET is for retrieving data from the URL - for example, example.com?tab=settings
'tab' is what you would use to 'GET' the data from
POST is more secure, and allows you to send or retrieve the data directly
Other points mentioned here are:
GET requests can be cached
GET requests remain in the browser history
GET requests can be bookmarked
GET requests should never be used when dealing with sensitive data
GET requests have length restrictions
GET requests are only used to request data (not modify)
POST requests are never cached
POST requests do not remain in the browser history
POST requests cannot be bookmarked
POST requests have no restrictions on data length

How to send post request using Spookyjs with body parameter?

I want to send a post request with JSON body to a particular server using Spookyjs. How I do that please help into this?
If you are using spooky, then you are using nodeJS. Gather your informations (which I'm guessing you want to do) with spooky / casper, pass them back to nodeJS, parse your data and post it.

Understanding the Reddit API - URL vs headers vs body

Here's the API.
This is my first time working with web APIs so bear with me. Where do the name-value pairs listed under each call belong in my HTTP request? Do they go in the URL, the headers, or the body? Is it different depending on if it's a GET request or a POST?
Are the answers to these questions true in general, i.e. for any web API?
Where do the name-value pairs listed under each call belong in my HTTP request?
In a GET, they're in the URL's query string. in a POST, they're in the request body. Headers never contain request parameters, but things like Content-length do control them, a bit. You might also run across JSON in a POST body (I can't remember if reddit does this). This is not reddit-specific, and is standard HTTP.

How to format an HTTP PUT request?

I am using the Yahoo Placemaker API and would like to send a request but I am getting confused as to how to send the request. The request is composed of a URL and a document and inside the document, there are a bunch of parameters. Please see below.
http://wherein.yahooapis.com/v1/document
documentContent=Sunnyvale+CA
documentType=text/plain
appid=my_appid
How do I format the URL into a request is it like so?
http://wherein.yahooapis.com/v1/documentContent=Sunnyvale+CA?documentType=text/plain?appid=my_appid
I would like to use this the Placemaker service for a Mac app written in objective-c.
Any suggestions would be great. Thanks.
You don't. The URI and the request body are different things.
It would be helpful if you explained why you're asking. What platform/API/language are you using?