• Register

External API Client

You can use an external API client to call Mashery APIs. In this example the external client used is [Postman](https://www.postman.com/). ## Retrieve access token The first step is to call the token endpoint to be authorized. In order to know the correct URL exposing the token API you can follow the guide reported [here](https://developer.mycampari.com/docs/read/getting_started/How_to_build_Token_API_URL). You can call therefore the token endpoint providing the proper _Key_ and _Secret_ received during the application registration step (you can find them in your [_My API Keys_](https://developer.mycampari.com/apps/mykeys) section). The received _Key_ is equivalent to the _client_id_, while the _Secret_ is the _client_secret_. This parameters can be sent setting the _POST_ method and selection the "x-www-form-urlencoded" encoding algorithm in the "Body" tab (this is equivalent to set the HTTP header "Content-Type" equal to "application/x-www-form-urlencoded"). At this point you can insert the required parameters reported in table below:
POST Parameter Value
grant_type Fixed to: "client_credentials"
client_id Your client application key
client_secret Your client secret
**Example using cURL** The following is an example of the same call but using the cURL. ``` curl -X POST https://test-api.mycampari.com/connection-tester/token -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=client_credentials&client_id=tz********x35&client_secret=k*********gr' ``` **Response** The typical valid response looks like this: ``` { "access_token": "f7bztyj38mgx46pwf9yvgy4j", "token_type": "bearer", "expires_in": 3600 } ``` Note: If any, the expiration time is reported in seconds. 3600 seconds are equivalent to 1 hour. If this field is missing it means the access token does not expire. ## Call Resources Using the access token retrieved with from the first step, you are able to test any endpoints contained in the plan you submitted for. You can find all the available endpoints as well as their usage under the section dedicated to the Plan. For example the [Welcome To Campari](https://developer.mycampari.com/docs/read/connection_tester/Welcome_To_Campari) API contained in the _Connection Tester_ plan is exposed to the following endpoint:
In order to call this API, the GET method must be set and the access token must be sent with the request. In order to do this, click on _Authorization_ tab, select as _Type_ "Oauth 2.0" and insert the access token as shown below:
At this point everything is set and you can click on _Send_. You'll receive the response from the endpoint and the corresponding HTTP status code. A code equal to 200 means the request was processed successfully.
For POST/PUT operations that require a Body as input, an example of the body is reported in the section dedicated to the Plan. You can copy/paste it in the _Body_ tab and, if needed, you can modify the data before send the request.

Docs Navigation