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
  • Queries
  • Attributes

Attributes · Changes

Page history
attrs docu authored Jan 25, 2022 by Andrea Pavlovic's avatar Andrea Pavlovic
Show whitespace changes
Inline Side-by-side
API/Queries/Attributes.md
View page @ 68200c02
......@@ -12,7 +12,7 @@ The IronAPI supports these options:
- [(+)as](#select-and-as)
- [order_by](#ordering)
- [group_by](#group-by)
- collapse
- [collapse](#collapse)
- having
......@@ -406,7 +406,7 @@ This will return a list of modules names and how many entites each modules has:
`POST /data/system/module/query`
```
```json
{
"attrs": {
"join": "system__entity__module",
......@@ -447,96 +447,87 @@ A list of how many users have which value in the json attribute `settings->>'en
When "collape" is set to a true value, indicates that any rows fetched from joined has_many relationships
are to be aggregated into the corresponding "parent" object:
Parameters:
## Restrictions
The only valid values are `0` and `1`.
```JSON
### Examples
This fetches all entities and lists them as an array for each module
`POST /data/system/module/query`
```json
{
"attrs" :
{
"collapse": "0",
"join" : ["contracts__working_time_constraint"],
"+columns": ["contracts__working_time_constraint.id"]
"attrs": {
"join": "system__entity__module",
"columns": [
"me.id",
"me.name",
"system__entity__module.id",
"system__entity__module.name"
],
"collapse": 1,
"order_by" : ["me.id","system__entity__module.id"]
}
}
```
Reply:
```JSON
[
```json
{
"data": [
{
"modification_time": "2017-09-20 08:38:17.652733",
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
"instance_entity": "91",
"contracts__working_time_constraint": {
"id": "2"
"name": "system",
"id": 1,
"system__entity__module": [
{
"name": "module",
"id": 2
},
"modifying_action": "325",
"valid_from": "2017-01-05",
"region": "1",
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
"id": "1",
"modifying_client": "1",
"successor": null
{
"name": "entity",
"id": 3
},
{
"modification_time": "2017-09-20 08:38:17.652733",
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
"instance_entity": "91",
"contracts__working_time_constraint": {
"id": "1"
"id": 4,
"name": "attribute"
},
"modifying_action": "325",
"valid_from": "2017-01-05",
"region": "1",
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
"modifying_client": "1",
"id": "1",
"successor": null
}
]
...
```
Parameters:
Without "collapse", there would be an entry for each module+entity combination:
```JSON
```json
{
"attrs" :
"data": [
{
"collapse": "1",
"join" : ["contracts__working_time_constraint"],
"+columns": ["contracts__working_time_constraint.id"]
"id": 1,
"name": "system",
"system__entity__module": {
"id": 2,
"name": "module"
}
}
```
Reply:
```JSON
{
"description": "Kollektivvertrag für Arbeiter im Hotel- und Gastgewerbe abgeschlossen zwischen dem Fachverband Gastronomie und dem Fachverband Hotellerie, beide 1045 Wien, Wiedner Hauptstraße 63, einerseits und der Gewerkschaft vida, 1020 Wien, Johann Böhm-Platz 1, andererseits.",
"valid_from": "2017-01-05",
"region": "1",
"successor": null,
"id": "1",
"modifying_client": "1",
"url": "https://www.wko.at/branchen/tourismus-freizeitwirtschaft/gastronomie/KV-Rahmen_Mai-2017.pdf",
"modification_time": "2017-09-20 08:38:17.652733",
"name": "Kollektivvertrag Arbeiterinnen und Arbeiter im Hotel- und Gastgewerbe",
"instance_entity": "91",
"contracts__working_time_constraint": [
},
{
"id": "1"
"id": 1,
"name": "system",
"system__entity__module": {
"id": 3,
"name": "entity"
}
},
{
"id": "2"
"id": 1,
"name": "system",
"system__entity__module": {
"id": 4,
"name": "attribute"
}
],
"modifying_action": "325"
}
```
},
...
````
Note that "prefetch" is a shortcut for "join", adding all columns from the joined related sources as "+columns" and setting "collapse" to a true value.
......
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