REST API for Out of Office

Introduction

Now it is possible for 3rd party apps to send out of office information or query out of office period with the newly added REST endpoints.

There are 4 REST Resources which can be accessed.

  • ConfigResource - Used for configuring options and JQL Filter. 
  • OutOfOfficeOneTimeRuleResource - Used for configuring any one time rule.
  • OutOfOfficePeriodResource - Used for configuring OutOfOffice Period.
  • OutOfOfficeRecurRuleResource - Used for configuring OutOfOffice Recurring Rule. 

Resources

/rest/ooo/1.0

 ConfigResources
 Attributes
Data TypeAttribute NameDefault ValueRemarks
StringignoreSelfAssignfalsetrue/false to ignore self assignment of issue
StringallowCovererAssignBackfalsetrue/false to allow coverer to assign issue back
StringoooReplyWhenMentionedfalsetrue/false to thread reply when being mentioned
StringexclusionModedefaultExclusion mode for JQL which can be either default or user
StringdefaultJql
Default JQL used in the global level
StringuserJql
User defined JQL
 Create JQL Exclusion Filter for OOO (POST)
METHODURLDataRemarks
POST/rest/ooo/1.0/

STATUS 200

  • successful creation of JQL Exclusion Filter.  

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error in JQL

Can only be performed by an user with Administrator privilege


Example DATA to POST:

{
    "exclusionMode": "default",

    "defaultJql": "project = ExampleProject"
}

If exclusion Mode is "user" , "userJql" would be modified instead of "defaultJql". 

Only attributes which needs to be changed are to be added, attributes not specified in the DATA are set to their default values as defined in the attributes table as above. 

 Update the OOO advance settings of User (PUT)
METHODURLDataRemarks
PUT/rest/ooo/1.0/

STATUS 200

  • successful update of OOO advance settings

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error in JQL

Example DATA to PUT :

{
	 "ignoreSelfAssign": "true",

     "allowCovererAssignBack": "false",

     "oooReplyWhenMentioned": "true"	
}

Only attributes which needs to be changed are to be added, attributes not specified in the DATA are set to their default values as defined in the attributes table as above. 

If only "oooReplyWhenMentioned" needs to be changed, the DATA can be only 

{ "oooReplyWhenMentioned": "false"}
 Retrieve the OOO advance settings of user (GET)
METHODURLDataRemarks
GET/rest/ooo/1.0/

STATUS 200

  • Returns the Config Object for Rendering

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

/rest/ooo/1.0/onetimerule

 OutOfOfficeOneTImeRuleResource
 Attributes
Data TypeAttribute NameDefault ValueRemarks
StringprojectIdString"-1"

"-1" will be all other project

If not, it will be the projectId of project

StringcovererId

The coverer username if reassignMode is set to "coverer"

Set to "-" for do not re-assign issue

StringcovererAvatar
The small avatar img of coverer which is used to populate in one time rule table
StringcovererDisplayName
The coverer full name which is used to populate in one time rule table
StringprojectInfo
The project name and key which are configured
StringreassignMode

Can use "reassign", for re-assigning issue

Can use "unassign", for unassigning issue ((info) the option is only available if JIRA allow unassign issue)

Can use "same", for do not re-assign issue

StringoneTimeMessage
Message to be added into comment should the user is OOO
StringstartDateString
String of the out of office start date format ("yyyy-MM-dd HH:mm")
StringendDateString
String of the out of office end date format ("yyyy-MM-dd HH:mm")
intoneTimeId0The id of the one time rule for update and delete rule
booleanbyAdminfalseif the rule is configured by admin
booleanbyTeamfalseif the rule is configured by team
StringcreatorAvatar
The small avatar img of rule creator which is used to populate in one time rule table
StringcreatorDisplayName
The creator full name which is used to populate in one time rule table
StringassigneeId

The ooo user's username

StringassigneeAvatar
The ooo user's avatar
StringassigneeDisplayName
The ooo user's full name
 Getting all your own One-Time Rule (GET)
METHODURLDataRemarks
GET/rest/ooo/1.0/onetimerule

Return an array of OneTimeRule object

See above inner class section on data transaction

Example

