Aand access token serve the same purpose they are unique identifiers used to authenticate calls to an API. Made up of a string of letters and numbers that identify the client application making the request an API key or access token is used to grant or deny requests based on the clients access permissions and track the number of requests made for usage and billing purposes. To make an API call to Googles Cloud Natural Language API you must include an API key as a Digital Marketing Service query parameter. For example lets say you want to find named entities ie. nouns in a body of text. Then youd make the following API request replacing APIKEY with your actual API key POST httpslanguage.googleapis.comv1documentsanalyzeEntitieskeyAPIKEY 5
. Wait for a response. Now all thats left to do is wait for a response from the API. You can expect a status code that lets you know the request was either processed successfully or Digital Marketing Service unsuccessfully. In the latter case the status code will explain the issue so you can correct it and try again. The most common codes are 2XX codes success codes and 4XX codes error codes. Lets take a brief look at some of the most common 2XX Codes These codes convey that the server has received the clients request and processed it successfully.
Here are the most common examples 200 OK The request was successful. 201 Created The resource has been created on the server. This response is typically returned for POST requests. 202 Accepted The request has been received but is still being processed. 204 No Content The request has been successfully processed but no content will be returned. 4XX Codes These codes convey that the clients request has an error. Its possible that the request is written incorrectly or the resource which the client is requesting doesnt exist. 400 Bad Request There is something wrong in the clients request. 401 Unauthorized The client is not authorized to make this request. 403 Forbidden. .