RESTful API with HTTP Requests
Building RESTful web services require the HTTP protocol. When making a request to a particular API, one needs to get the API URL, which is the resorce path, the KEY and output type. Most API output tthe data in form json files. Therefore, the need to learn how to read the json files so as to output a readable data by the end user.
The HTTP requests use verbs in API applications. The primary most commonly used verbs are GET, POST,PUT, PATCH, DELETE. The GET request reads the data, POST write/ create new resources, PUT updates data if it has been altered, and DELETE deletes.
By default, requests are HTTP GET requests. However most methods requires POST data operations. Basically, the standards used to read requests is GET and write requests is POST.
The API_KEY is used with the pblick key value in order to get the required data. In http requests, you need to specify the API url provided by the respective providers. In Addition an API get request can allows you to call multiple parameters within the URL. This can be done in two ways:
param=foo¶m=bar (preferred)
param[]=foo¶m[]=bar
In querying different fields, some parameters allows you to look up by specifying the prefix you want. That is, the parameter allows you to lookup a user either by username or the user ID specified.An example is to suffix the key with :username , user:username=bacon, user=14