[
    {
        "projectIdString": "10001",
        "covererId": "",
        "covererAvatar": "",
        "covererDisplayName": "",
        "projectInfo": "Akeles [AKELES]",
        "reassignMode": "unassign",
        "startDateString": "2018-10-11 00:00",
        "endDateString": "2018-10-18 23:59",
        "oneTimeId": 5,
        "byAdmin": false,
        "byTeam": false,
        "creatorAvatar": "http://192.168.9.150:8080/secure/useravatar?size=xsmall&avatarId=10337",
        "creatorDisplayName": "John",
        "assigneeId": "",
        "assigneeAvatar": "",
        "assigneeDisplayName": ""
    }
]

(info)Does not allow you to search based on assigneeId. It will return all the one time rule configured for the current logged in user

 Create a new One-Time Rule (POST)
METHODURLDataRemarks
POST/rest/ooo/1.0/onetimerule

Required the following field:

  • assigneeId
  • projectIdString
  • reassignMode
  • covererId if reassignment mode is set to coverer
  • startDateString
  • endDateString


STATUS 200

  • successful creation of new one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data or invalid user

Will perform validateUser() and validateOneTimeRule()

User - Check if user is admin if byAdmin is set to true

OneTimeRule - Check for data format and mandatory data required

Example Data to POST: 

{
 	"assigneeId": "1000222",
	"projectIdString": "2",
	"reassignMode": "unassign",
	"covererId": "",
	"startDateString": "2018-09-14 12:00",
	"endDateString": "2018-09-20 12:00"
}
	
 Edit an existing One-Time Rule (PUT)
METHODURLDataRemarks
PUT/rest/ooo/1.0/onetimerule

Required the following field:

  • oneTimeId
  • assigneeId
  • projectIdString
  • reassignMode
  • covererId if reassignment mode is set to coverer
  • startDateString
  • endDateString

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data or invalid user
Will perform validateUser() and validateOneTimeRule()

User - Check if user is admin if byAdmin is set to true

OneTimeRule - Check for data format and mandatory data required

Example Data to PUT:

{
	"oneTimeId": "2",
	"assigneeId": "1000222",
	"projectIdString": "2",
	"reassignMode": "coverer",
	"covererId": "1000232",
	"startDateString": "2018-09-14 12:00",
	"endDateString": "2018-09-20 12:00"
}
 Delete and existing One-Time Rule (DELETE)
METHODURLDataRemarks
DELETE/rest/ooo/1.0/onetimerule

Required the following field:

  • oneTimeId


STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data or invalid user
Will perform validateUser() and validateOneTimeRule()

User - Check if user is admin if byAdmin is set to true

OneTimeRule - Check for data format and mandatory data required

Example Data to DELETE:

{
	"oneTimeId": "2"
}
 Get all Rule configured by adminstrator
METHODURLDataRemarks
Get all rule configured by administratorGET/rest/ooo/1.0/onetimerule/admin

Return an array of OneTimeRule

See above inner class section on data transaction

Same as getting all of your own one time rule just that this is all rules created by admin. 

/rest/ooo/1.0/period

 OutOfOfficePeriodResource
 Attributes
Data TypeAttribute NameDefault ValueRemarks
StringperiodMessage

Message to be added into comment should the user is OOO

(info) This message will be pre-pend infront of the one-time message as comment

StringstartDateString
String of the out of office start date, date format ("yyyy-MM-dd HH:mm")
StringendDateString
String of the out of office end date,  date format ("yyyy-MM-dd HH:mm")
intperiodId0The id of the period for update and delete of period
 Retrieve all your own Out Of Office period (GET)
METHODURLDataRemarks
GET/rest/ooo/1.0/period

Return an array of Period object

See above inner class section on data transaction

Example of array returned.

[
	{
		"periodMessage": "Out of Office",
		"startDateString": "2018-09-14 12:00",
		"endDateString": "2018-09-20 12:00"
	}
]

(info) Does not allow you to search based on assigneeId. It will return all the period configured for the current logged in user

 Add a new Out Of Office period for yourself (POST)
METHODURLDataRemarks
POST/rest/ooo/1.0/period

