Distribution API
Distribution API
Endpoint: https://environment-smartcenter.almaden.app/api/distribution/api/auth
Método: POST
Parameters via body:
{ “automatosId”: “123456789”, “automatosKey”: “ABCDEFGH=” } response code(200): { “status”: true, “data”: { “token”: “ABCDEF12345” } } response code(400): { “status”: false, “data”: {}, “error”: “invalid credential” }
Method to return a device
Endpoint: https://environment-smartcenter.almaden.app/api/distribution/api/machine?hostname=NTB1
Método: GET
Header Autorization: “Bearer <token>”
Parameter via url: hostname=NTB1
Resposta code(200)
{
"status": true, "data": {
"machines": [
{
"machineId": "123ABC", "hostname": "NTB1", "department": "DEV"
},
{
"machineId": "ABC987",
"hostname": "NTB1", "department": "Comercial"
},
]
}
}
response code(400)
{
"status": false, "data": {},
"error": "machine not found"
}
Method for creating a distribution
Endpoint: https:// environment-smartcenter.almaden.app/api/distribution/api/express/distribution
Método: POST
Header Autorization: “Bearer <token>”
Parameters via body:
{
"machineId" : "123ABC", "package" : "7zip.exe", "domain" : "AUTOMATOS",
"user" : "user",
"password" : "pass", "irradiadora" : "0050568"
}
response code(200)
{
"status" : true, "data" : {
"jobName" : "ASDF123456"
}
}
response code(400)
{
"status": false, "data": {},
"error": "Something went wrong"
}
Method to query distribution status
Endpoint: https://environment-smartcenter.almaden.app/api/distribution/api/express/distribution?jobName=ASDF123456
Method: GET
Header Autorization: “Bearer <token>”
Parameter via url: jobName= ASDF123456
Possible answers:
Description | Code | Response |
Scheduled task, waiting to run. | 200 | { “status”: true, “data”: { “delivered”: “scheduled” } } |
Running task. | 200 | { “status”: true, “data”: { “startTime”: “2021-03-30 16:43:23.000000”, “delivered”: “running” } } |
Distribution carried out successfully. | 200 | { “status”: true, “data”: { “startTime”: “2021-03-30 16:43:23.000000”, “stopTime”: “2021-03-30 16:43:40.000000”, “delivered”: “Y”, “error”: “” } } |
Expired distribution task scheduling. | 400 | { “status” :false, “data” : {}, “error”: “Expired Job” } |
Expired distribution task scheduling. | 400 | { “status” :false, “data” : {}, “error”: “Job not found” } |
Invalid access token. | 403 | { “status”: false, “data”: {}, “error”: “Unauthorized access” } |