REST API

You can use this REST API to develop integrations between Work Time Calendar for Jira and other applications or systems. This page documents the available REST resources along with expected HTTP responses and sample requests.

To use REST API, an admin has to generate a token tied either to specific calendars or all calendars. It’s recommended to assign minimum calendars per token and to create "All Calendars" tokens only when it’s needed.

URI Structure

To use REST API, your application will make an HTTP request and parse the response.

Since the Cloud version of the app is hosted in the Cloud, while the Server and Data Center versions reside on the same server as Jira, there are different URLs for REST API.

For Jira Cloud REST API URIs start with:

https://wtc.brizoit.com/wtc/rest/brizo-calendar

For Jira Server REST API URIs start with your Jira URL followed by /rest/brizo-calendar

JIRA-SERVER-URL/rest/brizo-calendar

Jira URL can be copied from the browser or checked in Administration -> System -> General configuration, Base URL setting:

Authentication

Requests to the REST points should be authenticated by Bearer authentication (also known as token authentication). To do so, the clients must send the token in the Authorization header when making requests:

Authorization: Bearer <token>

When no token or wrong token is passed all REST resources return 401 error code.

REST resources

GET /api/1/calendar

Returns the list of calendars tied for the passed token.

Successful response brings JSON with calendars associated with the passed token:

See the response sample:

[ { "id": 1959, "sources": [ { "id": 5655, "calendarId": 1959, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "meeting", "name": "Meetings", "projectRequired": false, "systemType": true, "usersRequired": true }, "order": 1, "value": "{\"color\":\"#7500ca\",\"projectId\":-1,\"condColors\":[],\"name\":\"Dekki's meetings\",\"concurrence\":\"allow\",\"hideStartTime\":false,\"issueFields\":[{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.project\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"event.summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.users\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.reporter\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.description\",\"showEvent\":true,\"showInfo\":true}],\"summaryFromSourceName\":false,\"summaryFromIssueSummary\":false}" }, { "id": 5656, "calendarId": 1959, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "jira", "name": "Jira dates", "projectRequired": false, "systemType": true, "usersRequired": false }, "order": 2, "value": "{\"color\":\"#cc6fcc\",\"condColors\":[],\"dateRanges\":[],\"singleDates\":[\"duedate\"],\"summaryFromSourceName\":false,\"projectId\":-1,\"name\":\"Dekki's JD source\",\"issueFields\":[{\"id\":\"duedate\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"issuetype\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"status\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"assignee\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"reporter\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"description\",\"showEvent\":false,\"showInfo\":true}],\"hideStartTime\":false}" } ], "value": "{\"description\":\"\",\"name\":\"Dekki Gedru's first calendar\",\"usersFromEvents\":true}", "user": "66625976fc0cc7a600b08977" }, { "id": 1995, "sources": [ { "id": 5779, "calendarId": 1995, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "jira", "name": "Jira dates", "projectRequired": false, "systemType": true, "usersRequired": false }, "order": 1, "value": "{\"color\":\"#057fff\",\"condColors\":[],\"dateRanges\":[],\"singleDates\":[\"duedate\"],\"summaryFromSourceName\":false,\"projectId\":10336,\"name\":\"Jira dates events\",\"issueFields\":[{\"id\":\"duedate\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"issuetype\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"status\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"assignee\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"reporter\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"description\",\"showEvent\":false,\"showInfo\":true}],\"hideStartTime\":false}" }, { "id": 5780, "calendarId": 1995, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "sprint", "name": "Jira sprints", "projectRequired": false, "systemType": true, "usersRequired": false }, "order": 2, "value": "{\"boardId\":132,\"color\":\"#cc6fcc\",\"name\":\"Sprints\",\"projectId\":10336,\"show\":0,\"state\":0,\"hideStartTime\":false}" }, { "id": 5781, "calendarId": 1995, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "version", "name": "Jira versions", "projectRequired": false, "systemType": true, "usersRequired": false }, "order": 3, "value": "{\"name\":\"Versions\",\"color\":\"#ff3e05\",\"projectId\":10371,\"show\":0,\"releasedStatus\":0}" }, { "id": 5782, "calendarId": 1995, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "trip", "name": "Business trips", "projectRequired": false, "systemType": true, "usersRequired": true }, "order": 4, "value": "{\"color\":\"#40af04\",\"projectId\":0,\"condColors\":[],\"name\":\"Business trips\",\"issuesAsResources\":false,\"concurrence\":\"allow\",\"hideStartTime\":false,\"issueFields\":[{\"id\":\"event.summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.users\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.reporter\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.description\",\"showEvent\":true,\"showInfo\":true}],\"summaryFromSourceName\":false,\"summaryFromIssueSummary\":false}" } ], "value": "{\"description\":\"\",\"name\":\"Development\",\"usersFromEvents\":true}", "user": "6666d5194d18cbf6772f4" } ]

 

