Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
iconfalse

Overview

Herzum Approval exposes its data via REST Application Programming Interfaces (API) which allows you to build your own integrations with the app.


API Capabilities at the moment include:

  • Search information about approval items filtering by user, status and approval name
  • Operate on the issue approvals (APPROVE, REJECT, ABSTAIN, RESET)


Authentication

The Approval API relies on the underlying JIRA Authentication mechanism and the following are supported

  • OAuth
  • Basic Auth
  • Cookie Based Authentication

For detailed information about the Authentication mechanisms please refer to Atlassian JIRA Security Documentation

In particular:


Table of Contents
maxLevel5
minLevel5

In this section

Table of Contents
maxLevel1

Related Documentation

Here you can find some links to our customer documentation illustrating the effect of these customizations:

Need support?

We would love to help.

Button Hyperlink
titleSubmit a support request
typeprimary
urlhttps://chicago.herzum.com/jira/plugins/servlet/desk/portal/44
targettrue

Panel

Using Postman

Postman is a popular tool for working with APIs. We have published a collection for testing and documentation using Postman. 

Button Hyperlink
titleVIEW INTERACTIVE DOCUMENTATION
typeprimary
urlhttps://documenter.getpostman.com/view/11380402/T1Djmfg7?version=latest


Download the latest version of Postman from https://www.getpostman.com/ and then click this button to import our collection:


HTML
<div class="postman-run-button"
data-postman-action="collection/import"
data-postman-var-1="0465ad55d530bf5df5ab"></div>
<script type="text/javascript">
  (function (p,o,s,t,m,a,n) {
    !p[s] && (p[s] = function () { (p[t] || (p[t] = [])).push(arguments); });
    !o.getElementById(s+t) && o.getElementsByTagName("head")[0].appendChild((
      (n = o.createElement("script")),
      (n.id = s+t), (n.async = 1), (n.src = m), n
    ));
  }(window, document, "_pm", "PostmanRunObject", "https://run.pstmn.io/button.js"));
</script>


(info) You are also able to DOWNLOAD THE COLLECTION


The collection is available from the sidebar under "Collections":


The Collection comes with various example requests, that have been set up with Collection specific variables



Get Issue Approvals

The following API is for retrieving information about items still hanging into the approval stage.


UI Expand
expandedtrue
titleSearch Issue Approvals

Status
colourGreen
titleGET
/rest/herzum-hap-services/1.0/api/issueapprovals


UI Expand
titleParameters
NameTypeDescriptionOptionality
appnameQuery ParameterReturn only the Issues Approvals configured with the Approval with name = appnameOptional
usernameQuery ParameterReturn only the Issue Approvals for which the Jira User can actOptional
status

Query Parameter

It can be one of:

  • APPROVED
  • REJECTED
  • PENDING
  • ABSTAINED
Filter the returned Issue Approvals by statusOptional
UI Expand
expandedtrue
titleRequests / Responses
CodeRequest

Status
colourGreen
title200

UI Expand
expandedtrue
titleSuccessful Request
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?username=admin&status=PENDING&appname=Tech
Code Block
[
    {
        "id": 13,
        "issueId": 10600,
        "approvalId": 5,
        "approvalName": "restricted",
        "issueStatus": "10001",
        "approvalStatus": "PENDING",
        "transitionId": "11",
        "transitionName": "To Do",
        "notificationDate": "Not Sent",
        "sourceStatusId": "10001",
        "type": "WORKFLOW",
        "defineCustomApproval": false,
        "awt": false,
        "awtr": false,
        "awtad": false,
        "arn": false,
        "nac": false,
        "rac": false,
        "errorTransit": false,
        "mra": -1,
        "mrr": -1,
        "conditionalRuleId": -1,
        "submittedDate": "08/05/2020 13:40:53",
        "sortSa": 1,
        "sa": false,
        "saad": false,
        "abstainActionStatus": 0,
        "isOptionalApproval": false
    },
    {
        "id": 21,
        "issueId": 10500,
        "approvalId": 1,
        "approvalName": "tech",
        "issueStatus": "10001",
        "approvalStatus": "PENDING",
        "transitionId": "11",
        "transitionName": "To Do",
        "notificationDate": "Not Sent",
        "sourceStatusId": "10001",
        "type": "WORKFLOW",
        "defineCustomApproval": false,
        "awt": false,
        "awtr": false,
        "awtad": false,
        "arn": false,
        "nac": false,
        "rac": false,
        "errorTransit": false,
        "mra": -1,
        "mrr": -1,
        "conditionalRuleId": -1,
        "submittedDate": "11/05/2020 10:09:18",
        "sortSa": 1,
        "sa": false,
        "saad": false,
        "abstainActionStatus": 0,
        "isOptionalApproval": false
    }
]

