Custom Fields API in Wasabi AiR
    • 20 May 2024
    • 3 Minutes to read
    • PDF

    Custom Fields API in Wasabi AiR

    • PDF

    Article summary

    The Custom Fields API is a way to attach custom data to items. This API provides a means to manage your custom fields.

    Listing Custom Fields

    GET /api/data/v3/fields?page-token={page-token}&limit={limit}

    Optional Query Parameters

    • page-token - (string) A page token to fetch an additional or previous page of results.
    • limit - (int) The number of results to return (default: 20, min: 1, max: 1000).

    Response

    {
        "fields": [
            {
                "id": "5de700b219b0e84945469242fa23b6f4",
                "name": "thename",
                "description": "some description",
                "display_order": 1,
                "data_type": "string",
                "created_at": "2019-12-04T00:41:22.416234Z",
                "updated_at": "2019-12-04T00:41:22.416234Z"
            }
        ],
        "next_page": "",
        "previous_page": ""
    }
    • fields- (array) An array of field objects:
      • id- (string) The ID of the field.
      • name - (string) The name of the field.
      • description - (string) The description of the field.
      • display_order - (integer) The order in which the field displays on item detail and search results pages.
      • data_type - (string) The data type of the field.
      • created_at - (string) The timestamp when the field was created.
      • updated_at - (string) The timestamp when the field was last updated.
    • next_page - A page token that can be used to retrieve the next page of fields. If this is an empty string, there are no additional results to return.
    • previous_page - A page token that can be used to retrieve the previous page of fields. If this is an empty string, there are no earlier results available.

    Status codes:

    • 200 (success)
    • 500 (unexpected error)

    Creating a New Field

    POST /api/data/v3/fields
    {
        "description": "The description",
        "name": "The name",
        "data_type": "string"
    }
    • ame - (string) The name of the field.
    • description - (string) The description of the field.
    • data_type - (string) The data type of the field (bool, date, number, or string).

    Response

    {
        "id": "5de700b219b0e84945469242fa23b6f4",
        "name": "thename",
        "description": "some description",
        "display_order": 1,
        "data_type": "string",
        "created_at": "2019-12-04T00:41:22.416234Z",
        "updated_at": "2019-12-04T00:41:22.416234Z"
    }
    • id - (string) The ID of the field.
    • name - (string) The name of the field.
    • description - (string) The description of the field.
    • display_order - (integer) The order in which the field displays on item detail and search results pages.
    • data_type - (string) The data type of the field.
    • created_at - (string) The timestamp when the field was created.
    • updated_at - (string) The timestamp when the field was last updated.

    Status codes:

    • 201 (success)
    • 500 (unexpected error)

    Updating a Field

    PATCH /api/data/v3/fields/{id}
    {
        "description": "The description",
        "name": "The name",
    }
    
    • name - (string) Optional. The name of the field.
    • description - (string) Optional. The description of the field.
    Only the name and description of a field are mutable.

    Response

    {
        "id": "5de700b219b0e84945469242fa23b6f4",
        "name": "thename",
        "description": "some description",
        "display_order": 1,
        "data_type": "string",
        "created_at": "2019-12-04T00:41:22.416234Z",
        "updated_at": "2019-12-04T00:41:22.416234Z"
    }
    • id - (string) The ID of the field.
    • name - (string) The name of the field.
    • description - (string) The description of the field.
    • display_order - (integer) The order in which the field displays on item detail and search results pages.
    • data_type - (string) The data type of the field.
    • created_at - (string) The timestamp when the field was created.
    • updated_at - (string) The timestamp when the field was last updated.

    Status codes:

    • 200 (success)
    • 500 (unexpected error)

    Getting a Specific Field

    GET /api/data/v3/fields/{id}

    Response

    {
        "id": "5de700b219b0e84945469242fa23b6f4",
        "name": "thename",
        "description": "some description",
        "display_order": 1,
        "data_type": "string",
        "created_at": "2019-12-04T00:41:22.416234Z",
        "updated_at": "2019-12-04T00:41:22.416234Z"
    }
    • id - (string) The ID of the field.
    • name - (string) The name of the field.
    • description - (string) The description of the field.
    • display_order - (integer) The order in which the field displays on item detail and search results pages.
    • data_type - (string) The data type of the field.
    • created_at - (string) The timestamp when the field was created.
    • updated_at - (string) The timestamp when the field was last updated.

    Status codes:

    • 200 (success)
    • 404 (field not found)
    • 500 (unexpected error)

    Deleting a Field

    DELETE /api/data/v3/fields/{id}

    Status codes:

    • 200 (success)
    • 500 (unexpected error)

    Setting the Display Order of Fields

    PUT /api/data/v3/fields/order
    {
        "fields": [
            { "id": "field3", "order": 1 },
            { "id": "field2", "order": 2 },
            { "id": "field1", "order": 3 }
        ]
    }

    Optional Query Parameters

    • page-token - (string) A page token to fetch an additional or previous page of results.
    • limit - (int) The number of results to return (default: 20, min: 1, max: 1000).

    Response

    {
        "fields": [
            { "id": "field3", "order": 1 },
            { "id": "field2", "order": 2 },
            { "id": "field1", "order": 3 }
        ]
    }
    • fields- (array) An array of field objects:
      • id - (string) The ID of the field.
      • order - (integer) The order in which the field should display on item detail and search results pages.

    Status codes:

    • 200 (success)
    • 500 (unexpected error)