> For the complete documentation index, see [llms.txt](https://docs.industryapps.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform.md).

# Accessing data exposed by the platform

You can access the data exposed by the platform through the IndustryApps **AAS Gateway**, which has REST endpoints provided by the IndustryApps Platform.  You will get an `AppID` and `AppSecretCode` when you register your application to IndustryApps in the Solution Provider portal. These credentials can be used to create an `AccessToken` . This AccessToken needs to be sent with every request of API. Along with this, you need to provide the`UserToken`which you will get from the below integration.

#### &#x20;Platform javascript API <a href="#id-2-1-platform-javascript-api" id="id-2-1-platform-javascript-api"></a>

import `platform-api.js` into main file (index.html) and invoke `getPlatformContext()` method. It will return an object with params:

* auth\_token
* euser
* plant\_selected
* language\_selected
* plant\_list
* company\_code
* roles

{% code title="index.html" %}

```html
<script src="https://cdn.uat.industryapps.net/cdn/js/v1/platform-api.js" type="text/javascript"></script>
```

{% endcode %}

```
// Example in Vue js
export default {
    head: {
        script: [
            { hid: 'getPlatformContext', 
            src: 'https://cdn.uat.industryapps.net/cdn/js/v1/platform-api.js', 
            defer: true }
        ]
    }
}

```

**API documentation**

**Methods**

`getPlatformContext() → {Object}` This function returns an object with params auth\_token, euser, plant\_selected, language\_selected, plant\_list, company\_code, roles.

Returns: `platformContext` Type:

```
-Object
```

```
// Call getPlatformContext() after adding the CDN script.
const userData = getPlatformContext();
// e.g. auth_token callable at: userData.auth_token
```

**Type Definitions**

<table><thead><tr><th width="203.9090909090909">Name</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>auth_token</td><td>string</td><td>Token to be used in the header of every service call (UserToken)</td></tr><tr><td>euser</td><td>string</td><td>User code of logged in user</td></tr><tr><td>language_selected</td><td>string</td><td>Language code of selected language, default is 'en'</td></tr><tr><td>plant_selected</td><td>string</td><td>Id of selected plant</td></tr><tr><td>plant_list</td><td>object array</td><td>plant list</td></tr><tr><td>company_code</td><td>string</td><td>Current company code</td></tr><tr><td>roles</td><td>string array</td><td>User roles</td></tr></tbody></table>

#### Sample Response

```json
{
    "auth_token": "eb837c91-bee4-4011-8af5-1f7af649be92",
    "euser": "heera@xeiex.com",
    "plant_selected": "1",
    "language_selected": "en",
    "plant_list": [
        {
            "plantId": 2,
            "plantName": "Kilsyth",
            "plantCode": "5698",
            "defaultPlant": false
        },
        {
            "plantId": 1,
            "plantName": "Brisbane 01",
            "plantCode": "0987",
            "defaultPlant": true
        }
    ],
    "company_code": "1234",
    "roles": [
        "GRP_M_ADD",
        "TOOL_CRD_VIEW",
        "SOP_A_VIEW",
        "TSOP_M_ADD",
        "QSOP_IU_DEL",
        "OPR_ACT_ADD",
        "VENDOR_M_EDIT",
        "PROC_TYP_M_DEL",
        "QSOP_V_VIEW",
        "COM_M_EDIT",
        "DTC_EDIT",
        "8e08d9_Add_VIEW",
        "MACH_M_EDIT",
        "SOP_M_ADD",
        "QC_VIEW"
    ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.industryapps.net/authentication/accessing-data-exposed-by-the-platform.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
