/
[REST 1.1] REST API usage example in VacMan flow

[REST 1.1] REST API usage example in VacMan flow

This page provides example of Vacation Manager REST API usage.

1. Do initial setup of Vacation Manager

User: jira administrator

[REST 1.1] Initial setup

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/initial-setup
Body
{ "project": { "name": "Vacation Manager", "key": "VACMAN", "description": "Vacation project", "lead": "admin", "groupHr": "vacman-hr" }, "vacationType": { "name": "Leave", "description": "Standard leave", "kindType": "RECURRING", "periodDefinition": { "type": "MONTHS", "value": 12, "startDate": "2018-01-01" }, "hasCarryOver": true, "defaultDayLimit": 20, "vacationDocumentPeriodType": "DAILY_OR_HALF_DAILY" } }

2. Create first team

User: HR

[REST 1.1] Teams

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/team
Body
{ "name": "Workers", "description": "" }

Response: STATUS 201

Response
{ "id": 1, "name": "Workers", "description": "" }

3. Add supervisor to team

User: HR

[REST 1.1] Teams

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/team/1/member





Body
{ "name":"supervisor", "role":"SUPERVISOR", "type":"USER" }



4. Add users to team

User: HR

[REST 1.1] Teams

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/team/1/member





Body
{ "name":"jira-software-users", "role":"USER", "type":"GROUP" }



5. Add new holiday

User: HR

5.1. Get list of holiday schemes to obtain id

[REST 1.1] Holiday schemes

Request
GET {jira_baseurl}/rest/vacation-manager/1.0/holiday-scheme



Response: STATUS 200

Response
[ { "id": 1, "name": "Default holiday scheme" } ]



5.2. Add new holiday

[REST 1.1] Holiday schemes

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/holiday-scheme





Body
{ "date": "2018-12-25", "yearly": true, "description": "Christmas" }



6. Add vacation definition to user

User: HR

[REST 1.1] Vacation definitions

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/vacation-definition





Body
{ "vacationTypeId": "1", "userName": "john", "startDate": "2018-01-01", "endDate": "2018-12-31", "dayLimit": 15 }



7. Create vacation document

User: john jira user

[REST 1.1] Vacation documents

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/vacation-document





Body
{ "reporterName": "john", "supervisorName": "supervisor", "vacationKindId": 1, "periodType": "DAILY", "startDate": "2018-11-02", "endDate": "2018-11-03" }



8. Send vacation document to supervisor

User: john jira user

8.1. Get list of actions for vacation document

[REST 1.1] Vacation documents

Request
GET {jira_baseurl}/rest/vacation-manager/1.0/vacation-document/VACMAN-1/actions



Response: STATUS 200

Response
[ { "id": 31, "name": "Send to supervisor" }, { "id": 61, "name": "Delete" } ]



8.2. Change status of vacation document

[REST 1.1] Vacation documents

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/vacation-document/status





Body
{ "issueKey": "VACMAN-1", "actionId": 31 }



9. Approve vacation document

User: supervisor

9.1. Get list of actions for vacation document

[REST 1.1] Vacation documents

Request
GET {jira_baseurl}/rest/vacation-manager/1.0/vacation-document/VACMAN-1/actions



Response: STATUS 200

Response
[ { "id": 11, "name": "Approve" }, { "id": 21, "name": "Reject" }, { "id": 41, "name": "More information required" } ]



9.2. Change status of vacation document

[REST 1.1] Vacation documents

Request
POST {jira_baseurl}/rest/vacation-manager/1.0/vacation-document/status





Body
{ "issueKey": "VACMAN-1", "actionId": 11 }





Related content

Feel free to tell us what topic should be covered: vacationmanager@psc-software.atlassian.net