Artificial Intelligence supported Tool Chain in Manufacturing Engineering

Active registry API documentation


Request to active registry must be done to the https://active-registry.aitoc.eu/api.php endpoint. All requests have to be sent as either POST or GET requests, where input data is represented as http form data.
1. In each request the following fields are required 2. As a response to such request JSON response is to be expected. In case of successful response JSON structure representing specific requested data is provided, on failure the following response will be provided indicating where did the error originate from: 3. It can be assumed that the response JSON field names are starting in lower case and are written in camelCase format.
4. Currently supported requests actions and JSON body format provided as response are described below.
action: "listUsers"
Example response:
[{"id":"1",
  "name":"Peter Johnes",
  "email":"peter.johnes@my-email.com",
  "enabled":true},
 {"id":"2",
  "name":"John Doe",
  "email":"john.doee@protonmail.com",
  "enabled":false}]


Response is an array filled with records describing individual users:
  • id - unique user id that can be used to share project, file, or data set with specific user,
  • name - name for the user
  • email - email address of the user that is unique within the users on specific server
  • enabled - boolean value indicating if the user account is enabled, if false then the user cannot log in or perform any actions.
action: "listUsersInProject"
Additional parameters needed:
  • project: "project id"
Example response:
[{"id":"1",
  "name":"Peter Johnes",
  "email":"peter.johnes@my-email.com",
  "enabled":true,
  "owner":true,
  "modify":true,
  "create":true,
  "delete":true
  },
 {"id":"2",
  "name":"John Doe",
  "email":"john.doee@protonmail.com",
  "enabled":false,
  "owner":false,
  "modify":false,
  "create":true,
  "delete":true
  }]


Response is an array filled with records describing individual users that have at least one active right in the project:
  • id - unique user id that can be used to share project, file, or data set with specific user,
  • name - name for the user
  • email - email address of the user that is unique within the users on specific server
  • enabled - boolean value indicating if the user account is enabled, if false then the user cannot log in or perform any actions.
  • owner - boolean indicating if the record corresponds to the project owner user. By default owner has all the rights in the project.
  • modify - grants user right to modify any existing files and tables in the project, does not allow user to create new files or tables,
  • create - grants user right to create new content (files, tables) but does not allow to modify exiting data
  • delete - grants user deleting content (rows in tables, whole tables, files)
To get information about specific user rights in a project for a single user use action getUserPrivilegesInProject instead.
action: "setUserProjectOrder"
Additional parameters needed:
  • projectsorder: array of project ids ordered according to user's preference
Example response:
 { "action":"reorderUserProjects",
   "error":0,
   "errorMessage":"User projects have been reordered"}


Response is a confirmation or error message. If project ids provided in the projectsorder array are not within user scope an appropriate error message will be returned.
action: "showHideUserProject"
Additional parameters needed:
  • project: project id,
  • show: boolean (0/1/true/false) value whether to show or not project on a user's project list
Example response:
 { "action":"showHideUserProject",
   "error":0,
   "errorMessage":"User project's visibility has been saved."}


Response is a confirmation or error message. If project id is incorrect or show value is missing or ill formatted an error will be returned.
action: "editProject"
Additional parameters needed (_optional parameters are shown in italic_):
  • project: project id,
  • _description_: text description of a project
  • _name_: project name
  • _owner_: project owner id
  • _img_: image file of the project icon
Example response:
 { "action":"editProject",
   "error":0,
   "errorMessage":"Project has been updated."}


Response is a confirmation or error message. If project id is incorrect or parameter value is incorrect, a proper error message will be shown. Only one of the parameters marked in italic beyond project is required, user might however specify any number of the optional parameters that require changing. This makes this call flexible as it can be used to update individual values of project description or update the whole or part of the description in one call.
action: "getUserPrivilegesInProject"
Additional parameters needed:
  • project: "project id"
  • userid: "user id"
Example response:
 {"modify":true,
  "create":false,
  "delete":true,
  }


Response is an object containing user privileges in the project:
  • modify - grants user right to modify any existing files and tables in the project, does not allow user to create new files or tables,
  • create - grants user right to create new content (files, tables) but does not allow to modify exiting data
  • delete - grants user deleting content (rows in tables, whole tables, files)
If user does not have any rights in the project following response will be returned:
{"action":"getUserPrivilegesInProject",
 "error":61,
 "errorMessage":"User does not have any rights in the selected project"}


action: "addUserToProject"
Additional parameters needed:
  • project: "project id"
  • userid: "user id"
Optional parameters:
  • modify: true
  • create: false
  • delete: true
