In this example, we will show how you can use a token to make API requests.
Bearer tokens covered by this topic are particularly useful for user based sessions on the web. They provide temporary access to resources. They enhance security with short lifespans and granular permissions and they reduce risk of credential exposure. They can carry user context and identity while they are easily revoked in case of suspicious activity.
We will use Postman and cURL to call the Address Verification API endpoint. The procedure is much the same for other endpoints.
Use Postman to call an API
You can try other API endpoints in the DIS APIs collection.
Refer to the API documentation for parameters, headers, and body
content. Not all requests require token authentication. Data or
functionality accessed by some of the APIs are not available in
the trial. These return the 401
Unauthorized or the 403
Forbidden status code.
Use cURL to call an API
Here is the same request in cURL.
curl --location 'base-URL/v1/address/parse' \
--header 'accept: application/json' \
--header 'Authorization: Bearer authToken' \
--header 'Content-Type: application/json' \
--data '{ "address": "1700 district ave #300 burlington, ma"}'curl --location 'https://api.cloud.precisely.com/v1/address/parse' \
--header 'accept: application/json' \
--header 'Authorization: Bearer eyJraWQiOiJNcXY2RWNBR0JNUElKbEdnRG1LYkNISC1fZkpaam4y...' \
--header 'Content-Type: application/json' \
--data '{ "address": "1700 district ave #300 burlington, ma"}'curl --location "base-URL/v1/address/parse" ^
--header "accept: application/json" ^
--header "Authorization: Bearer authToken" ^
--header "Content-Type: application/json" ^
--data "{ \"address\": \"1700 district ave #300 burlington, ma\"}"curl --location "https://api.cloud.precisely.com/v1/address/parse" ^
--header "accept: application/json" ^
--header "Authorization: Bearer eyJraWQiOiJNcXY2RWNBR0JNUElKbEdnRG1LYkNISC1fZkpaam4y..." ^
--header "Content-Type: application/json" ^
--data "{ \"address\": \"1700 district ave #300 burlington, ma\"}"