Alldevice API
API Endpoint
http://factory5.alldevicesoft.com/apiThis API is implemented as plain JSON over HTTP(s) using POST method. API endpoint is the Alldevice installation url/api. For example http://factory5.alldevicesoft.com/api
Authentication
Every request must be authenticated with username, password and key. Key can be found under API tab in Settings menu.
-
Request (application/json)
{ "auth": { "username": "username", "password": "password", "key": "abcdef-ghijkl-mnopqr-stuvwx" } }
Response
Every response objects contains success:true|false
and a response
object.
The type of response
depends on the request.
-
Response (application/json)
{ "success": true, "response": { ... } }
Errors
In case of an error value of success
will be false
. Additional code
and message
will be added to describe the problem.
-
Response (application/json)
{ "success": false, "code": 2, "message": "Unauthorized" }
Devices ¶
Locations list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"object_id": 80,
"parent_id": 0,
"object_name": "Alldevice office",
"data": [
{
"object_id": 767,
"parent_id": 80,
"object_name": "Pump unit",
"data": [
{
"object_id": 927,
"parent_id": 767,
"object_name": "Mazgas"
}
]
}
]
},
{
"object_id": 914,
"parent_id": 0,
"object_name": "Temporary"
}
...
]
}
Get locations listPOST/devices/locations
Manufacturers list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"manufacturer_id": 645,
"manufacturer_name": "ABB"
},
{
"manufacturer_id": 633,
"manufacturer_name": "ABS"
},
{
"manufacturer_id": 651,
"manufacturer_name": "Fenner"
}
...
]
}
Get manufacturers listPOST/devices/manufacturers
Categories list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"type_id": 67,
"type_name": "Actuators",
"category_id": 67,
"category_name": "Actuators",
},
{
"type_id": 129,
"type_name": "Filters",
"category_id": 129,
"category_name": "Filters",
},
{
"type_id": 127,
"type_name": "Fans",
"category_id": 127,
"category_name": "Fans",
},
{
"type_id": 75,
"type_name": "Couplings",
"category_id": 75,
"category_name": "Couplings",
},
...
]
}
Get device categories listPOST/devices/categories
- Category and type are the same thing and category is meant to replace the type definition
Custom fields list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"field_id": 1,
"field_name": "Custom field 1",
"field_type": "date",
"is_required": false
},
{
"field_id": 133,
"field_name": "Setpoint",
"field_type": "text",
"is_required": false
},
{
"field_id": 39,
"field_name": "PN",
"field_type": "number",
"is_required": false
},
{
"field_id": 53,
"field_name": "Support URL",
"field_type": "url",
"is_required": false
},
{
"field_id": 176,
"field_name": "Options",
"field_type": "select",
"is_required": false,
"options": [
{
"option_id": 75,
"field_value": "option 1"
},
{
"option_id": 76,
"field_value": "option 2"
}
]
}
...
]
}
Get device custom fields listPOST/devices/custom_fields
The possible field_type
values are:
-
text
This type of field is not validated -
number
Value is validated as float -
date
Value is validated as date (YYYY-MM-DD) -
email
Value is validated as email (user@domain.com) -
url
Value is validated as URL (http(s)😕/domain.name.com) -
select
Value must be one of option_id
Devices list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"limit": 100,
"start": 0
...
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"limit": 100,
"start": 0,
"total": 1,
"data": [
{
"device_id": 196,
"device_status": "normal",
"parent_id": 66,
"manufacturer_id": 650,
"device_type": "ABC-OHOHOHH",
"device_name": "Pump",
"type_id": 67,
"objects_path": "/0/66/335",
"description": "Very\nBig\nPump",
"comments": "Coupler description",
"serial_number": "45564645",
"inventory_number": "00123123",
"work_hours": 2000,
"next_task_date": "2017-04-14",
"next_task_status": "critical",
"nfc_tag": "543543623",
"custom_fields": [
{
"field_id": 1,
"field_type": "date",
"field_value": "2017-06-22"
},
{
"field_id": 40,
"field_type": "text",
"field_value": "000322222"
},
{
"field_id": 45,
"field_type": "text",
"field_value": "Qq22"
},
{
"field_id": 47,
"field_type": "text",
"field_value": "Text"
},
{
"field_id": 48,
"field_type": "text",
"field_value": "Text"
},
{
"field_id": 53,
"field_type": "url",
"field_value": "www.alldevicesoft.com"
},
{
"field_id": 75,
"field_type": "date",
"field_value": "2017-06-13"
},
{
"field_id": 176,
"field_type": "select",
"field_value": 76,
"options": [
{
"option_id": 75,
"field_value": "option 1"
},
{
"option_id": 76,
"field_value": "option 2"
}
]
}
]
},
...
]
}
}
Get devices listPOST/devices/list
Additional filtering is possible with parameters:
-
limit
Modify the size of result dataset. Possible value 0-200 -
start
Works withlimit
and returns the result dataset at specific index -
device_id
Return specific row by its ID -
manufacturer_id
Filter by manufacturer -
type_id
Filter by device category -
inventory_number
Filter by inventory number -
include_spares
If set to 1 the request also returns all connected spares -
last_update_time
Returns devices where last update time is higher then the entered value (Format: Y-m-d H:i:s) -
device_name
Filter by device name -
serial_number
Filter by device serial number -
device_type
Filter by device type/model
Device dataset response fields:
-
device_status
Possible values:normal
,repair
,suspended
-
parent_id
location tree parent node -
objects_path
complete path in location tree -
work_hours
Complete operating hours currently
Create device ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"name": "name",
"category_id": 1,
"manufacturer_id": 1,
"type": "type",
"serial_no": "serial number",
"inventory_no": "inventory number",
"description": "description",
"remark": "remark",
"status": "status",
"device_location_id": 1,
"custom_fields": {
"custom_field_id": "value1",
...}
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"message": Added,
"device_id": 1
}
}
Create device ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"device_id": 1,
"device_name": "name",
"category_id": 1,
"type_id": 1,
"manufacturer_id": 1,
"type": "type",
"serial_no": "serial number",
"inventory_no": "inventory number",
"description": "description",
"remark": "remark",
"status": "status",
"device_location_id": 1,
"custom_fields": {
"custom_field_id": "value1",
...}
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"message": Updated,
"device_id": 1
}
}
Update devicePOST/devices/updateDevice
Required parameters are:
- int
device_id
Device id
- string
device_name
Device name - integer
category_id
Device category id - integer
type_id
Device type id(same as category id. Used by older systems) - integer
manufacturer_id
Device manufacturer id - string
type
Device type name - string
serial_no
Device serial number - string
inventory_no
Device inventory number - string
description
Device description - string
remark
Device remark - string
status
Device status('normal', 'repair', 'suspended') - integer
device_location_id
Device location id - array
custom_fields
Device custom fields
Create location ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"location_name": "test",
"location_parent_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"message": Added,
"location_id": 1
}
}
Create locationPOST/devices/createLocation
Required parameters are:
- string
location_name
Location name
Update location ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"new_location_name": "new location name",
"location_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"location_id": 1
}
}
Update locationPOST/devices/updateLocation
Required parameters are:
- string
new_location_name
Changes the location name - string
location_id
Id of existing location
Delete location ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"location_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"location_id": 1
}
}
Delete locationPOST/devices/deleteLocation
Required parameters are:
- string
location_id
Id of existing location
Setting device operating hours ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"device_id": 100,
"work_hours": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"work_hours": 126,
"difference": 2
}
}
Set work hoursPOST/devices/set_work_hours
Required parameters are:
-
integer
device_id
ID of device -
integer
work_hours
Value of device’s total operating hours
Successful response returns:
-
work_hours
New total work hours of the device -
difference
Number of hours since previous update
Setting multiple devices operating hours ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"devices": [{
"device_id": 1,
"work_hours": 4
}, ...],
"object_id": 1,
"work_hours": 4
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"successful_devices": [{
"work_hours": 4,
"difference": 2,
"device_id": 1
}],
"errors": [{
"devices_with_invalid_work_hours": [],
"devices_with_invalid_ids": [],
"devices_with_work_hours_already_set": []
}]
}
}
Set multiple work hoursPOST/devices/set_work_hours
Required parameters are:
List of devices with values:
-
Send by device ids
array
device_id
work_hours
-
Send by location id
object_id
work_hours
Adding device operating hours ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"work_hours": 1,
"devices": [
35,
196
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"35": 12,
"196": 2014
}
}
Add work hoursPOST/devices/add_work_hours
Required parameters are:
-
integer
work_hours
Value to add to device’s current operating hours -
array
devices
list of device_id -
integer
object_id
Location ID (in case parameterdevices
is empty,object_id
is used).
Work hours will be added to all devices at specified location.
Successful response returns:
array of new work hours of devices in format: “device_id: work_hours”
Adding multiple devices operating hours ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"items": [
{
"work_hours": 10,
"object_id": 1
},
{
"work_hours": 10,
"device_id": 1
}
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response":
"updated": [
{
"device_id": 1,
"new_hours": 10
},
{
"device_id": 2,
"new_hours": 10
}
]
"errors": []
}
Add multi work hoursPOST/devices/add_multi_work_hours
Required parameters are:
-
array
items
List of work_hours and device ids
or
List of work_hours and object ids -
Mix of device ids and object ids are allowed
-
If errors are found then the lines with errors are returned with device or object and the reason. The rest are updated
Fault types ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"category_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"category_id": 1,
"category_name": "some category",
"fault_types": [
{
"fault_id": 1,
"fault_name": "some fault",
"date_created": "2023-04-23 21:25:33",
"date_updated": "2023-05-24 11:15:33"
},
{
"fault_id": 2,
"fault_name": "some other fault",
"date_created": "2023-04-26 20:25:33",
"date_updated": "2023-05-27 20:24:33"
}]
}
]
}
Downtimes categories list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"cat_id": 12,
"name": "Planned downtime"
},
{
"cat_id": 4,
"name": "Emergency"
},
{
"cat_id": 10,
"name": "Unknown"
},
...
]
}
Get device downtime categories listPOST/downtimes/categories
Downtimes list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"work_hours": 1,
"devices": [
2621,
196
],
"start_date": "2019-10-01",
"end_date": "2019-11-01"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"id": 100,
"device_id": 2621,
"start_date": "2019-10-23 15:55:00",
"end_date": "2019-10-23 16:04:00",
"is_started": true,
"is_ended": true,
"device_name": "Device 1",
"device_location": "",
"duration_seconds": 540,
"cat_id": 12,
"cat_name": "Planned downtime",
"comments": ""
},
...
]
}
Get device downtime listPOST/downtimes/list
Optional parameters are:
-
date_start
Filter by minimum downtime start dateYYYY-MM-DD
-
date_end
Filter by maximum downtime end dateYYYY-MM-DD
-
array
devices
list of device_id -
array
objects
list of object_id (locations)
Service tasks ¶
Workers list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"user_id": 126,
"name": "Bahr Pump Ltd"
},
{
"user_id": 134,
"name": " Jane Doe"
},
{
"user_id": 114,
"name": "John Doe"
}
...
]
}
Get workers listPOST/tasks/workers
Service groups list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"group_id": 47,
"group_name": "Shutdown"
},
{
"group_id": 15,
"group_name": "Diagnostics"
},
{
"group_id": 11,
"group_name": "Clean filters"
}
...
]
}
Get service groups listPOST/tasks/service_groups
Action preset list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"preset_id": 19,
"name": "Change oil & filters",
"actions": [
{
"preset_action_id": 28,
"action": "Change oil"
},
{
"preset_action_id": 29,
"action": "Change filters"
}
]
},
{
"preset_id": 20,
"name": "Add oil",
"actions": [
{
"preset_action_id": 26,
"action": "Clean motor"
},
{
"preset_action_id": 27,
"action": "Add 5L oil"
}
]
}
...
]
}
Get action preset listPOST/tasks/action_presets
Service tasks list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"limit": "100",
"start": "0",
"device_id": "0",
"object_id": "10",
"type_id": "1",
"group_id": "1",
"date_start": "2017-01-01",
"date_end": "2017-01-31",
"incomplete": "1",
"users": [
1,
2
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response":
{
"limit": 100,
"start": 0,
"total": 4534,
"data": [
{
"task_id": 526152,
"device_id": 27,
"device_name": "Pump 36H",
"object_id": 88,
"type_id": 67,
"service_id": 75,
"service_name": "Change filter",
"service_description": "Change filter",
"created_on": "2012-12-19 12:25:46",
"users": [
{
"user_id": 18,
"name": "John Doe"
}
],
"fault_type": [
{
"fault_id": 1,
"fault_name": "Error one"
}
],
"service_type": "regular",
"service_date": "2017-07-13",
"service_date_end": "2017-07-13",
"group_id": 15,
"priority": 1,
"priority_name": "normal",
"service_duration": "",
"due_days": 42,
"task_status": "critical",
"device_status": "normal",
"is_completed": false,
"comments": "",
"comments_next": "",
"completed_date": "0000-00-00",
"completed_date_end": "0000-00-00",
"confirmed_by_user": "Jon Doe",
"confirmed_by_user_id": 654,
"created_by": "AD user",
"created_by_id": 1,
"confirmed_on": "2017-06-24 16:42:32",
"activities": [
{
"activity_id": 1231895,
"opened_type": 1,
"closed_type": 1,
"opened_time": "2020-06-18 10:04:00",
"closed_time": "2020-06-18 11:04:00"
},
],
"actions": [
{
"id": 1231895,
"action": "Change filter and clean pump",
"preset_id": 0,
"completed": false
},
{
"id": 1231896,
"action": "Yearly maintenance",
"preset_id": 12,
"data": [
{
"action": "Change filter",
"preset_action_id": 5,
"completed": true
},
{
"action": "Add oil",
"preset_action_id": 24,
"completed": false
}
]
}
]
}
...
}
Get service tasks listPOST/tasks/list
Additional filtering is possible with parameters:
-
limit
Modify the size of result dataset. -
start
Works withlimit
and returns the result dataset at specific index -
device_id
Filter tasks by specific device -
object_id
Filter tasks of devices in specific location -
type_id
Filter by device category -
group_id
Filter by service group -
date_start
Filter by minimum next service dateYYYY-MM-DD
or completed date (when task is completed) -
date_end
Filter by maximum next service dateYYYY-MM-DD
or completed date (when task is completed) -
work_time_start
Filter by registered work timeYYYY-MM-DD HH:MM
. When this filter is present,date_start
anddate_end
are ignored (in case “Real-time task duration recording” setting is turned on) -
work_time_end
Filter by registered work timeYYYY-MM-DD HH:MM
. When this filter is present,date_start
anddate_end
are ignored (in case “Real-time task duration recording” setting is turned on) -
incomplete
Value: 1. Filter only incomplete tasks -
complete
Value: 1. Filter only complete tasks -
service_type
Filter by task type. Possible values:regular
,planned
,extraordinary
-
users
Array of user IDs assigned to task -
task_id
Filter by task ID -
is_external
Filter by if is external -
show_precreated
Add precreated tasks to the response -
show_used_spares
Possible values:true
,false
. Will add data from the "used spares list" API to the response data as "used_spares"
Successful response returns:
- priority
Possible value:1
- low,2
- normal,3
- high - opened_type and closed_type
Possible value:null
- No action,0
- Confirmed, but not in real time,1
- Confirmed in real time,2
- Confirmed with nfc
Create service task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"device_id": 196,
"service_type": "extraordinary",
"device_status": "normal",
"service_name": "Pump is broken",
"service_description": "It stopped working",
"service_date": "2017-08-24",
"service_start_time": "04:45",
"users": [
1,
106
],
"priority": 2,
"service_duration": "01:00",
"group_id": 55,
"actions": [
{
"preset_id": 19
},
{
"action": "Fix pump"
}
],
"user_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"task_id": 536447,
"device_id": 196,
"device_name": "Pump 101",
"service_id": 0,
"service_name": "Needs attention, bad sound",
"service_description": "Needs attention, bad sound",
"users": [
{
"user_id": 1,
"name": "John Doe"
},
{
"user_id": 106,
"name": "Jane Doe"
}
],
"service_type": "extraordinary",
"service_date": "2017-08-24",
"service_date_end": "0000-00-00",
"priority": 2,
"priority_name": "high",
"service_duration": "01:00",
"due_days": 1,
"task_status": "critical",
"device_status": "normal",
"is_completed": false,
"comments": "",
"comments_next": "",
"completed_date": "0000-00-00",
"completed_date_end": "0000-00-00",
"actions": [
{
"id": 1257011,
"action": "Clean filter",
"preset_id": 19,
"data": [
{
"action": "Clean device",
"preset_action_id": 28,
"completed": false
},
{
"action": "Clean filter",
"preset_action_id": 29,
"completed": false
}
]
},
{
"id": 1257012,
"action": "Add oil",
"preset_id": 0,
"completed": false
}
]
}
}
Create service task requestPOST/tasks/create
Required parameters are:
- One of the following:
integer
device_id
ID of deviceinteger
object_id
ID of loctation
-
service_type
Possible values:planned
,extraordinary
-
string
service_name
Name of the service task -
string
service_date
Planned date to complete the taskYYYY-MM-DD
-
priority
Possible value:0
- low,1
- normal,2
- high
Optional parameters:
-
string
service_description
More detailed description of the problem -
array
users
List of valid user_id’s (performers) -
string
service_duration
Duration of the workHH:MM
-
string
service_start_time
Task start timeHH:MM
-
integer
group_id
ID of service group -
string
device_status
Change device status after creating the task. Valid options arenormal
,repair
,suspended
-
array
actions
Array of arrays. Either a valid action preset IDpreset_id
or name of the action is required. -
integer
user_id
ID of user (created by) -
string
create_user_name
name of user (created by)
If this parameter is present,user_id
will be ignored
On success a new service task object is returned
Update service task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447",
"completed_hours": "2005",
"service_duration": "01:00",
"comments": "Comments about the problem",
"comments_next": "Needs to be changed",
"users": [
1,
106
],
"actions": [
{
"preset_id": 19,
"completed": [
19,
20
]
},
{
"action": "Check",
"completed": true
}
],
"pictures": [
{
"content": "/9j/4AAQSkZJRgABAQEAZABkAAD/2w...",
"name": "picture-1.jpg",
"description": "Some information"
},
{
"content": "FMeYMFbRqTtTTTBEVmWI+YLMwWYiWbpuyGt4Fy...",
"name": "picture-2.jpg",
"description": "Some information"
}
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"task_id": 536447,
"device_id": 196,
"device_name": "Pump 316",
"service_id": 0,
"service_name": "Regular check",
"users": [
{
"user_id": 1,
"name": "John Doe"
},
{
"user_id": 106,
"name": "Jane Doe"
}
],
"service_type": "extraordinary",
"service_date": "2017-08-24",
"service_date_end": "0000-00-00",
"priority": 2,
"priority_name": "high",
"service_duration": "01:00",
"due_days": 1,
"task_status": "critical",
"device_status": "normal",
"is_completed": false,
"comments": "",
"comments_next": "",
"completed_date": "0000-00-00",
"completed_date_end": "0000-00-00",
"actions": [
{
"id": 1257013,
"action": "Clean filters",
"preset_id": 19,
"data": [
{
"action": "Check oil level",
"preset_action_id": 28,
"completed": false
},
{
"action": "Clean filters",
"preset_action_id": 29,
"completed": false
}
]
},
{
"id": 1257014,
"action": "Change couplers",
"preset_id": 0,
"completed": false
}
]
}
}
Update service task requestPOST/tasks/update
Required parameters
- integer
task_id
Optional parameters
-
integer
completed_hours
- Device operating ours at which this task was completed -
time
service_duration
- Duration of the work -
string
comments
- Comments about the work -
string
comments_next
- Comments for next interval -
array
users
- List of user ids -
array
actions
- Two types of actions are possible. -
array
pictures
- Add pictures to service task. Array of file objects -
array
files
- Add report files to service task. Array of file objects
In case of preset_id
is present completed
is array of completed preset_action_id
.
If action
is present, completed
value is boolean.
This field is ignored when task is completed.
Array of objects for files and pictures
-
string
content
- Base64 encoded file contents (Required) -
string
name
- File name (Required) -
string
description
- (Optional)
[
{
"content": "/9j/4AAQSkZJRgABAQEAZABkAAD/2w...",
"name": "picture-1.jpg",
"description": "Some information"
},
{
"content": "FMeYMFbRqTtTTTBEVmWI+YLMwWYiWbpuyGt4Fy...",
"name": "picture-2.jpg",
"description": "Some information"
}
]
Complete service task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447",
"completed_hours": "2005",
"service_duration": "01:00",
"comments": "Comments about the problem",
"comments_next": "Needs to be changed",
"users": [
1,
106
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"task_id": 536447,
"device_id": 196,
"device_name": "Pump 218",
"service_id": 0,
"service_name": "Check oil level",
"users": [
{
"user_id": 1,
"name": "John Doe"
},
{
"user_id": 106,
"name": "Jane Doe"
}
],
"service_type": "extraordinary",
"service_date": "2017-08-24",
"service_date_end": "0000-00-00",
"priority": 2,
"priority_name": "high",
"service_duration": "01:00",
"due_days": 1,
"task_status": "critical",
"device_status": "normal",
"is_completed": true,
"comments": "",
"comments_next": "",
"completed_date": "0000-00-00",
"completed_date_end": "0000-00-00",
"actions": [
{
"id": 1257013,
"action": "Change filters",
"preset_id": 19,
"data": [
{
"action": "Check filters",
"preset_action_id": 28,
"completed": false
},
{
"action": "Change filters",
"preset_action_id": 29,
"completed": false
}
]
},
{
"id": 1257014,
"action": "Check oil level",
"preset_id": 0,
"completed": false
}
]
}
}
Complete service task requestPOST/tasks/complete
All parameters are optional
-
integer
task_id
-
integer
completed_hours
device operating ours at which this task was completed -
time
service_duration
duration of the work -
string
comments
comments about the work -
string
comments_next
comments for next interval -
array
users
List of user ids
Work times list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"activity_id": 1214,
"task_id": 614304,
"opened_nfc": false,
"closed_nfc": false,
"is_opened": true,
"is_closed": false,
"duration_time": "00:00",
"duration_total_time": "00:00",
"users": [
{
"user_id": 13,
"name": "John Doe"
}
],
"opened_time": "2019-05-16 15:00:00"
},
{
"activity_id": 1213,
"task_id": 614304,
"opened_nfc": false,
"closed_nfc": false,
"is_opened": true,
"is_closed": true,
"duration_time": "01:00",
"duration_total_time": "02:00",
"users": [
{
"user_id": 92,
"name": "John Smith"
}
],
"opened_time": "2019-05-16 13:00:00",
"closed_time": "2019-05-16 14:00:00"
}
...
]
}
Work times listPOST/tasks/work_times
- integer
task_id
(required) - Could be specified in URL or in POST body
Get service task pictures ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"content": "77j4AAQSkZJRgABAQAAAQABAA...",
"name": "picture.png",
"description": "task_picture"
},
...
]
}
Stages listPOST/tasks/pictures
- integer
task_id
-
string
content
- Picture as Base64 encoded -
string
name
- String -
string
description
- String
Required
Response
Stages list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"task_stage_id": 220,
"stage_id": 16,
"stage_name": "02. Waiting for spares",
"stage_deadline": "2019-05-22",
"comments": "Comment\nabout\nthis stage",
"users": [
92,
117
]
}
...
]
}
Stages listPOST/tasks/stages
- integer
task_id
Used spares list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": "536447"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"id": 1905364,
"quantity": 1,
"price": 14,
"price_retail": 15,
"product_id": 88,
"ean": "151454324123131",
"code": "AX-SPARE-002",
"name": "AxFlow test spare 2",
"manufacturer_id": 5,
"manufacturer_name": "SKF",
"cat_id": 7,
"cat_name": "Rotork Mk1",
"minimum_stock_count": 0,
"available_count": 1,
"comments": "",
"price_in_stock": 14,
},
...
]
}
Add extra cost to task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": 1,
"code": "code_one",
"name": "name_one",
"qty": 1,
"cost": 50,
"sales_price": 100,
"sales_price_vat": 22
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Add extra cost to taskPOST/tasks/add_extra_cost_to_task
Required parameters:
- integer
task_id
- float
qty
- float
sales_price
- integer
sales_price_vat
One or both of those must be included:
- string
code
- string
name
Optional:
- float
cost
Change extra cost on task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": 1,
"task_product_id": 1,
"code": "code_one",
"name": "name_one",
"qty": 1,
"cost": 50,
"sales_price": 100,
"sales_price_vat": 22
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Change extra cost on taskPOST/tasks/change_extra_cost_on_task
Required parameters:
- integer
task_id
- integer
task_product_id
- float
qty
- float
sales_price
- integer
sales_price_vat
One or both of those must be included:
- string
code
- string
name
Optional:
- float
cost
To get task_product_id call "/api/tasks/spares" endpoint
Delete extra cost on task ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": 1,
"task_product_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Delete extra cost on taskPOST/tasks/delete_extra_cost_on_task
Required parameters:
- integer
task_id
- integer
task_product_id
To get task_product_id call "/api/tasks/spares" endpoint
Get task pdf ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"task_id": 1,
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"pdf": "JVBERi0xLjQKJeLjz9MKJVBERi0xLjQKJeLjz9...."
}
}
Get task pdfPOST/tasks/getPdf
Response contains Base64 encoded pdf file content
Required parameters
-
integer
task_id
Service task ID
Used spares list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"start_date": "2020-02-01",
"end_date": "2021-05-28",
"task_group_id": 1,
"task_type": "regular",
"task_status": "is_completed",
"performer_ids": [1]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"task_id": 1,
"task_name": "Christmas tree",
"date_start": "2021-02-16",
"date_end": "2021-02-16",
"performers": "user name",
"task_status": "complete",
"task_type": "Planned task",
"task_group_id": "1",
"used_spares": [
{
"id": 1905364,
"quantity": 1,
"price": 14,
"price_retail": 15,
"product_id": 88,
"ean": "151454324123131",
"code": "AX-SPARE-002",
"name": "AxFlow test spare 2",
"manufacturer_id": 5,
"manufacturer_name": "SKF",
"cat_id": 7,
"cat_name": "Rotork Mk1",
"minimum_stock_count": 0,
"available_count": 1,
"comments": "",
"price_in_stock": 14,
},
...
]
},
...
]
}
Get used spares history listPOST/tasks/usedSparesHistory
Required parameters:
- string
start_date
(YYYY-MM-DD) - string
end_date
(YYYY-MM-DD)
- integer
task_group_id
- string
task_type
(extraordinary, planned, regular) - string
task_status
(is_completed, incomplete) - array
performer_ids
(list of user ids)
Completed tasks reports ¶
List ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"date_start": "2020-01-01",
"date_end": "2020-01-20",
"date_type": "confirmed_date"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
"data": [
{
"report_id": 1762,
"report_nr": "1591",
"total_time": "",
"service_name": "Monthly maintenance",
"device_name": "Device 1",
"device_location": "Factory / Section 1",
"user_name_list": "John Smith",
"device_id": 510,
"task_id": 647940,
"products_cost": "10.00",
"created_user_id": 190,
"comments": null,
"date_created": "2020-01-02 13:38:43",
"is_signed": false,
"status_id": 0,
"status_name": "",
"signature_client_name": null,
"completed_date": "2020-01-02",
"completed_date_end": "2020-01-02",
"completed_date_system": "2020-01-02 13:38:43"
},
...
],
"limit": 0,
"start": 0,
"total": 1
]
}
Get completed task reports listPOST/taskreports/list
All parameters are optional
-
integer
task_id
Service task ID -
integer
report_nr
Report No -
integer
object_id
Location ID -
integer
device_id
Device ID -
date
date_start
format:YYYY-MM-DD
-
date
date_end
format:YYYY-MM-DD
-
string
date_type
possible values:
‘original_date’: Task original date
‘service_date’: Date
‘completed_date_start’: Work start time
‘completed_date_end’: Work end time
‘completed_date’: Carried out
‘confirmed_date’: Confirmed
Get completed task report statuses ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
}
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"data": [
{
"status_id": 1,
"name": "test status",
},
...
],
}
}
Get completed task report statusesPOST/taskreports/getTaskReportTaskStatuses
No parameres are used
Update completed task report status ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"report_nr": 1234,
"status_id": 1,
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Update completed task report statusPOST/taskreports/updateTaskReportTaskStatus
All parameters are required
-
integer
report_nr
Completed task report number -
integer
status_id
Completed task report status id
Pdf ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"report_id": 1856,
// or
"report_nr": 1680,
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"pdf": "JVBERi0xLjQKJeLjz9MKJVBERi0xLjQKJeLjz9...."
}
}
Get completed task report pdf filePOST/taskreports/getPdf
Response contains Base64 encoded pdf file content
Required parameters
You have to specify one of these parameters to get a report
-
integer
report_id
Completed service task report ID -
integer
report_nr
Completed service task report Number
Users ¶
Users list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"user_id": 134,
"name": " Jane Doe",
"email": "janedoe@alldevicesoft.com",
"group_id": 1,
"username": "JaneDoe",
"firstname": "Jane",
"lastname": "Doe",
"group_name": "Administrator",
"group_description": "User group with all privileges"
},
{
"user_id": 114,
"name": "John Doe",
"email": "johndoe@alldevicesoft.com",
"group_id": 1,
"username": "JohnDoe",
"firstname": "John",
"lastname": "Doe",
"group_name": "Administraator",
"group_description": "User group with all privileges"
}
...
]
}
Get users listPOST/users/list
Performers list ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"types": [
"performer",
"executor"
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"user_id": 134,
"name": " Jane Doe",
"email": "janedoe@alldevicesoft.com",
"group_id": 1,
"group_name": "Administrator",
"group_description": "User group with all privileges"
},
{
"user_id": 114,
"name": "John Doe",
"email": "johndoe@alldevicesoft.com",
"group_id": 1,
"group_name": "Administraator",
"group_description": "User group with all privileges"
}
...
]
}
Get performers listPOST/performers/list
Optional parameters:
- Array
types
values: ‘performer’, ‘executor’
performer: type of system user who has performer status
executor: executors (outside contractors)
In case when parameter is omitted or is empty, both types of performers are returned
Spares ¶
Categories list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"cat_id": 1,
"name": "Category 1"
},
{
"cat_id": 2,
"name": "Category 2"
}
...
]
}
Get categories listPOST/products/categories
Update/add category ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"cat_id": 1,
"name": "Category 1"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"cat_id": 1,
"name": "Category 1"
}
}
Update or add categoryPOST/products/category_update
In case cat_id
is omitted or is ‘0’, new category is added.
Required parameters are:
- string
name
Name of the category
Optional parameters:
- integer
cat_id
ID of category
On success a new/updated category object is returned
Delete category ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"cat_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true
}
Manufacturers list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"id": 1,
"name": "Manufacturer 1"
},
{
"id": 2,
"name": "Manufacturer 2"
}
...
]
}
Get manufacturers listPOST/products/manufacturers
Update/add manufacturer ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"id": 1,
"name": "Manufacturer 1"
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"id": 1,
"name": "Manufacturer 1"
}
}
Update or add manufacturerPOST/products/manufacturer_update
In case id
is omitted or is ‘0’, new manufacturer is added.
Required parameters are:
- string
name
Name of the manufacturer
Optional parameters:
- integer
id
ID of manufacturer
On success a new/updated manufacturer object is returned
Delete manufacturer ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true
}
Delete manufacturerPOST/products/manufacturer_delete
Required parameters are:
- integer
id
ID of manufacturer
Available custom fields list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": [
{
"field_id": 1,
"field_name": "Status",
"field_type": "select",
"is_required": false,
"options": [
{
"option_id": 12,
"field_id": 1,
"field_value": "Status 1"
},
{
"option_id": 11,
"field_id": 1,
"field_value": "Status 2"
},
{
"option_id": 14,
"field_id": 1,
"field_value": "Status 3"
},
{
"option_id": 13,
"field_id": 1,
"field_value": "Status 4"
}
]
},
{
"field_id": 28,
"field_name": "Serial number",
"field_type": "text",
"is_required": false
},
{
"field_id": 3,
"field_name": "Date",
"field_type": "date",
"is_required": false
},
{
"field_id": 22,
"field_name": "Capacity",
"field_type": "number",
"is_required": false
}
...
]
}
Get custom fields listPOST/products/custom_fields
Spares list ¶
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"total": 129,
"limit": 0,
"start": 0,
"data": [
{
"product_id": 7,
"code": "55C Mk1 IQ12",
"name": "Rotork Covers maintenance kit: O rings",
"manufacturer_id": 6,
"manufacturer_name": "Rotork",
"cat_id": 7,
"cat_name": "Rotork Mk1",
"price": 48,
"price_retail": 49,
"price_in_stock": 48,
"minimum_stock_count": 0,
"available_count": 3,
"comments": "",
"stocks": [
{
"stock_id": 1,
"quantity": 1,
"available_count": 1,
"price_in_stock": 17.25
},
{
"stock_id": 2,
"quantity": 12,
"available_count": 5,
"price_in_stock": 10.75
}]
"custom_fields": [
{
"field_id": 1,
"field_name": "Status",
"field_type": "select",
"is_required": false,
"options": [
{
"option_id": 12,
"field_id": 1,
"field_value": "Status 1"
},
{
"option_id": 11,
"field_id": 1,
"field_value": "Status 2"
},
{
"option_id": 14,
"field_id": 1,
"field_value": "Status 3"
},
{
"option_id": 13,
"field_id": 1,
"field_value": "Status 4"
}],
"value": "12",
"display_value": "Status 1"
},
{
"field_id": 7,
"field_name": "Warehouse",
"field_type": "select",
"is_required": false,
"options": [
{
"option_id": 8,
"field_id": 7,
"field_value": "Warehouse 1"
},
{
"option_id": 9,
"field_id": 7,
"field_value": "Warehouse 2"
},
{
"option_id": 10,
"field_id": 7,
"field_value": "Warehouse 3"
},
{
"option_id": 7,
"field_id": 7,
"field_value": "Warehouse 4"
}],
"value": "8",
"display_value": "Warehouse 1"
},
{
"field_id": 3,
"field_name": "Date",
"field_type": "date",
"is_required": false,
"value": "2018-11-02",
"display_value": "2018-11-02"
},
{
"field_id": 23,
"field_name": "Department",
"field_type": "select",
"is_required": false,
"options": [
{
"option_id": 3,
"field_id": 23,
"field_value": "Department 1"
},
{
"option_id": 4,
"field_id": 23,
"field_value": "Department 2"
},
{
"option_id": 5,
"field_id": 23,
"field_value": "Department 3"
},
{
"option_id": 6,
"field_id": 23,
"field_value": "Department 4"
}],
"value": "4",
"display_value": "Department 2"
}]
}
...
]
}
}
Get spares listPOST/products/list
Additional filtering is possible with parameters:
-
limit
Modify the size of result dataset. -
start
Works withlimit
and returns the result dataset at specific index -
product_id
Return specific row by its ID -
stock_id
Filter by stock ID. By default stock values of products will be from main stock -
all_stocks
Adds info on all of the stocks to the return message. Will also summarize all stocks quantity, available_count and average price_in_stock values. Can not be used with stock_id. -
manufacturer_id
Filter by manufacturer -
cat_id
Filter by category -
code
Filter by code using partial matching -
exact_code
Filters for an exact code match without partial matching -
name
Filter by name -
below_minimum
Filter by stock balance under minimum required quantity. Expected value 1 or 0
Delete spare ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"product_id": 1
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
In and out ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"stock_id": 1,
"task_id": 1,
"supplier_name": "name",
"purchase_document_number": "document number",
"spares": [{
"ean": "111111111",
"qty": 1,
"purchase_price": 9.99
}, ...]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"message": Spares added
}
In and outPOST/products/inAndOut
Required parameters are:
- integer
stock_id
Stock id - integer
task_id
Task id - string
supplier_name
Supplier name - string
purchase_document_number
Purchase document number - Array
spares
values: ‘ean’, ‘qty’, ‘purchase_price’
ean: spare ean code in alldevice
qty: spare amount
purchase_price: spare purchase price
All values are needed
Stock to stock ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"out_of_stock_id": 1,
"into_stock_id": 2,
"spares": [{
"spare_id": 1,
"qty": 1
}, ...]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"message": Spares moved
}
Stock to stockPOST/products/stockToStock
Required parameters are:
- integer
out_of_stock_id
Stock id - integer
into_stock_id
Stock id - Array
spares
values: ‘spare_id’, ‘qty’
spare_id: spare id in alldevice
qty: spare amount
All values are needed
Book spares ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"stock_id": 1,
"task_id": 1,
"spares": [{
"ean": "111111111",
"id": 111111111,
"qty": 1
}, ...]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"message": Spares booked to task
}
Book sparesPOST/products/bookSpares
Required parameters are:
- integer
stock_id
Stock id - integer
task_id
Task id - Array
spares
values: ‘id’, ‘ean’, ‘qty’
id: spare id code in alldevice
ean: spare ean code in alldevice
qty: spare amount
qty and "id or ean" values are needed in spares array
Purchase or write-off ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"supplier_name": "supplier name",
"document_number": "document number",
"document_date": "2020-01-01",
"comment": "comment",
"type": "type",
"products": [{
"product_id": 1,
"qty": 1,
"price": 9.99,
"stock_id": 1
}, ...]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"message": Products added or Products written off
}
Purchase or write-offPOST/products/purchaseOrWriteOff
Required parameters are:
- string
supplier_name
Purchase supplier name (Required if type purchase, not used by type writeoff) - string
document_number
Purchase document number (Not used by type writeoff) - string
document_date
Purchase document date (Not used by type writeoff) - string
comment
Write-off comment (Required if type writeoff, not used by type purchase) - string
type
'purchase' or 'writeoff' (Required) - Array
products
values: ‘product_id’, ‘qty’, ‘price’, 'stock_id'
product_id: product id code in alldevice
qty: product amount
price: product price
stock_id: stock id code in alldevice
Price is not needed if Write-off is used. Others are required
Update/add spare ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"name": "Rotor",
"code": "CODE-123",
"ean": "Ean-code",
"brand_id": 2,
"cat_id": 6,
"price_cost": 10.5,
"price_retail": 22,
"minimum_count": 4,
"comments": "Some info about this product",
"custom_fields": [
{
"field_id": 34,
"value": "ean-9999999"
},
{
"field_id": 7,
"value": 8
}
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"product_id": 205,
"code": "CODE-123",
"name": "Rotor",
"manufacturer_id": 2,
"manufacturer_name": "Rotork",
"cat_id": 6,
"cat_name": "Wheels",
"price": 10.5,
"price_in_stock": 10.5,
"minimum_stock_count": 4,
"available_count": 0,
"comments": "Some info about this product",
"custom_fields": [
{
"field_id": 34,
"field_name": "EAN code",
"field_type": "text",
"is_required": true,
"value": "ean-9999999",
"display_value": "ean-9999999"
},
{
"field_id": 7,
"field_name": "Ladu",
"field_type": "select",
"is_required": true,
"options": [
{
"option_id": 8,
"field_id": 7,
"field_value": "Warehouse 1"
},
{
"option_id": 9,
"field_id": 7,
"field_value": "Warehouse 2"
},
{
"option_id": 10,
"field_id": 7,
"field_value": "Warehouse 3"
},
{
"option_id": 7,
"field_id": 7,
"field_value": "Warehouse 4"
}
],
"value": "8",
"display_value": "Warehouse 1"
}
]
}
}
Update or add sparePOST/products/update
In case product_id
is omitted or is ‘0’, new spare is added.
Only fields included in the request are being updated. For example there maybe a need to update only quantity or code.
When updating custom fields, all fields must be present in the request.
Required parameters are:
-
string
name
Name of the manufacturer (in of case adding a new spare) -
value Value of custom field, depending on current custom field settings
Optional parameters:
-
string
code
-
integer
manufacturer_id
-
integer
cat_id
-
float
price_cost
-
float
price_retail
-
float
minimum_count
-
float
quantity
-
string
comments
-
array
custom_fields
On success a new/updated spare object is returned
Create stock ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"name": "new stock name",
"is_main": "0",
"user_ids": [
1,
2
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"stock_id": 1
}
}
Create stockPOST/products/createStock
Required parameters are:
- string
name
Stock name - number
is_main
1 or 0 to set it as the main stock - array
user_ids
List of users related to stock
Update stock ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"stock_id": 2,
"name": "new stock name",
"is_main": 0,
"user_ids": [
1,
2
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"stock_id": 2
}
}
Update stockPOST/products/updateStock
Required parameters are:
- number
stock_id
Existing stock id - string
name
Stock name - number
is_main
1 or 0 to set it as the main stock - array
user_ids
List of users related to stock
Link spares to device ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"device_id": 1,
"products": [{
"product_id": 2,
"quantity": 3
}]
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Link spares to devicePOST/products/linkProductsToDevice
Required parameters are:
- number
device_id
Existing stock id - array
products
List of product ids with quantity
Link devices to spares ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"product_id": 1,
"devices": [
2,
3
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
}
Link devices to sparesPOST/products/linkDevicesToProduct
Required parameters are:
- number
product_id
Existing product id - list
devices
List of device ids
Get spare part history ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"stock_id": 2,
"stock_name": "stock name",
"date_start": "2019-01-01",
"date_end": "2023-01-01",
"show_incoming": 1,
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"data": []
}
}
Get spare part historyPOST/products/getSparePartHistory
Optional parameters are:
- number
stock_id
Existing stock id - number
stock_name
Existing stock name - string
date_start
Start date - string
date_end
End date - number
show_incoming
Show also intake data
Get stock movements ¶
Headers
Content-Type: application/json
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
},
"start_date": "2021-02-16",
"end_date": "2021-03-16",
"movement_id": 1,
"movement_type": "intake",
"stock_id": 1,
"user_ids": [
1,
2
]
}
Headers
Content-Type: application/json
Body
{
"success": true,
"response": {
"data": {
"movement_id": 1
"movement_type": "intake
"doc_date": "2021-02-21"
"user_id": "1"
"comments": "test"
"total_sum": 2
"spares": [
{
"product_id": 1
"quantity": 1
"price_cost": 2
"row_price_cost": 2
"stock_id": 1
"stock_name": "stock name"
"name": "test"
"ean": "test ean"
"code": "test code"
},
...]
}
}
}
Get Stock movements
POST/products/getStockMovemnts
Required parameters are:
- string
start_date
Start date - string
end_date
End date
- integer
movement_id
Movement id - integer
stock_id
Stock id - string
movement_type
Movement type('writeoff', 'intake', 'move') - array
user_ids
List of user ids
Stocks list ¶
Body
{
"auth": {
"username": "username",
"password": "password",
"key": "abcdef-ghijkl-mnopqr-stuvwx"
}
}
Body
{
"success": true,
"response": [
{
"stock_id": 1,
"name": "Main stock (new)",
"is_main": 1
},
{
"stock_id": 2,
"name": "Second stock",
"is_main": 0
}
]
}
Get stocks listPOST/products/stocks
Examples ¶
PHP
Request class
<?php
class AlldeviceApiRequest
{
protected $baseUrl;
protected $username;
protected $password;
protected $key;
protected $lastResponse;
public function __construct($baseUrl, $username, $password, $key)
{
$this->baseUrl = $baseUrl;
$this->username = $username;
$this->password = $password;
$this->key = $key;
}
public function getLastResponse()
{
return $this->lastResponse;
}
public function getManufacturers()
{
$result = $this->doRequest('devices/manufacturers');
return $result;
}
public function getDeviceCategories()
{
$result = $this->doRequest('devices/categories');
return $result;
}
public function getDeviceCustomFields()
{
$result = $this->doRequest('devices/custom_fields');
return $result;
}
public function getDevices($params = array())
{
$result = $this->doRequest('devices/list', $params);
return $result;
}
public function getLocations($params = array())
{
$result = $this->doRequest('devices/locations', $params);
return $result;
}
public function setDeviceWorkHours($params = array())
{
$result = $this->doRequest('devices/set_work_hours', $params);
return $result;
}
public function addDeviceWorkHours($params = array())
{
$result = $this->doRequest('devices/add_work_hours', $params);
return $result;
}
public function getWorkers($params = array())
{
$result = $this->doRequest('tasks/workers', $params);
return $result;
}
public function getServiceGroups($params = array())
{
$result = $this->doRequest('tasks/service_groups', $params);
return $result;
}
public function getActionPresets($params = array())
{
$result = $this->doRequest('tasks/action_presets', $params);
return $result;
}
public function getServiceTasks($params = array())
{
$result = $this->doRequest('tasks/list', $params);
return $result;
}
public function createTask($params = array())
{
$result = $this->doRequest('tasks/create', $params);
return $result;
}
public function updateTask($params = array())
{
$result = $this->doRequest('tasks/update', $params);
return $result;
}
public function completeTask($params = array())
{
$result = $this->doRequest('tasks/complete', $params);
return $result;
}
public function taskStages($params = array())
{
$result = $this->doRequest('tasks/stages', $params);
return $result;
}
public function getUsers($params = array())
{
$result = $this->doRequest('users/list', $params);
return $result;
}
public function getPerformers($params = array())
{
$result = $this->doRequest('performers/list', $params);
return $result;
}
public function getTaskWorkTimes($params = array())
{
$result = $this->doRequest('tasks/work_times', $params);
return $result;
}
public function getTaskSpares($params = array())
{
$result = $this->doRequest('tasks/spares', $params);
return $result;
}
public function getSpareCategories()
{
$result = $this->doRequest('products/categories');
return $result;
}
public function updateCategory($params = array())
{
$result = $this->doRequest('products/category_update', $params);
return $result;
}
public function deleteCategory($params = array())
{
$result = $this->doRequest('products/category_delete', $params);
return $result;
}
public function getSpareManufacturers()
{
$result = $this->doRequest('products/manufacturers');
return $result;
}
public function updateManufacturer($params = array())
{
$result = $this->doRequest('products/manufacturer_update', $params);
return $result;
}
public function deleteManufacturer($params = array())
{
$result = $this->doRequest('products/manufacturer_delete', $params);
return $result;
}
public function getSpareCustomFields()
{
$result = $this->doRequest('products/custom_fields');
return $result;
}
public function getSpares($params = array())
{
$result = $this->doRequest('products/list', $params);
return $result;
}
public function deleteSpare($params = array())
{
$result = $this->doRequest('products/delete', $params);
return $result;
}
public function updateSpare($params = array())
{
$result = $this->doRequest('products/update', $params);
return $result;
}
public function getDowntimeCategories()
{
$result = $this->doRequest('downtimes/categories');
return $result;
}
public function getDowntimes($params = array())
{
$result = $this->doRequest('downtimes/list', $params);
return $result;
}
public function getTaskReports($params = array())
{
$result = $this->doRequest('taskreports/list', $params);
return $result;
}
public function getTaskReportPdf($params = array())
{
$result = $this->doRequest('taskreports/getPdf', $params);
return $result;
}
protected function doRequest($method, $params = array())
{
$url = $this->baseUrl . '/api/' . $method;
$postData = array_merge($params, array(
'auth' => array(
'username' => $this->username,
'password' => $this->password,
'key' => $this->key
)
));
$postData = json_encode($postData);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$result = curl_exec($ch);
curl_close($ch);
$this->lastResponse = $result;
if ($result !== false) {
$response = json_decode($result, true);
if ($response !== false) {
return $response;
}
}
return false;
}
}
$request = new AlldeviceApiRequest(
'https://demo.alldevicesoft.com',
'username',
'password',
'joqys9-puqgqt-efiooa-puhicr'
);
$result = $request->setDeviceWorkHours(array(
'device_id' => 196,
'work_hours' => 2002
));
print_r($result);
Generated by aglio on 31 Mar 2020