Status
colourRed
title400

UI Expand
titleWrong Approval Name
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?appname=wrongappname
Code Block
{
    "errorCode": "issueapproval.approval.notexist",
    "errorMessage": "The approval referenced by the issueApproval does not exist",
    "status": 404
}

Status
colourRed
title400

UI Expand
titleEmpty Approval Name
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?username=admin&status=PENDING&appname=   
Code Block
{
    "errorCode": "issueapproval.appname.empty",
    "errorMessage": "If the paramenter appname is present it cannot be empty ",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleWrong User Name
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?username=wronguser   
Code Block
{
    "errorCode": "issueapproval.user.notfound",
    "errorMessage": "The user does not exists",
    "status": 404
}

Status
colourRed
title400

UI Expand
titleEmpty User Name
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?username=      
Code Block
{
    "errorCode": "issueapproval.username.empty",
    "errorMessage": "The username cannot be empty",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleWrong Status
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?status=WRONGSTATUS      
Code Block
{
    "errorCode": "issueapproval.status.notexist",
    "errorMessage": "The specified status does not exist. Use APPROVED, REJECTED, ABSTAINED, PENDING",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleEmpty Status
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals?status=   
Code Block
{
    "errorCode": "issueapproval.status.empty",
    "errorMessage": "If the paramenter status is present it cannot be empty ",
    "status": 400
}

Status
colourRed
title402

UI Expand
titleInvalid License
Code Block
{
	"errorCode": "license.invalid",
	"errorMessage": "License is invalid",
	"status": 402
}


Act on Requested Approvals

The following API is for performing operations on the items still hanging into the approval stage.


UI Expand
expandedtrue
titleOperate on Issue Approval

Status
colourBlue
titlePOST
/rest/herzum-hap-services/1.0/api/issueapprovals/{approvalId}/action


UI Expand
titleParameters
NameTypeDescriptionOptionality
approvalIdPath ParameterThe id of the IssueApproval we want to operateMandatory
ActionRequestBodyParameter

Example

Code Block
{
	"action"   : "APPROVE",
	"username" : "username", 
	"password" : "password" ,
	"comment" : "comment"
}
Optional
actionPart of Action RequestIt can be one of APPROVE, REJECT, ABSTAIN, RESETMandatory
usernamePart of Action RequestThe username of the current logged in user

Optional**

It can be required if configured into Approval Configuration

passwordPart of Action RequestThe password of the current logged in user

Optional**

It can be required if configured into Approval Configuration

commentPart of Action RequestThe comment to be set with the approval action

Optional**

It can be required if configured into Approval Configuration

UI Expand
expandedtrue
titleRequests / Responses
CodeRequest

Status
colourGreen
title200

UI Expand
expandedtrue
titleSuccessful Request
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "Name", 
	"password" : "Pwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "id": 11,
    "issueId": 10500,
    "approvalId": 3,
    "issueStatus": "10001",
    "approvalStatus": "APPROVED",
    "date": "08/05/2020 15:24:28",
    "approverUser": "admin",
    "transitionId": "21",
    "transitionName": "In Progress",
    "notificationDate": "Not Sent",
    "sourceStatusId": "10001",
    "type": "WORKFLOW",
    "defineCustomApproval": false,
    "awt": false,
    "awtr": false,
    "awtad": false,
    "arn": false,
    "nac": false,
    "rac": false,
    "errorTransit": false,
    "mra": -1,
    "mrr": -1,
    "conditionalRuleId": -1,
    "submittedDate": "08/05/2020 12:43:52",
    "sortSa": 1,
    "sa": false,
    "saad": false,
    "abstainActionStatus": 0,
    "isOptionalApproval": false
}

Status
colourRed
title400

UI Expand
titleWRONG ACTION
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "WRONG",
	"username" : "Name", 
	"password" : "Pwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.action.notexist",
    "errorMessage": "The specified action does not exist. Use APPROVE, REJECT, ABSTAIN, RESET",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleWRONG issueApprovalId
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/214124214/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "adminName", 
	"password" : "adminPwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.notexist",
    "errorMessage": "The specified issueApproval does not exist",
    "status": 404
}

Status
colourRed
title404

UI Expand
titleWRONG username
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "userdoesnotexist", 
	"password" : "adminPwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.user.notfound",
    "errorMessage": "The user does not exists",
    "status": 404
}

