All request endpoint urls start with api/
. Data is sent and received as JSON objects. All request data is sent in the request body if not specified otherwise. You should return 200
for success responses and any code that starts with 4
for error responses.
POST : api/login
Request Data:
{
username : string,
password : string
}
Response Data: No data needed. Just send session id in cookie with sessionID
key.
POST : api/logout
Request Data: none
Response Data: none
GET : api/home/page
Request Data: none
Response Data:
{
junction : string, // Name of centris/junction
kkc : string|null // Name of the kkc device. Null if not connected
time : number, // Unix timestamp in milliseconds
connected : boolean, // Is centris connected to network?
version : string, // Centris version
// These are for LCD screen
phaseId : number,
extraDuration : number,
phaseDuration : number,
algorithm : string,
isSimActive : 1|0,
signalPlanUpdatedAt : number // Unix timestamp in milliseconds. Last time at which signal plan is updated
}
GET : api/settings/general
Request Data: none
Response Data:
{
time : number, // Unix timestamp in milliseconds
ntpIP : string, // IP of the ntp server
junctionId : string|null,
username : string // Device login user name
}
PUT : api/settings/general
Request Data:
{
time : number, // Unix timestamp in milliseconds
ntpIP : string // IP of the ntp server
}
Response Data: none
PUT : api/settings/junction-id
Request Data:
{
value : string // Junction id as string
}
Response Data: none
PUT : api/settings/credentials
Request Data:
{
username : string,
password : string
}
Response Data: none
GET : api/settings/network
Request Data: none
Response Data:
{
ip : string,
netmask : string,
gateway : string,
apn : string, // APN for sim card
simUser : string, // Sim card user name
isSimActive : boolean,
simHasPin : boolean, // Shows if sim card needs a pin number to connect
simIP : string // IP address used by sim card
}
PUT : api/settings/network
Request Data:
{
ip : string,
netmask : string,
gateway : string
}
Response Data: none
PUT : api/settings/sim-card
Request Data:
{
apn : string,
simUser : string,
simPassword : string
}
Response Data: none
PUT : api/settings/sim-card/active
Request Data:
{
value : boolean // Activate if true, deactivate if false.
}
Response Data: none
POST : api/settings/sim-card/remove-pin
Request Data:
{
pin : string
}
Response Data: none
GET : api/configurations
Request Data: none
Response Data:
{
httpClient : {
ip : string,
port : string,
authHeader : string // This should contain only the auth key, no 'Bearer ' part.
}
}
This end point sets only three important properties on httpclient.conf file.
PUT : api/configurations/http-client
Request Data:
{
ip : string,
port : string,
authHeader : string
}
This end point can set content of any configuration file. You can get which file to update from url.
PUT : api/configurations/file/:fileName
fileName
is httpClient
for http client configuration file. Others will be implemented later.
Request Data:
{
// Same as the one sent in get request
}
GET : api/configurations/phase-map
Request Data: none
Response Data: A map of phase numbers to groups
{ [phaseNo : number] : string }
Example:
{
"1" : "1-2-3",
"2" : "4-5-6",
"3" : "7"
}
PUT : api/configurations/phase-map
Request Data: Same as the data received above
GET : api/management/page
Request Data: none
Response Data:
{
currentAlgorithm : string, // Name of the current algorithm
algorithmList : sting[], // List of all algorithm names
services : [{ // List of service details
name : string, // Name of the service
autoStart : boolean, // Does this service automatically start on device boot?
isRunning : boolean,
canBeEnabled : boolean // Can user enable/run this service from centris ui?
}],
numberOfPhases : number // How many phases are there in this centris? (Do we need this? Would it be enough for me to show the users from 1 to 6. They already know which phase to work on.)
}
PUT : api/management/algorithm
Request Data:
{
algorithm : string|'none' // Name of the algoritm to run. If 'none', don't run any algorithm.
}
Response Data: none
POST : api/management/static-duration
Request Data:
{
phase : number, // No of the phase
duration : number // Time in seconds
}
Response Data: none
POST : api/management/manual-trigger
Request Data:
{
phase : number // No of the phase
}
Response Data: none
Service name is specified in the url.
PUT : api/management/services/:serviceName/running
Request Data:
{
value : boolean // Start if true, stop if false.
}
Response Data: none
Uploads given file as firmware
PUT : api/firmware
Request Data:
Data format is FormData. File is sent in file
property.
Response Data: none
It would be better if you send the response first, then restart the device. Otherwise I cannot know if operation failed or succeeded.
POST : api/management/restart
Request Data: none
Response Data: none