# Transactional data

### Generation Access Token

Access token can be generated using a REST API.

## Token Generation

<mark style="color:green;">`POST`</mark> `https://auth.uat.industryapps.net/auth/realms/IndustryApps/protocol/openid-connect/token`

Access Token generated in the response will be set in all AAS master data request header.

#### Headers

| Name                                           | Type                              | Description         |
| ---------------------------------------------- | --------------------------------- | ------------------- |
| content-type<mark style="color:red;">\*</mark> | application/x-www-form-urlencoded | Submit data as form |

#### Request Body

| Name                                             | Type                | Description                                   |
| ------------------------------------------------ | ------------------- | --------------------------------------------- |
| grant\_type<mark style="color:red;">\*</mark>    | client\_credentials |                                               |
| client\_id<mark style="color:red;">\*</mark>     | String              | Will be available in the App Information page |
| client\_secret<mark style="color:red;">\*</mark> | String              | Will be available in the App Information page |

{% tabs %}
{% tab title="200: OK Authorization Success" %}

```javascript
{
    "access_token":"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJrcmJUeXU4b1lVUjZPcHlrd0pIMDNfN1IxS194MHU1ZnUwQ3hlSGliTThrIn0.eyJleHAiOjE2MjE4NTE5NTQsImlhdCI6MTYyMTg1MTY1NCwianRpIjoiMzZjMDE2NTYtODhkNC00NDIxLThiYmQtMDhjMDE1MGMwYjFkIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLmRldi5pbmR1c3RyeWFwcHMubmV0L2F1dGgvcmVhbG1zL0FwcFN0b3JlIiwiYXVkIjoiYWNjb3VudCIsInN1YiI6IjlmM2UzMmM2LWYyMjMtNDNjMy04YjkwLTA2NDc3Nzg4ZTcyNyIsInR5cCI6IkJlYXJlciIsImF6cCI6InNlbnNvci5tb2ludG9yIiwiYWNyIjoiMSIsInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJvZmZsaW5lX2FjY2VzcyIsInVtYV9hdXRob3JpemF0aW9uIl19LCJyZXNvdXJjZV9hY2Nlc3MiOnsic2Vuc29yLm1vaW50b3IiOnsicm9sZXMiOlsidW1hX3Byb3RlY3Rpb24iXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImNsaWVudEhvc3QiOiIxNzIuMjUuMC4xIiwiY2xpZW50SWQiOiJzZW5zb3IubW9pbnRvciIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwicHJlZmVycmVkX3VzZXJuYW1lIjoic2VydmljZS1hY2NvdW50LXNlbnNvci5tb2ludG9yIiwiY2xpZW50QWRkcmVzcyI6IjE3Mi4yNS4wLjEifQ.pKSqIFb9VcmbQQe-tBbKELuV-EWSeRSa6BhlVQs3iwKS6vExtoBkauFV1stNLt1SE_KMNpY4UcOqua_p0hnm51jwy-U55NMlSyxIysarA1Kkylc8UScYfk6R4vBXLcaaJBA8qvGvBSf_ZjR1pCQqGwPL-EXOqojP49PCtsfDaMkDZ70037Yj7s7aISRFSm6jNOem679_Qi52WupSyIyqUv8u4S-licXOPO6Na-4X_NwKhByE9ET_Zw9zZFxFremcahafLyMQcU36dD8UrNx7DRIF06vQsMkAhbQ4FhT16uXjbAY_-usUfif882lUy9HmJDRRl-sZU_Obnj4v0-4nGA",
    "expires_in":300,
    "refresh_expires_in":0,
    "token_type":"Bearer",
    "not-before-policy":0,
    "scope":"profile email"
}
```

{% endtab %}

{% tab title="401: Unauthorized Authorization Failed" %}

```javascript
{
"error": "unauthorized_client",
"error_description": "message"
}
```

{% endtab %}
{% endtabs %}

### Transactional APIs

**Purchase Order List**

## Purchase Order List

<mark style="color:green;">`POST`</mark> `https://connect.dev.industryapps.net/platform-api/v1/inbound/purchase-order-list`&#x20;

Returns all purchase orders

#### Headers

