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
  • Transitions

Transitions · Changes

Page history
restructure authored May 25, 2021 by Andrea Pavlovic's avatar Andrea Pavlovic
Hide whitespace changes
Inline Side-by-side
API/Transitions.md 0 → 100644
View page @ 1ac51e9a
[[Available-Endpoints]]
TOC
[TOC]
Transitions are data manipulations, so the equivalent to CRUD operations but under the
rules of ACL and workflows. They can be defined either on
* entity level (create type)
* instance level (read, edit and delete types)
# Transitions List
## Entity Transitions List /data/$module/$entity/transitions
[This is available in the universe, we might want to delete this endpoint.]
Returns a list of transitions on the entity which are available according to user's access control.
```
#!json
#/data/system/module/transitions
{
"data": [
{
"modifying_client": 1,
"entity": 63,
"instance_entity": 6,
"binding_entity": null,
"description": "action that creates an instance",
"modifying_action": 13,
"successor": null,
"action_type": 1,
"label": "create",
"id": 218,
"notification": null,
"name": "create",
"modification_time": "2018-04-15 23:18:34.354119"
}
]
}
```
## Instance Transitions List /data/$module/$entity/$instance_id/transitions
Returns a list of transitions which are applicable according to user's access control and the actual state of the instance.
Note: this is an expensive query, do not pre-fetch for lots of instances.
```JSON
#/data/system/entity/1/transitions
{
"data": [
{
"id": 6,
"binding_entity": null,
"modifying_client": 1,
"instance_entity": 6,
"notification": null,
"action_type": 2,
"description": "A transition that modifies an instance",
"modification_time": "2018-12-10 14:27:42.434735",
"modifying_action": 13,
"entity": 3,
"name": "edit",
"label": "edit",
"successor": null
},
{
"successor": null,
"label": "delete",
"name": "delete",
"modification_time": "2018-12-10 14:27:42.43474",
"entity": 3,
"modifying_action": 13,
"action_type": 3,
"description": "A transition that deletes an instance",
"instance_entity": 6,
"notification": null,
"id": 8,
"binding_entity": null,
"modifying_client": 1
}
]
}
```
# Executing Transitions
To call a transition correctly, the correct verb ("invocationVerb") and attributes ("attributes")
are available in the universe .
The example is an add (which is of type create), then an edit and a purge (type delete).
The reply for all but delete types will includes the details of the newly
created / just edited instance. The "meta" information will only be present in debug mode.
```JSON
#POST /data/extensions/query/transitions/add
#{"name":"abc","entity":3, "is_default":false}
{
"data": {
"attrs": null,
"is_valid": true,
"id": 706,
"modifying_client": 1,
"successor": null,
"modification_time": "2018-12-10T16:10:00.586207",
"entity": 3,
"modifying_action": 249,
"name": "abc",
"owning_client": 1,
"is_default": false,
"instance_entity": 62,
"description": null,
"error_log": null,
"conds": null,
"instance_state": 5
},
"meta": {
"generated_query": [
"SELECT * FROM extensions_query_add_json(?::JSON) as result",
"{\"is_default\":false,\"is_valid\":true,\"name\":\"abc\",\"entity\":3}"
]
}
}
```
```JSON
#POST /data/extensions/query/706/transitions/edit
#{"name":"def"}
{
"data": {
"successor": null,
"name": "def",
"owning_client": 1,
"modification_time": "2018-12-10T16:12:31.724033",
"modifying_action": 215,
"entity": 3,
"description": null,
"instance_entity": 62,
"is_default": false,
"error_log": null,
"conds": null,
"instance_state": 5,
"is_valid": true,
"attrs": null,
"id": 706,
"modifying_client": 1
},
"meta": {
"generated_query": [
"SELECT * FROM extensions_query_edit_json(?::JSON) as result",
"{\"id\":\"706\",\"is_valid\":true,\"name\":\"def\"}"
]
}
}
```
```JSON
#DELETE /data/extensions/query/706/transitions/purge
{
"data": null,
"meta": {
"generated_query": [
"SELECT * FROM extensions_query_purge_json(?::JSON) as result",
"{\"id\":\"706\"}"
]
}
}
```
Should the request fail, an error message including a "hint" as to how the request should look like will be returned:
```JSON
#POST /data/extensions/query/transitions/add
#{"name":"abc","entity":3, "is_default":false}
{
"error": {
"uri": "http://localhost:3222/data/extensions/query/transitions/add",
"http_code": 400,
"message": "the database returned an error",
"error": {
"entity": "query",
"module": "extensions",
"involvedAttributes": [
"entity",
"name"
],
"errorDescription": "must_be_unique",
"errorID": "1234",
"errorType": "UNIQUENESS"
},
"db_reply": {
"errorCode": 1234
},
"hint": {
"label": "add",
"requestBody": {
"is_default": "{{is_default}}",
"conds": {},
"owning_client": "{{owning_client}}",
"name": "{{name}}",
"entity": "{{entity}}",
"attrs": {}
},
"category": "create",
"attributes": {
"name": {
"name": "name",
"required": true
},
"conds": {
"name": "conds",
"required": false
},
"owning_client": {
"name": "owning_client",
"required": true
},
"attrs": {
"required": false,
"name": "attrs"
},
"entity": {
"name": "entity",
"required": true
},
"is_default": {
"name": "is_default",
"required": true
}
},
"invocationUrl": "/data/extensions/query/transitions/add",
"preState": null,
"name": "add",
"invocationVerb": "POST",
"postState": "unpublished",
"description": "creates a new quey in the unpublished state",
"requestBodyContentType": "application/json; charset=UTF-8",
"postStateID": "5",
"id": 249,
"preStateID": null
}
}
}
```
# Dereferencing /data/$module/$entity/$instance_id/transitions/$transition/deref
NOT YET DOCUMENTED
\ No newline at end of file
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