Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • A api
  • Project information
    • Project information
    • Activity
    • Members
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Activity
Collapse sidebar
  • ironapi
  • api
  • Wiki
  • Api
  • Schema_Changes

Last edited by Andrea Pavlovic Aug 31, 2021
Page history
This is an old version of this page. You can view the most recent version or browse the history.

Schema_Changes

THIS IS UNTESTED, WILL BE TESTED WHEN TIME IS AVAILABLE

  • Entity
    • Create Entity
  • Attributes
    • Create Attribute
    • Add "required" for an attribute
    • Drop "required" for an attribute
    • Add Unique Restriction for an entity
  • Agendas
    • Create Agenda
    • Add Action To Agenda
    • Remove Action From Agenda
  • Users
    • Create User
    • Add Agenda To User
    • Add API Key For User

Entity

Create Entity

First, find out the ID of the module you want to create an entity within.

#!json

#/data/system/module/query
{
  "conds": {"me.name":"core"}
}

Then use it to create an entity

#!json

#/data/system/entity/transitions/create
{
    "module" : 12,
    "name" : "test",
    "label" : "test table",
    "description" : "created to test creating",
    "is_successor_not_required" : TRUE,
    "is_translatable" : TRUE,
    "is_functional" : FALSE
}

Then create attributes and add restrictions as shown below.

Attributes

Create Attribute

Example: core.alarm.origin

First, find out ID for the entity

#!json

#/data/system/entity/query
{
  "conds": {"me.name":"alarm","module.name":"core"},
  "attrs": {"join":"module"}
}

Then, find out the ID of the chosen data type

#!json

#/data/constant/data_type/query
{
  "conds": {"me.name":"text"},
}

Then use those to create the attribute

#!json

#/data/system/attribute/transitions/create

{
  "entity": 94,
  "name": "origin",
  "label": "alarm origin",
  "description": "alarm origin",
  "data_type": 3,
  "restriction": null,
  "is_human_readable": true,
  "display_order": 102,
  "is_translatable": false,
  "is_searchable": true,
  "taxonomy": null
}

Add "required" for an attribute

First, define the restriction (using the entity ID, see above how to find it)

#!json

#/data/system/restriction/transitions/create

{
  "entity" : 94,
  "name" : "initial_required_core_alarm_origin",
  "label" : "initial_required_core_alarm_origin",
  "description" : "core.alarm.origin is required"
}

This will return the ID of the newly created restriction - use it to update the attribute

#!json

#/data/system/attribute/transtitions/edit

{
  "id": 123,
  "restriction": 2004
}

Drop "required" for an attribute

Example: core.alarm.external_id

First, find out the id of the attribute and the id of the restriction

#!json

#/data/system/attribute/query
{
  "conds" : {"me.name":"external_id","entity.name":"alarm","module.name":"core"},
  "attrs" : {"join": {"entity":"module"},{"columns":["me.id","me.restriction"]}
}

then update that entry to remove the restriction

#!json

#/data/system/attribute/transition/edit
{
  "id": 123,
  "restriction": null
}

and last, remove the restriction definition

#!json

#/data/system/restriction/555/transitions/delete
{
}

Add Unique Restriction for an entity

First, add a restriction

#!json

#/data/system/restriction/transition/create
{
  "name": "core_sensor_data_key_attributes_key_unique",
  "label": "core_sensor_data_key_attributes_key_unique",
  "description": "core_sensor_data_key_attributes_key_unique",
  "entity": 123
}

then add a uniqueness restriction

#!json

#/data/system/uniqueness_restriction/transition/create
{
  "restriction": 456, #as just created
  "entity": 123
}

then add the attributes to the uniqueness_restriction

#!json

#/data/system/unique_attribute/transition/create
{
  "uniqueness_restriction": 789,
  "entity": 123,
  "attribute" : 888 #id from system.attribute
}

Agendas

Create Agenda

#!json

#/data/system/agenda/transition/create
{
  "name": "mynewagenda",
  "description": "this is a new agenda for accessing the api",
  "binding_entity" : null #unbound example
}

Add Action To Agenda

#!json

#/data/system/agenda_action/transition/create
{
  "agenda" : 4,           #id from system.agenda
  "action" : 23,          #id from system.action
  "binding_entity" : null #unbound example
}

Remove Action From Agenda

#!json

#/data/system/agenda_action/transition/delete
{
  "id" : 24           #id from system.agenda_action

}

Users

Create User

#!json

#/data/system/client/transition/create
{
    "first_name" : "Bettina",
    "last_name" : "Weber",
    "login_name" : "b.weber",
    "password" : "super safe",
    "language" : 1,                 #id from system.language
    "password_validation_period": null,
    "locked": false,
    "number_of_unsuccessfull_login_attempts": null,
    "email" : "bettina@weber.at"

}

Add Agenda To User

#!json

#/data/system/assignment/transition/create
{
    "assigned_client" : 23, #id from system.client
    "agenda" : 5,           #id from system.agenda
    "binding_entity": null  #unbound example
}

Add API Key For User

#!json

#/data/system/assignment/transition/create
{
    "owning_client" : 23,   #id from system.client
    "api_key" : "extra safe"
}
Clone repository
  • API
    • Available Endpoints
    • Changing Passwords
    • Form Input Types
    • Introduction
    • Logout
    • Plugins
    • Queries
    • Queries
      • Attributes
      • Context
      • Query Examples
      • Query Search Options
      • Referenced Instances
      • Saved Queries
    • Schema_Changes
    • Storing Files
View All Pages