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 theUserToken
which you will get from the below integration.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
index.html
<script src="https://cdn.uat.industryapps.net/cdn/js/v1/platform-api.js" type="text/javascript"></script>
// 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
Name | Type | Description |
---|---|---|
auth_token | string | Token to be used in the header of every service call (UserToken) |
euser | string | User code of logged in user |
language_selected | string | Language code of selected language, default is 'en' |
plant_selected | string | Id of selected plant |
plant_list | object array | plant list |
company_code | string | Current company code |
roles | string array | User roles |
{
"auth_token": "eb837c91-bee4-4011-8af5-1f7af649be92",
"euser": "[email protected]",
"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"
]
}
Last modified 9mo ago