GettingStarted
This document describes the basic methods in NordomaticApi and how to use them.
Dokumentation på svenska Getting Started
The base url is customer specific and you will receive it together with your login credentials. The above base url is for our demo site and is therefore used in this document.
Documentation is available at {base url}/core/help and {base url}/trend/help.
Swagger is available at {base url}/core/swagger and {base url}/trend/swagger.
Appendices
- GettingStarted-Appendix1
Complete list of tag names for testing with descriptions - GettingStarted-Appendix2
Examples of using standard methods.
API: Two main areas
-
Core
- Documentation:
{base url}/core/help - Example endpoints:
{base url}/core/api/login,{base url}/core/api/getonlinealarmsbytoken - Features (examples):
- Alarms
- GetOnlineAlarmsByToken
- AcknowledgeAlarmsByToken
- GetAlarmstypes
- Security
- Login
- LoginWithMenu
- Logout
- Signals
- RegisterSignalsByToken
- UnregisterSignalsByToken
- WriteSecuredSignalValuesByToken
- WriteValueWithLogin
- ReadSignalValueByToken
- GetSignalDefinitions
- GetUpdatesByToken
- Tags
- Taglist
- Alarms
- Documentation:
-
Trend
- Documentation:
{base url}/trend/help - Example endpoints:
{base url}/core/api/logvalues,{base url}/core/api/logtags - Features:
- GetLogTagsWithToken
- LogValues
- Documentation:
Walkthrough
To use the API, always include the following headers:
x-securityToken: Value from loginx-clientID: Same guid as used in loginx-sessionID: Value from login
Steps to retrieve values
The methods and properties needed are described in the API documentation mentioned above.
- Login
Login credentials from Styrportalen.se cannot be used here, a separate login is required- Generate a clientID, the id should be a UUID (or GUID)
The id should match the following regexp:
/^[0-9A-F]{8}[-]?(?:[0-9A-F]{4}[-]?){3}[0-9A-F]{12}$/i - Use the
/Loginmethod
LoginreturnssessionIDandsecurityToken, save these for this session.
- Generate a clientID, the id should be a UUID (or GUID)
- RegisterSignalsByToken
- Register signals before values can be retrieved
If the signal(s) were registered correctly, value0is returned, all other values are error codes.
- Register signals before values can be retrieved
- GetUpdatesByToken
- Call continuously (max every 2 seconds) to retrieve updated values for the registered signals
- UnRegisterSignalsByToken
- Unregister signals
- WriteSecuredSignalValuesByToken
- Write values to signals, accepts an array of signals with values.
- Keepalive
- Send keepalive every minute to keep the session active
Flow
The following flowchart describes the login and keepalive process
- Keep Alive: Send keepalive every 60 seconds to prevent session timeout.
Payload to send keepalive:
clientId is the generated id used in login
const params = {
securityToken,
values: [{
Name: 'WFSInternal_UID2_WD',
Value: `${clientId}\\DefaultProject`
}]
};
One-shot signalwrite
WriteValueWithLogindoes not require login or signal registration.
Use this for single writes as it is subject to stricter rate limits than WriteSecuredSignalValuesByToken
Test signals
- Use demo/demo2010 for testing against the baseurl.
- See GettingStarted-Appendix1 for signals to test with.