Special Options

Contents

Letter case

There are different naming conventions recommended for different programming languages, some companies and individuals prefer to use own naming conventions for their tools. Therefore, Kayako decided to help here by introducing support of different letter cases for names used in our API.

The special _case argument can be used to instruct the API service to return names in these letter cases:

Case _case Sample
Snake _case=snake snake_case
Camel _case=camel camelCase
Pascal _case=pascal PascalCase

By default the API service returns names in the "snake" case.

Additionally, the API service can understand names passed in API requests in all these cases.

Examples:

  • fullName and FullName are equivalent to full_name
  • _Case is equivalent to _case

Empty fields

By default, empty fields (that contain null values or empty arrays) are included into the API response for the sake of consistency. This usually makes the response slightly bigger and, therefore, can be undesirable.

To remove fields from the API response, if their values are empty, use the _empty argument as follows:

?_empty=false

Alternatively, you can add the no_empty option to the X-Options HTTP header (separate options with ,).

Flat mode

In the default mode the API response can include some resources multiple times, if they appear as nested resources at different levels and/or under different containing resources. Each copy of such resource certainly makes the response message slightly bigger.

The special "flat" mode can be used to optimize the response message and, sometimes, to reduce its size by deliverying related resources separately under the special resources field of the response object.

This mode can be activated by the _flat argument:

?_flat=true

Alternatively, you can use the X-Options HTTP header with the flat option (separated by , from other ones, if any).

Here is an example of the API response in the "flat" mode:

{
    "status": 200,
    "data": {
        "id": 1,
        "name": "Test 1",
        "session_id": "OK8tYiWqIbWGDTK93GX2gnNpUQzLA9c013929a217d98f4d1bc1aa751676f05b9b072f46ZWMLEH0fH76NWlmQuhzCxCKfqnff",
        "authentication_scheme": "BASIC",
        "is_base_installed": true,
        "user": {
            "id": 1,
            "resource_type": "user"
        },
        "is_odd": true,
        "generation_time": 0.000134,
        "resource_type": "test",
        "resource_url": "https://brewfictus.kayako.com/api/v1/tests/1"
    },
    "resource": "test",
    "resources": {
        "role": {
            "1": {
                "id": 1,
                "title": "Agent",
                "type": "AGENT",
                "created_at": "2015-07-21T04:30:13+05:00",
                "updated_at": "2015-07-21T04:30:13+05:00",
                "resource_type": "role",
                "resource_url": "https://brewfictus.kayako.com/api/v1/roles/1"
            }
        },
        "identity_domain": {
            "5": {
                "id": 5,
                "domain": "brewfictus.com",
                "is_primary": true,
                "is_validated": false,
                "created_at": "2015-08-21T06:32:52+05:00",
                "updated_at": "2015-08-21T06:32:52+05:00",
                "resource_type": "identity_domain",
                "resource_url": "https://brewfictus.kayako.com/api/v1/identities/domains/5"
            }
        },
        "organization": {
            "7": {
                "id": 7,
                "name": "Brewfictus",
                "is_shared": false,
                "domains": [
                    {
                        "id": 5,
                        "resource_type": "identity_domain"
                    }
                ],
                "pinned_notes_count": 0,
                "created_at": "2015-08-21T06:32:52+05:00",
                "updated_at": "2015-08-21T06:32:52+05:00",
                "resource_type": "organization",
                "resource_url": "https://brewfictus.kayako.com/api/v1/organizations/7"
            }
        },
        "business_hour": {
            "1": {
                "id": 1,
                "title": "US office hours",
                "zones": {
                    "monday": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
                    "tuesday": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
                    "wednesday": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
                    "thursday": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
                    "friday": [9, 10, 11, 12, 13, 14, 15, 16, 17, 18],
                },
                "created_at": "2015-07-21T04:30:13+05:00",
                "updated_at": "2015-07-21T04:30:13+05:00",
                "resource_type": "business_hour",
                "resource_url": "https://brewfictus.kayako.com/api/v1/businesshours/1"
            }
        },
        "team": {
            "1": {
                "id": 1,
                "title": "Growth",
                "businesshour": {
                    "id": 1,
                    "resource_type": "business_hour"
                },
                "created_at": "2015-07-21T04:30:13+05:00",
                "updated_at": "2015-07-21T04:30:13+05:00",
                "resource_type": "team",
                "resource_url": "https://brewfictus.kayako.com/api/v1/teams/1"
            }
        },
        "identity_email": {
            "1": {
                "id": 1,
                "email": "charlotte.kuchler@brewfictus.com",
                "is_primary": true,
                "is_validated": true,
                "is_notification_enabled": false,
                "created_at": "2015-07-21T04:30:13+05:00",
                "updated_at": "2015-07-21T04:30:13+05:00",
                "resource_type": "identity_email",
                "resource_url": "https://brewfictus.kayako.com/api/v1/identities/emails/1"
            }
        },
        "user": {
            "1": {
                "id": 1,
                "full_name": "Charlotte Küchler",
                "designation": "Community Manager",
                "is_enabled": true,
                "role": {
                    "id": 1,
                    "resource_type": "role"
                },
                "avatar": "https://brewfictus.kayako.com/avatar/get/aed21e-7619-5cb3-bbae-983015d3a",
                "agent_case_access": "ALL",
                "organization_case_access": null,
                "organization": {
                    "id": 7,
                    "resource_type": "organization"
                },
                "teams": [
                    {
                        "id": 1,
                        "resource_type": "team"
                    }
                ],
                "emails": [
                    {
                        "id": 1,
                        "resource_type": "identity_email"
                    }
                ],
                "pinned_notes_count": 0,
                "locale": "en-us",
                "last_seen_user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36",
                "last_seen_ip": "89.76.11.90",
                "password_updated_at": "2015-07-21T04:30:13+05:00",
                "last_logged_in_at": "2015-07-21T10:17:58+05:00",
                "last_activity_at": "2015-07-21T10:17:58+05:00",
                "created_at": "2015-07-21T04:30:13+05:00",
                "updated_at": "2015-07-21T10:17:58+05:00",
                "resource_type": "user",
                "resource_url": "https://brewfictus.kayako.com/api/v1/users/1"
            }
        }
    }
}