Example response:
 {"action":"addUserToProject",
  "error":0,
  "message":"User has been added to the project as a member"}


Adding user to a projet without specyfying or setting optional parameters to false will give user read-only access. Meaning of the optional parameters is as follows:
  • modify - grants user right to modify any existing files and tables in the project, does not allow user to create new files or tables,
  • create - grants user right to create new content (files, tables) but does not allow to modify exiting data
  • delete - grants user deleting content (rows in tables, whole tables, files)
If user is already a project member the following error will be returned:
{"action":"addUserToProject",
 "error":12,
 "errorMessage":"User could not be added to the project"}


action: "modifyUserRightsInProject"
Additional parameters needed:
  • project: "project id"
  • userid: "user id"
Optional parameters:
  • modify: true
  • create: false
  • delete: true
Example response:
{"action":"modifyUserRightsInProject",
 "error":0,
 "message":"User rights have been updated in the project"}


It is important to note that this action will not create user rights in the project if they have not been added using addUserToProject action first. Consequently if user is not a project member his rights cannot be modified. Modyfying user to a projet without specyfying or setting optional parameters to false will give user read-only access. Meaning of the optional parameters is as follows:
  • modify - grants user right to modify any existing files and tables in the project, does not allow user to create new files or tables,
  • create - grants user right to create new content (files, tables) but does not allow to modify exiting data
  • delete - grants user deleting content (rows in tables, whole tables, files)
If userid specified is inactive or outside existing users list the following error will be returned:
{"action":"modifyUserRightsInProject",
 "error":30,
 "errorMessage":"Userid parameter needs to be specified and needs to be integer corresponding to existing and active user account."}


action: "removeUserFromProject"
Additional parameters needed:
  • project: "project id"
  • userid: "user id"
Example response:
{"action":"removeUserFromProject",
 "error":0,
 "message":"User has been removed from the project"}


Removes all user rights from project.
If userid specified is inactive or outside existing users list the following error will be returned:
{"action":"modifyUserRightsInProject",
 "error":30,
 "errorMessage":"Userid parameter needs to be specified and needs to be integer corresponding to existing and active user account."}


action: "addUser"
Additional parameters needed:
  • newEmail: "users e-mail used as login"
  • newName: "users name used to describe user"
  • newPass: "password for the user"
Example response:
{"action":"addUser",
 "error":0,
 "message":"User account has been created"
 "userid": 20}


If as newPass parameters "generate" string is provided the password will be randomly generated and returend as additional password field in the response like:
{"action":"addUser",
 "error":0,
 "message":"User account has been created",
 "password": "1234567abc",
 "userid": 20}


Creates user in the system. The user by default has no projects but has right to create a project for which he becomes owner and can grant rights on the project. Userid is returned as part of the success message.
If user e-mail is already existing in the database the following error message is returned:
{"action":"addUser",
 "error":72,
 "errorMessage":"User account associated with the email provided already exists. Use another e-mail."}


If user password does not comply with the password requirements the following error is returned:
{"action":"addUser",
 "error":71,
 "errorMessage":"Password does not meet requirements. Password should be at least 8 characters long."}


action: "listProjects"
Example response:
[{"id":"2",
 "name":"Project name",
 "description":"Description of the project, that might contain multi-line text",
 "owner":"1",
 "creator":"1",
 "modify":true,
 "create":true}]


Array is returned containing individual project details that user has access to.
  • id is the project id that is unique and is used to request project specific data
  • description is a human readable description of the project that can be multi-line text.
  • owner - is the user id that owns the project (owner can be changed at any time)
  • creator - is the user id that has created the project (this is set just once and is unchangeable)
  • modify - boolean value indicating if the logged in user has rights to modify project content that is already in the project
  • create - boolean value indicating if the user can create elements within project content (tables or files, folders)
action: "addProject"
Additional parameters needed:
  • projectName: "New project name"
Optional parameters:
  • description: "Human readable description or remarks about the project"
Example response:
{"action":"addProject",
 "error":0,
 "message":"Project has been created",
 "name":"Api project v2",
 "description":"Another long description of the project",
 "owner":1,
 "projectid":55}


Single element is returned, on failure error is returned, on success error field is equal to zero, and additional message is provided as response that can be shown to the user. The positive response also contains project name as specified in the request, description, owner user id, and projectid field that is equal to the new project id.
action: "listFiles"
Additional parameters needed:
  • project: ProjectId
Optional parameters:
  • path: "directory path to the files"
Example response
[{"path": "Path With www\/20220920_152116.jpg",
  "lastModified":"2023-02-21T19:38:41+00:00",
  "size":"2032600"},
 {"path":"clipv1.gltf",
  "lastModified":"2023-03-16T13:36:27+00:00",
  "size":"87942"}]