Status
colourRed
title403

UI Expand
titleUsername and Password mismatch
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "user", 
	"password" : "wrongpwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.credentials.wrong",
    "errorMessage": "The username and the password do not match",
    "status": 403
}

Status
colourRed
title403

UI Expand
titleUsername different than loggedin user
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "differentusername", 
	"password" : "pwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "username.notcorrespond",
    "errorMessage": "The username does not correspond to the loggedin user",
    "status": 403
}

Status
colourRed
title403

UI Expand
titleAction not allowed or the user does not have permission
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "username", 
	"password" : "pwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.action.unauthorized",
    "errorMessage": "The user cannot perform the required action",
    "status": 403
}

Status
colourRed
title400

UI Expand
titleAction Required
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"username" : "username", 
	"password" : "pwd" ,
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.action.required",
    "errorMessage": "The action parameter is required",
    "status": 400
}

Status
colourRed
title400

UI Expand
titlePassword Required by configuration
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.pwd.required",
    "errorMessage": "The password is required by the General Configuration",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleUsername Required by configuration
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"password"   : "password",
	"comment" : "comment"
}

Response

Code Block
{
    "errorCode": "issueapproval.username.required",
    "errorMessage": "The username is required by the General Configuration",
    "status": 400
}

Status
colourRed
title400

UI Expand
titleComment Required by configuration
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "username", 
	"password" : "pwd"
}

Response

Code Block
{
    "errorCode": "issueapproval.comment.required",
    "errorMessage": "The comment is set to be required by Configuration",
    "status": 400
}

Status
colourRed
title403

UI Expand
titleForbidden Action on OWls Issue Approvals
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "username", 
	"password" : "pwd"
}

Response

Code Block
{
    "errorCode": "issueapproval.action.owls",
    "errorMessage": "Action on configuration issueApprovals (OWLs) are on allowed",
    "status": 400
}

Status
colourRed
title403

UI Expand
titleAction disabled by configuration
Code Block
http://{{hostname}}/rest/herzum-hap-services/1.0/api/issueapprovals/11/action

Request

Code Block
{
	"action"   : "APPROVE",
	"username" : "username", 
	"password" : "pwd"
}

Response

Code Block
{
    "errorCode": "issueapproval.action.disabled",
    "errorMessage": "The action is disabled by Configuration",
    "status": 403
}

Status
colourRed
title402

UI Expand
titleInvalid License
Code Block
{
	"errorCode": "license.invalid",
	"errorMessage": "License is invalid",
	"status": 402
}