{{getMsg('Help_YouAreHere')}}:
/
{{page.title}}
{{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}}
{{helpModel.downloadHelpPdfDataStatus}}
Fields
The Fields handler can be used to load the configuration of asset fields on the server. The response can be used for, e.g. custom selection implementation when creating or updating assets.
GET /api/inventory/fields
Returns a list of asset fields from the configuration, including additional properties, such as selection options.
RESPONSE Fields | Value Type | Description |
---|---|---|
key | String | The unique key for this asset field |
label | String | The localized label for this asset field |
description | String | A field description |
priority | Number | The priority - and therefore the position of this asset field in the UI for this type |
type | String | The type, that this field has. Allows for value validation. Available Types are: Text , MultiLineText , Date , DateTime , Time , Number , Double , Currency , SelectString |
properties | Map<String, String> (optional) | An optional list of properties that define this field. E.g. the currency symbol in the type Currency . The properties field will not be present, when there is no additional information. |
additionalFields | Map<String, String> (optional) | Some fields hold more information, when a value is selected, such as sla and license . This map contains the keys and labels of additional fields that can be displayed when a value is selected. The additionalFields field will not be present when there are no additional fields. |
selectionOptions | Map<String, String> (optional) | Fields with the type SelectString have predefined values that can be selected. This map returns the keys and labels for the selectable values. The selectOptions field will not be present for other field types. |
Example Request
# Request GET /api/inventory/fields HTTP/1.1 Authorization: Bearer VGhpcyBpcyBqdXN0IGEgZGVtbyBhY2Nlc3MgdG9rZW4u # Response HTTP/1.1 200 OK Content-Type: application/json [ { "key": "name", "label": "Name", "description": "The name of the asset", "priority": 8, "type": "Text" }, { "key": "type", "label": "Type", "description": "Type of the associated asset unit (i.e. laptop, desktop, monitor)", "priority": 9, "type": "Selectable values", "selectionOptions": { "11": "Computer", "22": "Kopierer", "12": "Drucker", "23": "Netbook", "13": "Display", "14": "Smartphone", "25": "Notebook", "26": "Software", "27": "USV", "29": "Headset", "30": "Keyboard", "31": "Mouse", "21": "Scanner" } }, ... ]
Application Example
# Browser access http://127.0.0.1:9000/api/inventory/fields # Shell access using curl curl -LsH "Authorization: Bearer <access_token>" "http://127.0.0.1:9000/api/inventory/fields" # Shell access using curl using username and password curl -Lsu username:password "http://127.0.0.1:9000/api/inventory/fields"