Return codes
If an API call success, the HTTP status code
200
is returned, otherwise the status code
500
(Internal server error) is returned.
In case of an error, the result will always include a JSON object with the following content:
Parameter |
Description |
code | Error code. |
message | A human readable message explaining the error. The language used is always english. |
The error code is either
14
for unknown errors or otherwise obtained from
http://www.postgresql.org/docs/current/static/errcodes-appendix.html.
Example
{
"code": 42501,
"message": "The sessionKey could not be validated."
}
Codes Used
The following codes are used within the ZeKju API. Other codes may occur aswell.
Code |
Description |
01007 | privilege_not_granted |
0B000 | invalid_session_initiation |
22004 | null_value_not_allowed (some parameter is empty but required) |
22023 | invalid_parameter_value |
28P01 | invalid_password |
42501 | insufficient_privilege |
42701 | duplicate_column |
42809 | wrong_object_type |
42883 | undefined_function |
P0002 | no_data_found |
XX000 | internal_error (unknown exception) |
Authentification
The authentification methods include Login, Logout and Validate. For most of all other methods provided by the API a SessionKey is required which can be retrieved via Login method. In special cases the predefined SessionKey
anonymous
can be used.
For mobile devices, a DeviceToken can be supplied. If a DeviceToken is supplied, the SessionKey will be valid for a longer period and some methods will contain fewer information.
Note
If a DeviceToken is supplied in the Login method, the DeviceToken has to be supplied in all subsequent method calls.
Login
HTTP Request
POST https://api.zekju.co/auth/login/
HTTP Parameters
Parameter |
Description |
Username | The username to be validated. Digital Master Minds uses the e-mail address as the username. |
Password | Clear text password to be validated. |
DeviceToken | Optional Parameter supplied in the Header. |
Response
A simple object containing the SessionKey.
Example Call
curl "https://api.zekju.co/auth/login/" -X POST -d "Username=Username" -d "Password=password"
Example Call for mobile devices
curl "https://api.zekju.co/auth/login/" -X POST -H "DeviceToken: 00:ab:cd:ef:12:34:56" -d "Username=Username" -d "Password=password"
Example Result
{
"SessionKey": "0123456789ABCDEF"
}
Logout
HTTP Request
POST https://api.zekju.co/auth/logout/
HTTP Parameters
A valid SessionKey must be supplied.
Response
A simple object containing the result.
Example Call
curl "https://api.zekju.co/auth/logout/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"Success": true
}
Validate
HTTP Request
POST https://api.zekju.co/auth/validate/
HTTP Parameters
A valid SessionKey must be supplied. The
anonymous
SessionKey can be used for this call.
Response
A simple object containing the result as a success bool and in cas of success the UserId associated with this session.
Example Call
curl "https://api.zekju.co/auth/validate/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"Success": true,
"UserId": 118586315118453611
}
TransferObject
Attributes |
id | unsigned int 64 | ID of the object |
type_id | unsigned int 64 | Object type ID |
definition | json object | Key/Value pairs of the attributes. Always includes "parent_id" and "owner". |
permissions | array of permission | Array of permission objects, containing the "name" of the permission as a string and the "permitted" attribute as a boolean. |
attribute_permissions | array of attribute permission | Array of attribute permission objects. Each attribute permission includes the "name" (string), "can_read" (boolean) and "can_update" (boolean). |
Example
{
"id": 125609740326667984,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}
Filter
Attributes |
order | object (Can be null) |
attribute | string | The attribute to order by. |
direction | string | The direction to order by. Can be either "ASC" or "DESC" . |
count | object (Can be null) |
count | int | The maximum number of items to return. |
offset | int | The number of items to omit. |
constraints | ConditionList object (Can be null) |
join | string | Can be "AND" or "OR" . |
conditions | Array of Condition | |
lists | ConditionList | Additional ConditionList objects can be encapsulated here. |
Condition
Attributes |
attribute | string | The attribute to filter by. |
type | int | The operator to use. The operator is encoded based on the following values:
1 : Equal
2 : Not equal
3 : Bigger than
4 : Lower than
5 : Is null
6 : Is not null
7 : In list (values should be comma separated)
8 : Between (the two values have to be separated by "|")
9 : Value is like (case insensitive regular expression match)
10 : Bigger than or equal
11 : Lower than or equal
|
value | string | The value used to filter by. |
Example
{
"order": {
"attribute": "msisdn",
"direction": "ASC"
},
"count": {
"count": 30,
"offset": 0
},
"constraints": {
"join": "AND",
"conditions": [{
"attribute": "msisdn",
"type": 1,
"value": "1234567"
}, {
"attribute": "ismi",
"type": 9,
"value": "234"
}],
"lists": []
}
}
Translated to (Postgre-)SQL this would be the following expression:
SELECT ... WHERE (msisdn='1234567' AND 'imsi'~*'234') ORDER BY msisdn ASC NULLS LAST LIMIT 30 OFFSET 0;
ObjectDescription
Attributes |
id | unsigned int 64 | ID of the object type |
name | string | The name used in most of the calls |
recoverable | boolean | Defines if an object is really dropped in the delete method, or only marked as deleted |
managed_object | boolean | If an object is unmanaged, it cannot hold privileges, the privileges are than defined by the direct parent |
readable_attributes | array of string | Array of all attributes the specified user can read. This does not mean that any of the attributes is readable on every object, but at least on one. |
writeable_attributes | array of string | Array of all attributes the specified user can update. This does not mean that any of the attributes is updateable on every object, but at least on one. |
privileges | array of string | Array of all privileges that are granted for that object type. This does not mean that every object of the specified type has all the privielges. |
parent_object_types | array of int 64 | Array of object type ids that can be a parent for the specified object type. Can be the object type itself. |
Example
{
"id": 112776158021420064,
"name": "acl_lang",
"recoverable": true,
"managed_object": true,
"readable_attributes": ["DecimalPoint", "FilesystemDate", "LongDate", "Name", "ShortCode", "ShortDate", "ShortTime", "ThousandSeparator"],
"writeable_attributes": null,
"privileges": ["create", "delete", "read", "set privilege", "undelete", "update"],
"parent_object_types": [112687999665308673]
}
Report
Attributes |
Aggregation | Array of objects (Can be null) |
Function | string | The aggregation function to use. Can be either "SUM" , "AVG" or "COUNT" . |
Attribute | string | The attribute to aggregate. |
Group | Array of objects (Can be null) |
Function | string | Can be null or an attribute type specific function, e.g. "DATE_TRUNC:DAY" . |
Attribute | string | The attribute to group by. |
Orientation | string | Can be either "horizontal" or "vertical" . |
Example
{
"Aggregation": [{
"Function": "SUM",
"Attribute": "Price"
}, {
"Function": "COUNT",
"Attribute": "Price"
}],
"Group": [{
"Function": null,
"Attribute": "Choice",
"Orientation": "vertical"
}, {
"Function": null,
"Attribute": "SaleStatusId",
"Orientation": "horizontal"
}]
}
ReportResult
Attributes |
Axis | Array of objects (Can be null) |
Dimension | int | The dimension of the axis startint at 0 . |
Attributes | Array of Attribute | |
Data | Array of objects (Can be null) |
Coordinates | Array of int | Coordinates in all dimensions. For three dimensional reports the format is [0, 4, 2] . |
Value | anytype | The value at the forementioned Coordinates. |
Attribute
Attributes |
Key | string | The attribute name. |
Value | anytype | Value for this group, e.g. 1 for a product choice or "Coca Cola" for a product name |
Privileges | string | Always an empty string. |
Example
{
"Axis": [{
"Dimension": 0,
"Attributes": [
{
"Key": "Choice",
"Value": 1,
"Privileges": ""
},
{
"Key": "Choice",
"Value": 2,
"Privileges": ""
},
{
"Key": "Choice",
"Value": 3,
"Privileges": ""
},
{
"Key": "Choice",
"Value": 4,
"Privileges": ""
}
]
}, {
"Dimension": 1,
"Attributes": [
{
"Key": "SaleStatusId",
"Value": 141024786821154052,
"Privileges": ""
}
]
}, {
"Dimension": 2,
"Attributes": [
{
"Key": "Price",
"Value": "SUM",
"Privileges": ""
},
{
"Key": "Price",
"Value": "COUNT",
"Privileges": ""
}
]
}],
"Data": [
{
"Coordinates": [0, 0, 0],
"Value": 2.5
},
{
"Coordinates": [0, 0, 1],
"Value": 1
},
{
"Coordinates": [1, 0, 0],
"Value": 2
},
{
"Coordinates": [1, 0, 1],
"Value": 1
},
{
"Coordinates": [2, 0, 0],
"Value": 2
},
{
"Coordinates": [2, 0, 1],
"Value": 1
},
{
"Coordinates": [3, 0, 0],
"Value": 2
},
{
"Coordinates": [3, 0, 1],
"Value": 1
},
{
"Coordinates": [4, 0, 0],
"Value": 2
},
{
"Coordinates": [4, 0, 1],
"Value": 1
}
]
}
ACE
Attributes |
trustee | unsigned int 64 | The trustee ID (user or user group) this ACE belongs to. |
entity | unsigned int 64 | The entity ID (any managed object) this ACE belongs to. |
role | unsigned int 64 | The assigned role ID. |
Example
{
"trustee": 112718986981934095,
"entity": 125133518824015550,
"role": 112711190903260171
}
Create
The create method creates a single object encoded as a
TransferObject. A valid SessionKey must be supplied.
HTTP Request
POST https://api.zekju.co/create/{ObjectTypeName}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
HTTP body | JSON definition of the object to create. |
The body of the HTTP POST call has to include a JSON definition of the object. If the attribute "parent_id" is omitted, a default parent is automatically chosen based on privileges, otherwise the API tries to create the object within the given parent.
Response
A
TransferObject is returned if the object was successfully created and is accessible by the user.
Example Call
curl "https://api.zekju.co/create/sim/" -X POST -H "SessionKey: 0123456789ABCDEF" -d '{"imsi": "214074300078189", "iccid": "8934071100289374062", "msisdn": "345901000303208", "parent_id": 112728507255096337}'
Example Result
{
"id": 278162214848824644,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true },
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}
Delete/Undelete
The Delete method deleted a single object or marks it as deleted (which is the default behaviour) so it can be recovered. The Undelete method on the other hand recovers a single object that was marked as deleted. A valid SessionKey must be supplied.
Warning
As soon as an object is marked as deleted, it cannot be retrieved by functions like "List" or "Get", thus the object cannot be recovered if the ID of the object is not stored somewhere else. If you lose the ID, you cannot recover the object nor will you ever find it again with the methods provided by this API.
HTTP Request
GET https://api.zekju.co/delete/{ObjectTypeName}/{ObjectId}/
GET https://api.zekju.co/undelete/{ObjectTypeName}/{ObjectId}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
ObjectId | Object ID (unsigned int 64) |
Response
A JSON object containing the key
result
which is either
true
or
false
.
Example Call
curl "https://api.zekju.co/delete/machine/125752076205557483/" -X POST -H "SessionKey: 0123456789ABCDEF"
curl "https://api.zekju.co/undelete/machine/125752076205557483/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"result": true
}
Describe
The Describe method returns all object types a user can access, including the attributes as an array of
ObjectDescription. A valid SessionKey must be supplied.
HTTP Request
GET https://api.zekju.co/describe/
Response
A list of object descriptions is returned.
Application Note
The description should be dynamically updated at every client software restart and with every new user session. It should definitely not be hard-coded in the client software, since the attributes of objects can appear and disappear every now and then.
Though it would be possible to update the object description on every client call, this would slow down the frontend experience and should only be used during development if necessary.
Example Call
curl "https://api.zekju.co/describe/" -X GET -H "SessionKey: 0123456789ABCDEF"
Example Result
[
{
"id": 112776158021420064,
"name": "acl_lang",
"recoverable": true,
"managed_object": true,
"readable_attributes": ["DecimalPoint", "FilesystemDate", "LongDate", "Name", "ShortCode", "ShortDate", "ShortTime", "ThousandSeparator"],
"writeable_attributes": null,
"privileges": ["create", "delete", "read", "set privilege", "undelete", "update"],
"parent_object_types": [112687999665308673]
},
{
"id": 122981964696257813,
"name": "zekju_device",
"recoverable": true,
"managed_object": true,
"readable_attributes": ["CurrencyId", "Lat", "Lon"],
"writeable_attributes": null,
"privileges": ["create", "delete", "read", "set privilege", "undelete", "update"],
"parent_object_types": [126435495931545352]
}
]
Get
The Get method retrieves a single object as a
TransferObject. A valid SessionKey must be supplied.
HTTP Request
GET https://api.zekju.co/get/{ObjectTypeName}/{ObjectId}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
ObjectId | Object ID (unsigned int 64) |
Response
A
TransferObject is returned if the object is found and is accessible by the user.
Example Call
curl "https://api.zekju.co/get/machine/125752076205557483/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"id": 125752076205557483,
"type_id": 122981964696257813,
"definition": {
"lat": 52.361158,
"lon": 13.846135,
"owner": 112712829290677262,
"tour_id": 160656280187307311,
"parent_id": 126441830899255055,
"currency_id": 125073342834149021,
"serial_number": "7",
"machine_type_id": 125101559242557107,
"tstamp_last_haccp": null,
"tstamp_next_haccp": null,
"tstamp_last_filling": null,
"tstamp_next_filling": null,
"tstamp_filling_critical": null
},
"permissions": [
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true },
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true }
],
"attribute_permissions": [
{ "name": "tour_id", "can_read": true, "can_update": true },
{ "name": "lon", "can_read": true, "can_update": true },
{ "name": "machine_type_id", "can_read": true, "can_update": true },
{ "name": "currency_id", "can_read": true, "can_update": true },
{ "name": "serial_number", "can_read": true, "can_update": true },
{ "name": "tstamp_next_filling", "can_read": true, "can_update": true },
{ "name": "tstamp_next_haccp", "can_read": true, "can_update": true },
{ "name": "tstamp_last_haccp", "can_read": true, "can_update": true },
{ "name": "tstamp_filling_critical", "can_read": true, "can_update": true },
{ "name": "lat", "can_read": true, "can_update": true },
{ "name": "tstamp_last_filling", "can_read": true, "can_update": true }
]
}
Move
The Move method moves a single object to a new parent container object. The user needs to have the "update" privilege for the object to be moved and the "create" privilege at the new container element for objects of the given type. A valid SessionKey must be supplied.
HTTP Request
GET https://api.zekju.co/move/{ObjectTypeName}/{ObjectId}/{ParentObjectTypeName}/{ParentId}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
ObjectId | Object ID (unsigned int 64) |
ParentObjectTypeName | Name of the container type, e.g. "customer" or "container". |
ParentId | ID of the new parent container (unsigned int 64) |
Response
A JSON object containing the key
result
which is either
true
or
false
.
Example Call
curl "https://api.zekju.co/move/device/125752076205557483/customer/125133518824015550/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"result": true
}
Update
The Update method sets all given attributes of a single object that has to encoded as the "Definition" part of a
TransferObject. A valid SessionKey must be supplied.
HTTP Request
POST https://api.zekju.co/update/{ObjectTypeName}/{ObjectId}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
ObjectId | Object ID (unsigned int 64) |
HTTP body | JSON definition of the object to create. |
The body of the HTTP POST call has to include a JSON definition of the object. If the attribute "parent_id" is set, it will be discarded.If you want to change that, please refer to the "Move" Method instead.
You do not need to supply all attributes of the object. If you only want to change a single attribute value, you can supply just this part of the definition.
Response
A
TransferObject is returned if the object was successfully updated and is accessible by the user.
Note
It is possible (and very unlikely) to grant users the privilege to update a single object, but not to read it. Since the update method tries to read the same object after updating it, the specific error code 01007
will be thrown which does not occur within the update method. Although an error code is return, if this special error code is returned, the update worked as expected.
Example Call
curl "https://api.zekju.co/update/sim/262079543555130638/" -X POST -H "SessionKey: 0123456789ABCDEF" -d '{"imsi": "214074300078189", "iccid": "8934071100289374062"}'
Example Result
{
"id": 262079543555130638,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true },
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}
List
The list method retrieves multiple objects in a data structure containing
TransferObjects. A valid SessionKey must be supplied.
HTTP Request
GET https://api.zekju.co/list/{ObjectTypeName}/
If a filter, a specific order or a limit shall be supplied, they have to be encoded in a JSON
Filter object and this has to be transmitted via HTTP POST like in the following example:
HTTP Request
POST https://api.zekju.co/list/{ObjectTypeName}/ -d 'filter={"count": {"count": 30,"offset": 0}}&return_privileges=true&return_attribute_privileges=false'
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
return_privileges | Optional Determines if privileges for each listed object should be returned. Default value if omitted is true . |
return_attribute_privileges | Optional Determines if privileges for each attribute of each listed object should be returned. Default value if omitted is true . |
Response
A data structure containing an array of
TransferObject is returned.
Example Call
curl "https://api.zekju.co/list/sim/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"filtered_record_count": 4,
"limited_record_count": 4,
"total_record_count": 4,
"transfer_objects": [
{
"id": 125609740326667984,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}, {
"id": 262079543555130638,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}, {
"id": 262082079255168271,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}, {
"id": 262082196217529616,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}]
}
DeleteMany
If many objects should be deleted and the ObjectIds of all of them are known, the DeleteMany method deletes multiple objects. A valid SessionKey must be supplied.
HTTP Request
POST https://api.zekju.co/deletemany/{ObjectTypeName}/ -d 'ids=[12345679012345, 543210987654321]'
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
Response
A JSON array with the ObjectId as a key and a boolean result of the delete operation for this specific object.
Example Call
curl "https://api.zekju.co/deletemany/sim/" -X POST -H "SessionKey: 0123456789ABCDEF" -d 'ids=[140999485865067647, 140999485865067648]'
Example Result
{
"140999485865067647": true,
"140999485865067648": true
}
GetContainer
This method can be used to obtain the Ids of all containers that offer a special privilege. Most often it is used to find all containers in which a specific object can be created. A valid SessionKey must be supplied.
Application Note
This method call is several times faster than a list call without a filter and should be used when possible.
HTTP Request
GET https://api.zekju.co/getcontainer/{ObjectTypeName}/{Privilege}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
Privilege | Name of the privilege, e.g. "create", "delete" or "set privilege". |
Response
A data structure containing an array of unsigned int 64 is returned.
Example Call
curl "https://api.zekju.co/getcontainer/machine/create/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
[
"112728507255096337",
"125133518824015550",
"125638697029732054",
"168311186373215547",
"168311578272204095"
]
GetMany
If many objects should be returned and the ObjectIds of all of them are known, the GetMany method retrieves multiple objects in a data structure containing
TransferObjects. A valid SessionKey must be supplied.
HTTP Request
POST https://api.zekju.co/getmany/{ObjectTypeName}/ -d 'ids=[12345679012345, 543210987654321]'
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
return_privileges | Optional Determines if privileges for each listed object should be returned. Default value if omitted is true . |
return_attribute_privileges | Optional Determines if privileges for each attribute of each listed object should be returned. Default value if omitted is true . |
Response
A data structure containing an array of
TransferObject is returned.
Example Call
curl "https://api.zekju.co/getmany/sim/" -X POST -H "SessionKey: 0123456789ABCDEF" -d 'ids=[125609740326667984, 262079543555130638]&return_privileges=true&return_attribute_privileges=true'
Example Result
{
"filtered_record_count": null,
"limited_record_count": null,
"total_record_count": null,
"transfer_objects": [
{
"id": 125609740326667984,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}, {
"id": 262079543555130638,
"type_id": 122981964696257802,
"definition": {
"imsi": "214074300078189",
"iccid": "8934071100289374062",
"owner": 112712829290677262,
"msisdn": "345901000303208",
"parent_id": 112728507255096337
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": [
{ "name": "msisdn", "can_read": true, "can_update": true },
{ "name": "imsi", "can_read": true, "can_update": true },
{ "name": "iccid", "can_read": true, "can_update": true }
]
}]
}
GetStructure
Objects like UserGroup or Container are organized in a tree structure by referencing each other in the "ParentId" field. To show such a tree structure, it is often sufficient to display the first two or three levels with full data and to load all the other data later on (if the user wishes so).
The GetStructure call can be used to obtain such a structure for a single ObjectType. A data structure containing
TransferObjects is returned. A valid SessionKey must be supplied.
Application Note
This method call is several times faster than a list call without a filter. If a tree view has to be implemented on a client, it is recommended to retrieve the whole structure by calling GetStructure and to fill only the items on the first 2 levels by calling GetMany on those items.
HTTP Request
GET https://api.zekju.co/getstructure/{ObjectTypeName}/
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
Response
A data structure containing an array of
TransferObject is returned. Each object definition only consists of the attributes "id" and "parent_id".
Example Call
curl "https://api.zekju.co/getstructure/user_group/" -X POST -H "SessionKey: 0123456789ABCDEF"
Example Result
{
"filtered_record_count": 4,
"limited_record_count": 4,
"total_record_count": 4,
"transfer_objects": [
{
"id": 112718986981934095,
"type_id": 112688519616398340,
"definition": {
"id": 112718986981934095,
"parent_id": null
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": null
}, {
"id": 112719400649360400,
"type_id": 112688519616398340,
"definition": {
"id": 112719400649360400,
"parent_id": 112718986981934095
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": null
}, {
"id": 168320932811638127,
"type_id": 112688519616398340,
"definition": {
"id": 168320932811638127,
"parent_id": 112718986981934095
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": null
}, {
"id": 168354171068614124,
"type_id": 112688519616398340,
"definition": {
"id": 168354171068614124,
"parent_id": 183609477361042989
},
"permissions": [
{ "name": "update", "permitted": true },
{ "name": "undelete", "permitted": true },
{ "name": "read", "permitted": true },
{ "name": "delete", "permitted": true },
{ "name": "set privilege", "permitted": true }
],
"attribute_permissions": null
}]
}
UpdateMany
If many objects should be updated at once and the ObjectIds of all of them are known, the UpdateMany method manipulates multiple objects. This method only takes one object definition, thus making this method only useful for mass updates of connected fields or similar use cases. A valid SessionKey must be supplied.
HTTP Request
POST https://api.zekju.co/updatemany/{ObjectTypeName}/ -d 'ids=[{ObjectIds}]&definition={ObjectDefinition}'
HTTP Parameters
Parameter |
Description |
ObjectTypeName | Name of the object type, e.g. "user" or "machine". |
ObjectIds | Object IDs (unsigned int 64). |
ObjectDefinition | JSON definition of the attributes to update. |
Response
A JSON array with the ObjectId as a key and a boolean result of the delete operation for this specific object.
Example Call
curl "https://api.zekju.co/updatemany/machine/" -X POST -H "SessionKey: 0123456789ABCDEF" -d 'ids=[140999485865067653, 140999485865067654, 140999485865067700]&definition={"machine_type_id":"151356846445135"}'
Example Result
{
"140999485865067653": true,
"140999485865067654": true,
"140999485865067700": true
}
Introduction
The privilege system is role based. A role defines which privileges a user has for an object an also which attribute privileges a user has. Privileges are usually the following:
Privilege |
ID |
Explanation |
read | 112691372632310789 | This privilege is needed for list, get and report operations |
update | 112691389619241990 | This privilege is needed for update and move operations |
create | 112691403183621127 | This privilege is needed for create operations |
delete | 112691418098566152 | This privilege is needed for delete operations |
undelete | 112691431151240201 | This privilege is needed for undelete operations |
set privilege | 112691443776095242 | This privilege is needed for ACE set/delete and ACL set/delete operations |
Some object types may have less privileges (for example a sale object can only have a "read" privilege) or more (the "tour" object has a "plan" privilege that allows certain roles to plan a tour).
Attribute privileges on the other hand are only "read" and "update".
Summary
A role defines, what you can do with objects whenever you assume that role.
Defining roles
- ListRoleAttributes
- ListRolePrivileges
- SetRoleAttributes
- SetRolePrivileges
- DeleteRoleAttributes
- DeleteRolePrivileges
Users and user groups
ACE
- ListObjectAce
- SetObjectAce
- DeleteObjectAce
ACE
An ACE assigns a role to a trustee (user or user group) for a specific entity (or object). This role is inherited to all descendant objects.
ACEs can be listet ("get" method), set ("set" method) and deleted ("delete" method). No special privileges are required to list ACEs, since they only consist of IDs, but to set and delete them, the special "set privilege" privilege on the entity is required. A valid SessionKey is required nevertheless.
Get
HTTP Request
POST https://api.zekju.co/ace/get/
HTTP Parameters
Parameter |
Description |
entity | Optional If an entity ID is supplied, only ACEs for this specific entity are listed. |
trustee | Optional If a user ID is supplied, only ACEs for this user including all user groups the user is a member of, are listed. If a user group ID is supplied, only ACEs for this user group and its predecessors are listed. |
Response
A list of ACE objects.
Example Call
curl "https://api.zekju.co/ace/get/" -X POST -H "SessionKey: 0123456789ABCDEF" -d "entity=183694398704321835"
Example Result
[{
"trustee": 112718986981934095,
"entity": 125133518824015550,
"role": 112711190903260171
}, {
"trustee": 183694398704321835,
"entity": 183609326257047075,
"role": 112711742840112140
}]
Set
The set method creates a new
ACE entry or updates an existing one if the role differs. A valid SessionKey must be supplied.
You cannot set an ACE for yourself, thus the entity cannot be the user that created the session. You also need to have the "set privilege" privilege for the entity.
HTTP Request
POST https://api.zekju.co/ace/set/
HTTP Parameters
Parameter |
Description |
HTTP body | JSON definition of the ACE object to create. |
Response
A JSON object containing the key
result
which is either
true
or
false
.
Example Call
curl "https://api.zekju.co/ace/set/" -X POST -H "SessionKey: 0123456789ABCDEF" -d '{"trustee": 112718986981934095, "entity": 125133518824015550, "role": 112711190903260171}'
Example Result
{
"result": true
}
Delete
The set method deletes an
ACE entry. A valid SessionKey must be supplied.
You cannot delete an ACE for yourself, thus the entity cannot be the user that created the session. You also need to have the "set privilege" privilege for the entity.
HTTP Request
POST https://api.zekju.co/ace/delete/
HTTP Parameters
Parameter |
Description |
entity | The entity ID for which the ACE shall be deleted. |
trustee | The ID of the trustee (user or user group) for which the ACE shall be deleted. |
Response
A JSON object containing the key
result
which is either
true
or
false
.
Example Call
curl "https://api.zekju.co/ace/delete/" -X POST -H "SessionKey: 0123456789ABCDEF" -d "entity=183694398704321835" -d "trustee=112718986981934095"
Example Result
{
"result": true
}
badge
Badges can be displayed on the home page and are mostly charts or statistical values. Every badge has it's own data format, but the call is identical for all of them.
GetBadgeData
Returns the data for a spcific badge.
HTTP Request
POST https://api.zekju.co/call/badge/getbadgedata/{ObjectId} -H "SessionKey: 0123456789ABCDEF"
HTTP Parameters
Parameter |
Description |
--- | --- |
Response
For every badge the result will differ, but every badge returns the statistics within the definition part of a TransferObject.
Example Result
{
"id": 690859950942979216,
"type_id": 112776407473456161,
"definition": {
4: 12490
}
}