GET /api/1/calendar/{calendarId}

Returns the calendar for the given calendar id.

In addition to properties returned by GET /api/1/calendar , this method brings permissions related properties.

Successful response brings JSON with a calendar:

See the response sample:

{ "id": 1959, "publicCalendar": false, "calendarEditable": false, "permCalendarEdit": { "groups": [], "users": [] }, "eventsEditable": false, "permEventsEdit": { "groups": [], "users": [] }, "eventReporterEdit": false, "sources": [ { "id": 5655, "calendarId": 1959, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "meeting", "name": "Meetings", "projectRequired": false, "systemType": true, "usersRequired": true }, "order": 1, "value": "{\"color\":\"#7500ca\",\"projectId\":-1,\"condColors\":[],\"name\":\"Dekki's meetings\",\"concurrence\":\"allow\",\"hideStartTime\":false,\"issueFields\":[{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.project\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"event.summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.users\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.reporter\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.description\",\"showEvent\":true,\"showInfo\":true}],\"summaryFromSourceName\":false,\"summaryFromIssueSummary\":false}" }, { "id": 5656, "calendarId": 1959, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "jira", "name": "Jira dates", "projectRequired": false, "systemType": true, "usersRequired": false }, "order": 2, "value": "{\"color\":\"#cc6fcc\",\"condColors\":[],\"dateRanges\":[],\"singleDates\":[\"duedate\"],\"summaryFromSourceName\":false,\"projectId\":-1,\"name\":\"Dekki's JD source\",\"issueFields\":[{\"id\":\"duedate\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"issuetype\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"status\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"assignee\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"reporter\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"description\",\"showEvent\":false,\"showInfo\":true}],\"hideStartTime\":false}" } ], "value": "{\"description\":\"\",\"name\":\"Dekki Gedru's first calendar\",\"usersFromEvents\":true}", "user": "534534976fc0cc7a60053444" }

 

404 status code is returned for non-existing calendarId or when the calendarId is not associated with the token.

GET /api/1/source/{sourceId}

Returns the source for the given source id.

Successful response brings JSON with a source representation:

See the response sample:

{ "id": 5655, "calendarId": 1959, "emailsEnabled": false, "eventType": { "issueRequired": false, "key": "meeting", "name": "Meetings", "projectRequired": false, "systemType": true, "usersRequired": true }, "order": 1, "value": "{\"color\":\"#7500ca\",\"projectId\":-1,\"condColors\":[],\"name\":\"Dekki's meetings\",\"concurrence\":\"allow\",\"hideStartTime\":false,\"issueFields\":[{\"id\":\"issuekey\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.project\",\"showEvent\":false,\"showInfo\":true},{\"id\":\"event.summary\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.users\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.reporter\",\"showEvent\":true,\"showInfo\":true},{\"id\":\"event.description\",\"showEvent\":true,\"showInfo\":true}],\"summaryFromSourceName\":false,\"summaryFromIssueSummary\":false}" }

 

404 status code is returned for non-existing sourceId or when the sourceId belongs to a calendar that is not associated with the token.

POST /api/1/event/search

Searches for events.

Only events from sources with type key vacation, sickness, trip, meeting or custom are returned.

JSON body parameters:

Interval between start and end dates should be less than 92 days (i.e. a quarter).

JSON body parameters samples:

  1. Period passed as Unix milliseconds and calendarId:

Here:
- startDate corresponds to Sun Jan 01 2023 00:00:00 GMT
- endDate corresponds to Sat Apr 01 2023 00:00:00 GMT

2. Period passed as ISO dates and sourceId:

Here:
- startDateIso corresponds to Sun Jan 01 2023 00:00:00 EST
- endDateIso corresponds to Sat Apr 01 2023 00:00:00 DST

Successful response brings JSON with matching events:

As for now, values are non-paginated and all matching events are returned. We might introduce the pagination should we see the need.

See the response sample:

 

400 status code is returned when parameters validation fails. The status is accompanied with the error messages. E.g.:

404 status code is returned for non-existing calendarId or sourceId or when the calendarId or sourceId correspond to a calendar that is not associated with the token.

 

We have tickets to implement following functionality:

If you are interested in these features, please contact us through the support portal https://brizoit.atlassian.net/servicedesk/customer/portal/4.