Making requests
Every call to Jira or Confluence through API Key Manager is a single HTTP POST to the app's Endpoint URL.
The Endpoint URL
The URL is shown at the top of the app's main page. It is the same for all keys of one installation. A request is only honoured with a valid key, but it is still good practice to keep the URL out of public repositories and web pages.
The HTTP request
| Part | Value |
|---|---|
| Method | POST |
| URL | Your Endpoint URL |
Header apikey | Your API key |
Header Content-Type | application/json (recommended) |
| Body | The JSON envelope below |
The envelope
The body describes the request you want the app to make to Jira or Confluence:
{
"options": {
"method": "GET",
"headers": {
"Content-Type": "application/json",
"Accept": "application/json"
},
"body": { }
},
"url": "/rest/api/3/issue/DEV-78"
}
| Field | Required | Description |
|---|---|---|
url | yes | The API path, starting with /, including a query string if you need one. Not a full URL: the request always goes to your own site. Jira paths start with /rest/, Confluence paths with /wiki/. |
options.method | yes | The HTTP method to use: GET, POST, PUT, DELETE, … in upper case. Must be allowed by the key. |
options.headers | no | Headers for the request to Atlassian, typically Content-Type and Accept. |
options.body | no | The request body for Atlassian, as a JSON object (not as a string). |
The apikey header belongs to the outer request, not into options.headers.
Examples
Read an issue (Jira)
{
"options": { "method": "GET", "headers": { "Accept": "application/json" } },
"url": "/rest/api/3/issue/DEV-78"
}
Create an issue (Jira)
{
"options": {
"method": "POST",
"headers": { "Content-Type": "application/json", "Accept": "application/json" },
"body": {
"fields": {
"project": { "id": "10005" },
"summary": "Created through API Key Manager",
"issuetype": { "id": "10017" }
}
}
},
"url": "/rest/api/2/issue"
}
Read a page (Confluence)
{
"options": { "method": "GET", "headers": { "Accept": "application/json" } },
"url": "/wiki/rest/api/content/12345?expand=body.storage"
}
Search with a query string
Put the query string into url. Encode special characters as you would in any URL.
{
"options": { "method": "GET", "headers": { "Accept": "application/json" } },
"url": "/rest/api/3/search/jql?jql=project%20%3D%20DEV&fields=summary,status"
}
Ready-made versions of these in many languages are in the samples.
What the app checks before forwarding
- The request has an
apikeyheader and a valid JSON body. - The key exists and has not expired.
options.methodis allowed for the key, andurlis allowed by its endpoints.- For Create Issue and Stored JQL keys, the key's additional rules (Jira only).
If a check fails, the request is not forwarded. See Errors.