Required the following field:

  • startDateString
  • endDateString

periodMessage is Optional, if a message is needed.

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data

Example Data to POST:

{
	"periodMessage": "I am out of office",
	"startDateString": "2018-09-14 12:00",
	"endDateString": "2018-09-20 12:00"
}
 Delete an existing Out Of Office period (DELETE)
METHODURLDataRemarks
DELETE/rest/ooo/1.0/period

Required the following field:

  • periodId

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - invalid user

Will perform validateUser() to check if the period belongs to user

Example Data to DELETE:

{
	"periodId": "2"
}
 Update an existing Out Of Office period (PUT)
METHODURLDataRemarks
PUT/rest/ooo/1.0/period

Required the following field:

  • periodId
  • startDateString
  • endDateString

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data or invalid user

Will perform validateUser() to check if the period belongs to user

Example Data to PUT:

{
	"periodId": "3",
	"startDateString": "2018-09-14 12:00",
	"endDateString": "2018-09-20 12:00"
}

/rest/ooo/1.0/recurrule

 OutOfOfficeRecurRuleResource
 Attributes
Data TypeAttribute NameDefault ValueRemarks
StringprojectIdString"-1"

"-1" will be all other project

If not, it will be the projectId of project

StringcovererId

The coverer username if reassignMode is set to "coverer"

Set to "-" for do not re-assign issue

StringcovererAvatar
The small avatar img of coverer which is used to populate in recur rule table
StringcovererDisplayName
The coverer full name which is used to populate in recur rule table
StringprojectInfo
The project name and key which are configured
StringreassignMode

Can use "coverer", for re-assigning issue

Can use "unassign", for unassigning issue ((info) the option is only available if JIRA allow unassign issue)

Can use "same", for do not re-assign issue

StringoneTimeMessage
Message to be added into comment should the user is OOO

(info) This message will be appended into period's message as comment
intoneTimeId0The id of the recur rule for update and delete rule
 Retrieve all your own Out Of Office recur rule (GET)
METHODURLDataRemarks
GET/rest/ooo/1.0/recurrule

Return an array of RecurRule object

See above inner class section on data transaction

(info) Does not allow you to search based on assigneeId. It will return all the recur rule configured for the current logged in user

Example 

[
    {
        "projectIdString": "10001",
        "covererId": "",
        "covererAvatar": "",
        "covererDisplayName": "",
        "projectInfo": "Akeles [AKELES]",
        "reassignMode": "unassign",
		"oneTimeMessage": "out of office",
 		"oneTimeId": 5
    }
]
 Add a new Out Of Office recur rule for yourself (POST)
METHODURLDataRemarks
POST/rest/ooo/1.0/recurrule

Required the following field:

  • recurRuleId
  • assigneeId
  • projectIdString
  • reassignMode
  • covererId if reassignment mode is set to coverer

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data

Example Data to POST:

{
	"recurRuleId": "1",
	"assigneeId": "10002",
	"projectIdString": "2",
	"reassignMode": "coverer",
	"covererId": "20001"
}
 Delete an existing Out Of Office recur rule (DELETE)
METHODURLDataRemarks
Delete an existing out of office recur ruleDELETE/rest/ooo/1.0/recurrule

Required the following field:

    • recurRuleId

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - invalid user

Will perform validateUser() to check if the recur rule belongs to user

Example Data to DELETE:

{
	"recurRuleId": "2"
}
 Update an existing Out Of Office recur rule (PUT)
METHODURLDataRemarks
Update an existing out of office recur rulePUT/rest/ooo/1.0/recurrule

Required the following field:

  • recurRuleId
  • assigneeId
  • projectIdString
  • reassignMode
  • covererId if reassignment mode is set to coverer

STATUS 200

  • successful editing of existing one time rule

STATUS 401  

  • UNAUTHORIZED - Not logged in or do not have administrator access

STATUS 406 

  • NOT_ACCEPTABLE - error when validating data or invalid user

Will perform validateUser() to check if the recur rule belongs to user

Example Data to PUT:

{
	"recurRuleId": "2",
	"assigneeId": "20202",
	"projectIdString": "20",
	"reassignMode": "unassign",
	"covererId":""
}