Skip to content

Instantly share code, notes, and snippets.

@nimaai
Last active September 10, 2025 12:06
Show Gist options
  • Select an option

  • Save nimaai/ed224a1925fbcd53007c6ad94d525d7a to your computer and use it in GitHub Desktop.

Select an option

Save nimaai/ed224a1925fbcd53007c6ad94d525d7a to your computer and use it in GitHub Desktop.
leihs GET/POST fields/item data structure
// data from GET .../fields?target_type='item|license|package'
{
// this attribute is not needed imho. pool id is in the route path.
// responsible department would be the default value for "inventory_pool_id" field and
// inventory_code could also come as the default value for the respective field.
"data": {
"inventory_pool_id": "8bd16d45-056d-5590-bc7f-12849f034351",
"responsible_department": "8bd16d45-056d-5590-bc7f-12849f034351",
"inventory_code": "P-AUS2008037"
},
// this could also be removed and the end point would serve an array of fields directly (analog to all other resource routes).
"fields": [
{
"id": "inventory_code",
"label": "Inventory Code",
"group": null,
"position": 1,
"type": "text",
"required": true
},
{ "id": "model_id",
"label": "Model",
"group": null,
"position": 2,
"type": "autocomplete-search",
"required": true
"value_attr": "id",
"search_attr": "search_term",
"search_path": "models",
"display_attr": "product",
"display_attr_ext": "version",
"item_value_label": ["model", "product"],
"item_value_label_ext": ["model", "version"]
{
"id": "inventory_pool_id",
"label": "Responsible department",
"group": "Inventory",
"position": 21,
"type": "autocomplete",
"required": true,
"values": [
{ "value": "8bd16d45-056d-5590-bc7f-12849f034351",
"label": "Ausleihe Toni-Areal" },
{ "value": "82a48074-8a4d-5d3b-b1dd-8e35954137e8",
"label": "AVS-Ausstattung" },
{ "value": "c092bbb0-3a12-4412-869f-ea1686bd059f",
"label": "AVS-Dauerausleihen" }
]
},
{
"id": "properties_anschaffungskategorie",
"label": "Beschaffungsgruppe",
"group": "Inventory",
"position": 33,
"type": "select",
"required": true,
"values": [
{"label": "", "value": null},
{"label": "Werkstatt-Technik", "value": "Werkstatt-Technik"},
{"label": "Produktionstechnik", "value": "Produktionstechnik"},
{"label": "AV-Technik", "value": "AV-Technik"},
{"label": "Musikinstrumente", "value": "Musikinstrumente"},
{"label": "Facility Management", "value": "Facility Management"},
{"label": "IC-Technik/Software", "value": "IC-Technik/Software"}
],
"default": null
"visibility_dependency_value": "true",
"visibility_dependency_field_id": "is_inventory_relevant"
}
]
}
// data for POST
{
"inventory_code": "P-AUS2008037",
"model_id": "e9e9e588-fa73-4da7-b566-2a94ca18035f",
"inventory_pool_id": "8bd16d45-056d-5590-bc7f-12849f034351",
"properties_anschaffungskategorie": "AV-Technik"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment