Writing Apex Class codes to call for Connector REST APIs

In addition to Endpoints, the Connector provides the ability to create Jira Issues using Connector REST APIs, which can be used in an Apex Class.

All Apex Class codes provided are also provided on our Bitbucket Repository for your reference.

(warning) This setup can only be used if your Jira instance is not behind a firewall.

Consult these related pages for more examples:

Connector REST API definition

The API can be described as:

Title

Item

HTTP Method

POST

URL

<Jira URL>/rest/customware/connector/1.0/{systemId}/{objectType}/{objectId}/issue/create.{accept}

Produces

APPLICATION_JSON

Consumes

APPLICATION_JSON

Data Input

{
"project" : "<project key>",
"issueType" : "<issue type>",
}

Using cURL, it can be constructed like this:

curl -i -H "Content-Type: application/json" -H "Authorization: Basic <64bit encoded username and password>" -X POST https://example.com/rest/customware/connector/1.0/1/Case/50090002N5r6/issue/create.json -d'{"project":"SFDC", "issueType":"1"}'

Description

The Connector provides three actions that can be performed in calling its REST APIs, namely:

  1. Create
  2. Synchronize
  3. Fetch

They are all using a similar pattern of endpoint.

Endpoint: <Jira URL>/rest/customware/connector/1.0/{systemId}/{objectType}/{objectId}/issue/{action}.{accept}

Action

HTTP method

Produces

{action}

Example

Data Input

Create

POST

APPLICATION_JSON

create

https://example.com/rest/customware/connector/1.0/1/Case/50090002N5r6/issue/create.json


"project" : "<project key>", 
"issueType" : "<issue type>", 
}

Synchronize

PUT

APPLICATION_JSON

synchronize

https://example.com/rest/customware/connector/1.0/1/Case/50090002N5r6/issue/synchronize.json

-

Fetch

GET

APPLICATION_JSON

fetch

https://example.com/rest/customware/connector/1.0/1/Case/50090002N5r6/issue/fetch.json

-