The ArchFX Cloud has an extensive Restful API that give the user access to every database record. The ArchFX WebApp is 100% driven by this API and therefore, any information that the user sees on the Web App, can be extracted via an API call. But the fact is that the Web App only accesses a small (but important) set of API calls.
This document will focus on how to easily access stream data, which is the raw data that comes directly from Arch PODs or any ArchFX Broker Connector. This document will also show how to access the higher level Global KPI aggregations.
With this document, a user can either get raw data and compute its own KPIs, and send to a different system, or it can access the computed Global KPIs (e.g. OEE, LU, etc.). This document is not intended to give a complete view of everything that is possible via the API, but simply to give a basic set of examples for how to get factory machine data.
Note that for this document, every time we refer to https://arch.archfx.io
you should replace arch
with whatever your specific ArchFX Cloud company domain is, usually something like https://your-company.archfx.io
The ArchFX Cloud API uses JWT tokens to authenticate, so the first thing to learn is how to authenticate. The following API call can be use to authenticate:
POST: <https://arch.archfx.io/api/v1/**auth/api-jwt-auth/**>
PAYLOAD: application/json
{
"username": "email",
"password": "string"
}
This API call will respond with a token, which you will need to use for all subsequent API calls described in this document. You will add the following to your API header
:
'Authorization': 'JWT ' + _token_you_just_got
'Content-Type': 'application/json'
$ curl <https://arch.archfx.io/api/v1/auth/api-jwt-auth/> -d [email protected] -d password=secret
{"token":"very.big.token"}
$ curl -X GET <https://arch.archfx.io/api/v1/org/> -H 'Authorization: JWT very.big.token'
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"email": "[email protected]",
"username": "joe",
"name": "I am a user",
"avatar": {
"tiny": "<https://secure.gravatar.com/avatar/>...",
"thumbnail": "<https://secure.gravatar.com/avatar/>...",
"medium": "<https://secure.gravatar.com/avatar/>..."
},
"slug": "joe",
"is_staff": false
}
]
}
This is useful using a web browser navigating to https://arch.archfx.io/api/v1/auth/token/ after logging into the Arch website.
$ curl <https://arch.archfx.io/api/v1/auth/token/> -H 'Authorization: JWT very.big.token'
{
"token": "smaller token",
"jwt": "very.big.token"
}
For debugging and learning what each API can do, ArchFX Cloud has a browsable API which allows you to copy and paste any GET API call on the browser to see results (assuming you are logged on into your account), or to browse the API. Just go to https://arch.archfx.io/api/docs/ (note that not all APIs are displayed) to see