Unicat API Reference

Up - API Reference - Home


/api/p/<project gid>/fields/get

Requires JWT

Get one or more fields.

A field specifies what values can be entered for records. We define a field type and specify options like is_required or min and max values or lengths.

Fields are referenced in classes and definitions, and a record's definition in turn tells us the record's fields.

Request

You get a field either by specifying the gid in field or fields.

If you provide both field and fields parameters, we use parameter matching to guess what you meant. The first action that matches the parameters is performed, the rest is ignored. Parameter matching happens in the order given below:

POST /api/p/<project gid>/fields/get
Authorization: Bearer <JWT>

{
    "field": "<field gid>"
}

or

POST /api/p/<project gid>/fields/get
Authorization: Bearer <JWT>

{
    "fields": ["<field gid>", ]
}

Success response

If you request a single field, you'll get a single result.

Authorization: <JWT>

{
    "success": true,
    "result": {
        "field": "0b4c90e8-aa84-4333-a508-c30afd707b94"
    },
    "data": {
        "fields": {
            "96ec02b2-fb8d-4fb4-b952-fad0c4b88a74": {
                
            },
            
        }
    }
}

If you requested multiple fields, you'll get a list of results.

Authorization: <JWT>

{
    "success": true,
    "result": {
        "fields": [
            "0b4c90e8-aa84-4333-a508-c30afd707b94",
            "549c77cd-3cc7-41c9-beb5-76080b72a1b7",
            "84914db7-8d67-447a-9b17-afaa2f183687"
        ]
    },
    "data": {
        "fields": {
            "0b4c90e8-aa84-4333-a508-c30afd707b94": {
                
            },
            
        }
    }
}

result

field the requested field, if a single field was asked for.
fields the requested fields, if multiple fields were asked for.

data

fields Field info with name, type, options.

Error responses

400 Bad request - missing parameters or wrong type or value
401 Unauthorized - missing or expired JWT
403 Forbidden - not a member of this project
422 Unprocessable entity - field not found