If path is specified as parameter, then only files within the specified path will be returned. Array is returned as a result containing file details:
  • path - full file path
  • lastModified - date of last file modification
  • size - file size
action: "listTables"
Additional parameters needed:
  • project: ProjectId
Example response
[{"id":"1",
  "name":"temperature",
  "description":""},
 {"id":"2",
  "name": "humidity",
  "description":"Humidity measurements in warehouse 1"},
 {"id":"5",
  "name":"MyTable",
  "description":"Test data table with time series data"}]


Returned data is in array, individual entries comprise of the 3 fields:
  • id - unique table identifier that can be used to fetch or store data in a table
  • name - name for the table - it does not have to be unique within a project, tables with same name are allowed
  • description - description of table content or other user notes about data set
action: "putFile"
This action required the request to be POST mulipart data form.
Additional parameters needed:
  • project: "project id where file should be added"
  • newFile: "file content"
Optional parameters:
  • folder: "path/to/file/on/the/server"
Example response on success:
 {'action': 'putFile', 
  'error': 0, 
  'message': 'File picture.jpg uploaded successfully'}


If file is identical to existing file version on the server then the following response will be returned:
{'action': 'putFile',
 'error': 0,
 'message': 'Success: File did not change since the last upload'}


action: "putJSONasFile"
This action puts content provided as newFile request parameter to file located at selected folder and name. It is intended for mostly text files, json encoded or xml data. It is not best suited for binary data if it is not properly encoded.
Additional parameters needed:
  • project: "project id where file should be added"
  • newFile: "file content"
  • name: "file name"
Optional parameters:
  • folder: "path/to/file/on/the/server"
Example response on success:
 {'action': 'putJSONasFile', 
  'error': 0, 
  'message': 'File picture.jpg uploaded successfully'}


If file is identical to existing file version on the server then the following response will be returned:
{'action': 'putJSONasFile',
 'error': 0,
 'message': 'Success: File did not change since the last upload'}


action: "getFile"
Additional parameters needed:
  • project: "project id where file should be added"
  • file: "full server path as returned by listFiles in path field of an entry"
This call returns file for download not a JSON formatted response. On error, for example requesting non-existing file, json-formatted error message will be returned.
action: "deleteFile"
Additional parameters needed:
  • project: "project id from where a file should be removed"
  • name: "full server path as returned by listFiles in path field of an entry"
This call returns JSON formatted response indicating either success or failure. On error, for example requesting non-existing file, json-formatted error message will be returned.
action: "getFileAsJSON"
Request file content as JSON element. It packs content of a text (json, xml, txt, etc.) into a variable of the json response. Should not be used with binary data.
Additional parameters needed:
  • project: "project id where file should be added"
  • file: "full server path as returned by listFiles in path field of an entry"
This call returns JSON formatted response like:
{
    "action": "getFileAsJSON",
    "error": 0,
    "name": "mydata.txt",
    "content": "Content of the text file that is requested\r\nSecond line of the text file"
}


On error, for example requesting non-existing file, json-formatted error message will be returned.
action: "deleteFile"
Additional parameters needed:
  • project: "project id from where a file should be removed"
  • name: "full server path as returned by listFiles in path field of an entry"
This call returns JSON formatted response indicating either success or failure. On error, for example requesting non-existing file, json-formatted error message will be returned.
action: "getTableRows"
Currently this call returns all table rows, parameters allowing to specify range and filters will be added soon.
Additional parameters needed:
  • project: "project id where file should be added"
  • table: "integer table id as returned by listTables in id field of an entry"
Example response:
 [
    {
        "id": "1",
        "val1": "1",
        "val4": true
    },
    {
        "id": "2",
        "val1": "5",
        "val4": true
    },
    {
        "id": "3",
        "val1": "6",
        "val4": false
    }
]


Each row is returned as and object that keys correspond to table column names, and values represent the values for the specific row.
action: "putTableRows"
Additional parameters needed:
  • project: "project id where file should be added"
  • table: "integer table id as returned by listTables in id field of an entry"
  • rows: [{"columnName": "value", "column2Name": "value"},{"columnName": "value1", "column2Name": "value2"}]
Rows need to be JSON array with entries being objects with keys corresponding to column names and values that should be assigned for them for the row. Formatting matches response for getTableRows query with the difference that the id field should not be supplied as it is automatically generated. If id parameter is supplied and is in conflict with existing id error is thrown. If it doesn't conflict existing row id then the query is successful. Each row should contain all columns that are defined in the table for the query to succeed.