| Name                                            | Type               | Description                                                                                                                                            |
| ----------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | Bearer auth\_token | Provide the [generated token](https://docs.industryapps.net/apis-or-data-integration)                                                                  |
| UserToken<mark style="color:red;">\*</mark>     | Bearer user\_token | Provide the token received from the [user data javascript method](https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform) |

#### Request Body

| Name                                        | Type                                    | Description                                                                                    |
| ------------------------------------------- | --------------------------------------- | ---------------------------------------------------------------------------------------------- |
| plantList<mark style="color:red;">\*</mark> | \[1]                                    | List of plant IDs                                                                              |
| metadata<mark style="color:red;">\*</mark>  | { "pagePosition" : 1, "pageSize" : 15 } | Page number and position for paged response                                                    |
| toDate                                      | String                                  | filter by to date (timestamp)                                                                  |
| fromDate                                    | String                                  | filter by from date (timestamp)                                                                |
| frequency                                   | String                                  | <p>Allowed values are</p><p>D - Daily</p><p>W - Weekily</p><p>M - Monthly</p><p>Y - Yearly</p> |

**Purchase Order Details**

## Purchase Order Details

<mark style="color:green;">`POST`</mark> `https://connect.dev.industryapps.net/platform-api/v1/inbound/purchase-order-details`

#### Headers

| Name                                            | Type               | Description                                                                                                                                            |
| ----------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | Bearer auth\_token | Provide the [generated token](https://docs.industryapps.net/apis-or-data-integration)                                                                  |
| UserToken<mark style="color:red;">\*</mark>     | Bearer user\_token | Provide the token received from the [user data javascript method](https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform) |

#### Request Body

| Name                                      | Type   | Description       |
| ----------------------------------------- | ------ | ----------------- |
| orderId<mark style="color:red;">\*</mark> | String | Order Id          |
| today                                     | String | timestamp now     |
| plantList                                 | \[1]   | List of plant IDs |

**Production Order List**

## Production Order List

<mark style="color:green;">`POST`</mark> `https://connect.dev.industryapps.net /platform-api/v1/manufacturing/production-order-list`

List of Production Orders

#### Headers

| Name                                            | Type               | Description                                                                                                                                            |
| ----------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | Bearer auth\_token | Provide the [generated token](https://docs.industryapps.net/apis-or-data-integration)                                                                  |
| UserToken<mark style="color:red;">\*</mark>     | Bearer user\_token | Provide the token received from the [user data javascript method](https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform) |

#### Request Body

| Name                                            | Type                                    | Description                                                                                              |
| ----------------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| fromDate                                        | String                                  | filter by from date (timestamp)                                                                          |
| toDate                                          | String                                  | filter by to date (timestamp)                                                                            |
| rangeType                                       | 5D                                      |                                                                                                          |
| type                                            | A                                       |                                                                                                          |
| workOrderNo                                     | String                                  | WorkOrder number                                                                                         |
| lineId                                          | String                                  |                                                                                                          |
| status                                          | String                                  | <p>Allowed Status are</p><p>P - Pending</p><p>S - Scheduled</p><p>I - In Progress</p><p>C - Complete</p> |
| productCode                                     | String                                  | Product Code                                                                                             |
| toolId                                          | String                                  | Tool Id                                                                                                  |
| machineId                                       | String                                  | Machine Id                                                                                               |
| metadata<mark style="color:red;">\*</mark>      | { "pageSize" : 10, "pagePosition" : 1 } | Page number and position for paged response                                                              |
| processTypeId<mark style="color:red;">\*</mark> | 1                                       | <p>Process Type Id</p><p>1 - Diecasting</p><p>2 - Shotblasting</p><p>3 - Trimming</p>                    |
| plantList<mark style="color:red;">\*</mark>     | \[1]                                    | List of plant IDs                                                                                        |

**Production Order Details**

## Production Order Details

<mark style="color:green;">`POST`</mark> `https://connect.dev.industryapps.net /platform-api/v1/manufacturing/production-orderdetails`

#### Headers

| Name                                            | Type               | Description                                                                                                                                            |
| ----------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Authorization<mark style="color:red;">\*</mark> | Bearer auth\_token | Provide the [generated token](https://docs.industryapps.net/apis-or-data-integration)                                                                  |
| UserToken<mark style="color:red;">\*</mark>     | Bearer user\_token | Provide the token received from the [user data javascript method](https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform) |

#### Request Body

| Name                                               | Type                         | Description       |
| -------------------------------------------------- | ---------------------------- | ----------------- |
| requestParameter<mark style="color:red;">\*</mark> | { "SubWorkOrderID" : 13616 } | WorkOrder Id      |
| plantList<mark style="color:red;">\*</mark>        | \[1]                         | List of plant IDs |
