Fields

You can use the fields operator to request certain fields and their order:

Example:

Request:

[GET] /...?fields=["title","author","email"]


Response:

[
    {
        "title": "The title",
        "author": "The Author",
        "email": "The email"
    },
    {
        "title": "The title2",
        "author": "The Author2",
        "email": "The email2"
    },
    {
        "title": "The title3",
        "author": "The Author3",
        "race": "The email3"
    }
]


You can also use the field operator on a specific record:

Example:

Request:

[GET] http://<your-project-id>/rest/posts/a0d140fb-4256-4018-8a26-97f87ad2173f?fields=["title","id"]


Response:

[
    {
        "title": "How to get started to write a book",
        "id": "a0d140fb-4256-4018-8a26-97f87ad2173f"
    }
]

Getting the value of nested columns (for JSON/JSONB only):


[GET] /...?fields=["field_one","json_field.nested_one","json_field[nested_two]"]

You can see the difference in syntax from the example above (nested_one and nested_two): declaration of json_field.nested_column is equal to json_field[nested_column].

Note: The level of nesting is not limited and it is possible to use array indexes as well (if it is expected that nested value is an array). For example: some_field.some_nested.nested_array[0][1].

Request:

[GET] http://<your-project-id>/rest/profiles/46a8af84-fa98-4b60-aeb5-073029699973?fields=["id","email","permissions[r]","permissions.w"]


Response:

[
    {
        "id": "46a8af84-fa98-4b60-aeb5-073029699973",
        "email": "first@example.com",
        "permissions.r": true,
        "permissions.w": true
    }
]