# Creating A Request · Api · Settings · Admin Portal

Obtain an API access token with client credentials, then use it to test a ticket request in Swagger or Postman.

Canonical: https://docs.mintsd.com/docs/mint-service-desk/admin-portal-creating-a-request
Language: en-GB
Revision: 2a2d39f1e31deba465d9905cd685a5a3416966a588eb6151bba19ba5bc3c7cc9

<a id="element-01a1452e-1d5e-7475-ac11-b70407426c23"></a>

<a id="element-01a1452e-1d5f-7bf0-8eee-a25d3405d4bf"></a>

## Creating the API client

To create a query you first need to prepare a client. To do this, press ![Add](https://docs.mintsd.com/api/reader/assets/assets/images/image3.png?v=50654a0321a77a3b2271140f1b6a5080d18fbef92f3639b9b83ad57f0fd5735d#element-01a1452e-1d5e-7475-ac11-b70407426c23) button.

<a id="element-01a1452e-1d5f-79a0-bf46-fe3b914c8a8f"></a>

The client authenticates machine-to-machine requests using client_id and client_secret.

<a id="element-01a1452e-1d60-719a-a1ef-03347a83317c"></a>

![Creating A Request: The client authenticates machine-to-machine requests using client_id and client_secret.](https://docs.mintsd.com/api/reader/assets/assets/images/image878.JPG?v=248800bea581f75b9f28d0e550b3103c1cb0645f8c8145475a28371800e52713)

<a id="element-01a1452e-1d61-7448-bdde-ba762f4f2052"></a>

- Client id (Remember not to use spaces between words but use e.g.‘_’)
- Client name
- Allowed scopes (We will focus on two scopes: mint.api_assets and mint_api.tickets)

<a id="element-01a1452e-1d62-76a7-8841-b958ee4f6dbd"></a>

Scopes determine which API operations the generated token can access.

<a id="element-01a1452e-1d63-7b67-b132-663e3de1fda4"></a>

<a id="element-01a1452e-1d63-700c-9837-35b30142b9a0"></a>

After adding the scopes and pressing ![Create](https://docs.mintsd.com/api/reader/assets/assets/images/image58.png?v=3659f4ed6ae2729e35fe5eb8832cf827f8c264181610e981304daec839c30f99#element-01a1452e-1d63-7b67-b132-663e3de1fda4) button, a Client secret is generated which needs to be copied and saved.
Remember that when the secret is generated again, the secret will no longer be valid.

<a id="element-01a1452e-1d63-7258-ac47-802fd493a032"></a>

![After adding the scopes and pressing button, a Client secret is generated which needs to be copied and saved. Remember that when the secret is generated again, the secret will no longer be valid.](https://docs.mintsd.com/api/reader/assets/assets/images/image879.jpg?v=21c11cae42b28e20abf34500b763566428ab8d98748ae0471d3c680d70c53948)

<a id="element-01a1452e-1d64-7b26-83bd-19bffdd508cb"></a>

## Obtaining a token

To obtain a token in Postman, create a request using POST. Enter your Mint address followed by ‘/connect/token’, for example <https://rcmintsd.opgksoftware.com/connect/token>.

<a id="element-01a1452e-1d65-77d2-a6d8-4624d3296ace"></a>

Now you need to configure four fields:

<a id="element-01a1452e-1d66-736e-907c-507e83f7bb47"></a>

- **grant_type**: enter client_credentials.
- **client_id**: enter the client_id used in the API configuration.
- **client_secret**: enter the secret generated for the API client.
- **scope**: enter the scopes assigned to the API client.

<a id="element-01a1452e-1d67-707c-a247-75164287f2fc"></a>

**Remember to do this in ‘x-www-form-urlencoded’.**

<a id="element-01a1452e-1d67-7c39-af06-94c5a288d0a0"></a>

![Creating A Request: Remember to do this in ‘x-www-form-urlencoded’.](https://docs.mintsd.com/api/reader/assets/assets/images/image880.jpg?v=f4a2bf50feb518e0f2fcbd617795fa1a5e6ff320660b9a189278a340b1dea5f6)

<a id="element-01a1452e-1d68-722f-962f-5d944aec9a57"></a>

Now press the ‘Send’ button to receive the token.

<a id="element-01a1452e-1d68-72a7-86a9-66db2167281c"></a>

![Creating A Request: Now press the ‘Send’ button to receive the token.](https://docs.mintsd.com/api/reader/assets/assets/images/image881.jpg?v=3e8e81f49bf651a221302dcd4e80f205d82b4c0aa11061b5ebeb9b48ee29f5e5)

<a id="element-01a1452e-1d69-7aed-8622-a9a1823c30ea"></a>

## Testing a request

Copy the token received and you can test it on your_address_to_mint/swagger/index.html

<a id="element-01a1452e-1d69-725b-a64c-14197c07adb8"></a>

<a id="element-01a1452e-1d69-70a3-b3c8-65db53dbd402"></a>

To start testing first press ![Authorize](https://docs.mintsd.com/api/reader/assets/assets/images/image882.jpg?v=bff5dcdea2415bb14f5f998cb7d8476506a66da26f7054fcbcc25ccf84072b72#element-01a1452e-1d69-725b-a64c-14197c07adb8) button. In the field that appears, type ‘Bearer your_token’

<a id="element-01a1452e-1d6a-747b-9db0-0784b7cbd77c"></a>

![Creating A Request: To start testing first press button. In the field that appears, type ‘Bearer your_token’.](https://docs.mintsd.com/api/reader/assets/assets/images/image883.jpg?v=270cca459a8990d0cc1b2f2823d1a0e685c045d2eaef3fe7616b131b8e746735)

<a id="element-01a1452e-1d6a-7321-9284-4a5ab62d2f58"></a>

<a id="element-01a1452e-1d6b-706f-a8dc-bb49aeaa45d3"></a>

Then press ![Authorize](https://docs.mintsd.com/api/reader/assets/assets/images/image882.jpg?v=bff5dcdea2415bb14f5f998cb7d8476506a66da26f7054fcbcc25ccf84072b72#element-01a1452e-1d6a-7321-9284-4a5ab62d2f58) button again.

<a id="element-01a1452e-1d6b-7d94-b803-06691100cb9e"></a>

![Creating A Request: Then press button again.](https://docs.mintsd.com/api/reader/assets/assets/images/image884.JPG?v=85beef5c7ec30174e49d342bdf7e44b70fe2a0aafc156d65af2143fd34e4071a)

<a id="element-01a1452e-1d6c-7a34-baac-40150eac4c4b"></a>

<a id="element-01a1452e-1d6d-7ca3-afef-09c9c26c4e45"></a>

Now you can test if the token works. Go below to the ‘Tickets’ section and select ‘/api/Tickets/{ticketId}’.
You will see the example that will be returned after testing. Press ![Try it out](https://docs.mintsd.com/api/reader/assets/assets/images/image885.jpg?v=d3f5d09a06a0e944416e595c658c737d3d651323896da9c14dbcad539c6ec2d6#element-01a1452e-1d6c-7a34-baac-40150eac4c4b) button. Fill in the ‘ticketid’
field by typing the id of the ticket you want to preview. Then press [Execute](https://docs.mintsd.com/docs/mint-service-desk/admin-portal-creating-a-request#element-01a1452e-1d6c-7c80-ae93-eb9e8238d95f) button.

<a id="element-01a1452e-1d6c-7c80-ae93-eb9e8238d95f"></a>

![Now you can test if the token works. Go below to the ‘Tickets’ section and select ‘/api/Tickets/{ticketId}’.](https://docs.mintsd.com/api/reader/assets/assets/images/image886.jpg?v=c27e88c91b82e477755e2862cdf438ef1a91da33e23714d38277f683a0a2b224)

<a id="element-01a1452e-1d6e-72e0-b5e6-822b9482ba13"></a>

You don’t have to test it on swagger. You can do the same in Postman by selecting the GET method and typing
‘page_address/api/Tickets/{ticketId}’ Example: <https://rcmintsd.opgksoftware.com/api/Tickets>/{ticketId}.

