### Fetch Projects using Node.js Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects This Node.js example shows how to fetch projects from the Jira REST API v3 using the `axios` library. It makes a GET request to the `/rest/api/3/project` endpoint with an 'Accept: application/json' header. You'll need to have Node.js and `axios` installed (`npm install axios`). ```javascript const axios = require('axios'); async function getProjects() { try { const response = await axios.get('https://your-domain.atlassian.net/rest/api/3/project', { headers: { 'Accept': 'application/json' } }); console.log('Projects:', response.data); } catch (error) { console.error('Error fetching projects:', error); } } getProjects(); ``` -------------------------------- ### Get All Permissions Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permissions An example JSON response when successfully retrieving all Jira permissions. It lists permissions with their keys, names, descriptions, and types (e.g., GLOBAL, PROJECT). ```json { "permissions": { "BULK_CHANGE": { "description": "Ability to modify a collection of issues at once. For example, resolve multiple issues in one step.", "key": "BULK_CHANGE", "name": "Bulk Change", "type": "GLOBAL" } } } ``` -------------------------------- ### Fetch Projects using Python Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects This Python example demonstrates how to retrieve projects from the Jira REST API v3 using the `requests` library. It sends a GET request to the `/rest/api/3/project` endpoint with the 'application/json' Accept header. Make sure you have the `requests` library installed (`pip install requests`). ```python import requests url = "https://your-domain.atlassian.net/rest/api/3/project" headers = { "Accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print("Projects:", response.json()) else: print(f"Error: {response.status_code}") print(response.text) ``` -------------------------------- ### Get all labels API Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-labels An example of a successful 200 OK response from the GET /rest/api/3/label endpoint. It returns a paginated list of labels, including information about the pagination state and the list of label values. ```json { "isLast": false, "maxResults": 2, "startAt": 0, "total": 100, "values": [ "performance", "security" ] } ``` -------------------------------- ### Get User Permissions Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-permissions An example JSON response when successfully retrieving a user's permissions. It details the permission key, name, description, and whether the user has the permission. ```json { "permissions": { "EDIT_ISSUES": { "description": "Ability to edit issues.", "havePermission": true, "id": "12", "key": "EDIT_ISSUES", "name": "Edit Issues", "type": "PROJECT" } } } ``` -------------------------------- ### Example response for advanced settings Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jira-settings An example JSON response for the GET /rest/api/3/application-properties/advanced-settings endpoint, showing default values and current settings for various application properties. ```json [ { "defaultValue": "", "desc": "Jira home directory", "id": "jira.home", "key": "jira.home", "name": "jira.home", "type": "string", "value": "/var/jira/jira-home" }, { "defaultValue": "CLONE -", "id": "jira.clone.prefix", "key": "jira.clone.prefix", "name": "The prefix added to the Summary field of cloned issues", "type": "string", "value": "CLONE -" } ] ``` -------------------------------- ### Get Plans Paginated Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-plans Example JSON response for the 'Get plans paginated' API call, including pagination details and a list of plans with their IDs, issue sources, names, scenario IDs, and statuses. ```json { "cursor": "", "isLast": true, "maxResults": 2, "nextPageCursor": "2", "total": 10, "values": [ { "id": "100", "issueSources": [ { "type": "Project", "value": 10000 } ], "name": "Plan 1", "scenarioId": "200", "status": "Active" }, { "id": "200", "issueSources": [ { "type": "Board", "value": 20000 } ], "name": "Plan 2", "scenarioId": "300", "status": "Trashed" } ] } ``` -------------------------------- ### Get Workspace Data Policy Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-app-data-policies Example JSON response for a successful retrieval of the workspace data policy. ```json { "anyContentBlocked": false } ``` -------------------------------- ### Example Response for Get All Statuses Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflow-statuses An example JSON response when successfully retrieving all workflow statuses from the Jira REST API v3. ```json [ { "description": "The issue is currently being worked on.", "iconUrl": "https://your-domain.atlassian.net/images/icons/progress.gif", "id": "10000", "name": "In Progress", "self": "https://your-domain.atlassian.net/rest/api/3/status/10000", "statusCategory": { "colorName": "yellow", "id": 1, "key": "in-flight", "name": "In Progress", "self": "https://your-domain.atlassian.net/rest/api/3/statuscategory/1" } }, { "description": "The issue is closed.", "iconUrl": "https://your-domain.atlassian.net/images/icons/closed.gif", "id": "5", "name": "Closed", "self": "https://your-domain.atlassian.net/rest/api/3/status/5", "statusCategory": { "colorName": "green", "id": 9, "key": "completed", "self": "https://your-domain.atlassian.net/rest/api/3/statuscategory/9" } } ] ``` -------------------------------- ### Response example for Get all project categories Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-categories Example JSON response when successfully retrieving all project categories. It includes details like description, ID, name, and the self URL for each category. ```json [ { "description": "First Project Category", "id": "10000", "name": "FIRST", "self": "https://your-domain.atlassian.net/rest/api/3/projectCategory/10000" }, { "description": "Second Project Category", "id": "10001", "name": "SECOND", "self": "https://your-domain.atlassian.net/rest/api/3/projectCategory/10001" } ] ``` -------------------------------- ### Get Project Data with Python Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Shows a Python script to fetch Jira project details using the 'requests' library. This code makes a GET request to the Jira REST API v3 and prints the project data. Ensure you have the 'requests' library installed (`pip install requests`). ```python import requests import json def get_project_details(project_id_or_key): url = f"https://your-domain.atlassian.net/rest/api/3/project/{project_id_or_key}" headers = { "Accept": "application/json", "Authorization": "Basic YOUR_AUTH_TOKEN" # Replace with your auth token } response = requests.get(url, headers=headers) if response.status_code == 200: print("Project Details:", json.dumps(response.json(), indent=2)) return response.json() else: print(f"Error: {response.status_code}") print(response.text) return None get_project_details("{projectIdOrKey}") ``` -------------------------------- ### Get Jira Plan Example Response Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-plans Provides an example JSON response for retrieving a Jira plan. This structure includes details about the plan's configuration, such as its ID, name, associated releases, custom fields, exclusion rules, issue sources, permissions, and scheduling information. The response also contains metadata like `lastSaved` and `status`. ```json { "crossProjectReleases": [ { "name": "x-plr", "releaseIds": [ 345 ] } ], "customFields": [ { "customFieldId": 34, "filter": false }, { "customFieldId": 39, "filter": true } ], "exclusionRules": { "issueIds": [ 1, 2 ], "issueTypeIds": [ 13, 23 ], "numberOfDaysToShowCompletedIssues": 50, "releaseIds": [ 14, 24 ], "workStatusCategoryIds": [ 12, 22 ], "workStatusIds": [ 11, 21 ] }, "id": 23, "issueSources": [ { "type": "Project", "value": 12 }, { "type": "Filter", "value": 10293 } ], "lastSaved": "2024-10-03T10:15:30Z", "leadAccountId": "628f5e86d5ec1f006ne7363x2s", "name": "Onset TBJ Plan", "permissions": [ { "holder": { "type": "AccountId", "value": "04jekw86d5jjje006ne7363x2s" }, "type": "Edit" } ], "scheduling": { "dependencies": "Concurrent", "endDate": { "dateCustomFieldId": 1098, "type": "DateCustomField" }, "estimation": "Hours", "inferredDates": "ReleaseDates", "startDate": { "type": "TargetStartDate" } }, "status": "Active" } ``` -------------------------------- ### Get Project Components (Example) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components This snippet demonstrates how to retrieve all components associated with a Jira project. It requires appropriate project browsing permissions and specifies necessary OAuth scopes. ```http GET /rest/api/3/project/{projectIdOrKey}/component?componentSource={componentSource} ``` -------------------------------- ### Get Project Notification Scheme (Java) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Provides a Java example for fetching notification scheme details from a Jira project using the REST API. This snippet illustrates the necessary steps to construct and execute the HTTP GET request. ```java OkHttpClient client = new OkHttpClient().newBuilder().build(); Request request = new Request.Builder() .url("https://your-domain.atlassian.net/rest/api/3/project/{projectKeyOrId}/notificationscheme") .addHeader("Accept", "application/json") .addHeader("Authorization", "Basic YWxhZGRpbjpjaGFuZ2VsbW1l").build(); Response response = client.newCall(request).execute(); ``` -------------------------------- ### Search Projects using curl Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Demonstrates how to search for projects using the curl command-line tool. This example shows a basic GET request to the /rest/api/3/project/search endpoint. ```shell curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/3/project/search?maxResults=2&startAt=0' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ' ``` -------------------------------- ### Get Issue Changelogs Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues Example JSON response for the GET /rest/api/3/issue/{issueIdOrKey}/changelog endpoint, detailing issue history, author information, creation timestamp, and changes made. ```json { "isLast": false, "maxResults": 2, "nextPage": "https://your-domain.atlassian.net/rest/api/3/issue/TT-1/changelog?&startAt=4&maxResults=2", "self": "https://your-domain.atlassian.net/rest/api/3/issue/TT-1/changelog?startAt=2&maxResults=2", "startAt": 2, "total": 5, "values": [ { "author": { "accountId": "5b10a2844c20165700ede21g", "active": true, "avatarUrls": { "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16", "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24", "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32", "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48" }, "displayName": "Mia Krystof", "emailAddress": "mia@example.com", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g", "timeZone": "Australia/Sydney" }, "created": "1970-01-18T06:27:50.429+0000", "id": "10001", "items": [ { "field": "fields", "fieldtype": "jira", "fieldId": "fieldId", "from": null, "fromString": "", "to": null, "toString": "label-1" } ] }, { "author": { "accountId": "5b10a2844c20165700ede21g", "active": true, "avatarUrls": { "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16", "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24", "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32", "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48" }, "displayName": "Mia Krystof", "emailAddress": "mia@example.com", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g", "timeZone": "Australia/Sydney" }, "created": "1970-01-18T06:27:51.429+0000", "id": "10002", "items": [ { "field": "fields", "fieldtype": "jira", "fieldId": "fieldId", "from": null, "fromString": "label-1", "to": null, "toString": "label-1 label-2" } ] } ] } ``` -------------------------------- ### Get User Nav Property (Python) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-other-operations Python example using the requests library to get a user navigation property. Handles authentication and response parsing. ```python import requests def get_user_nav_property(api_token, property_key, account_id): url = f"https://your-domain.atlassian.net/rest/api/3/user/nav4-opt-property/{property_key}?accountId={account_id}" headers = { "Accept": "application/json" } response = requests.get(url, headers=headers, auth=('your-email@example.com', api_token)) print(f"Status Code: {response.status_code}") print(response.json()) return response.json() ``` -------------------------------- ### Get Project Components (Curl) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components This example demonstrates how to fetch project components using cURL. It makes a GET request to the Jira REST API v3 endpoint for project components. ```bash curl -H "Accept: application/json" "https://your-domain.atlassian.net/rest/api/3/project/{projectIdOrKey}/component" ``` -------------------------------- ### Example Response for Get Issue Navigator Default Columns Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-navigator-settings An example JSON response showing the structure of default columns returned by the API, typically including labels and their corresponding values. ```json [ { "label": "Key", "value": "issuekey" }, { "label": "Summary", "value": "summary" } ] ``` -------------------------------- ### Get Project Data Policies (Java) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-app-data-policies Example in Java for fetching project data policies. Requires the 'read:jira-work' scope and proper authentication. Connect apps are excluded from using this resource. ```java // This sample uses the Apache HttpClient library // https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; String baseUrl = "https://your-domain.atlassian.net"; String projectKeys = "projectKey1,projectKey2"; try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet request = new HttpGet(baseUrl + "/rest/api/3/data-policy/project?ids=" + projectKeys); // Add authentication headers here request.setHeader("Accept", "application/json"); httpClient.execute(request, response -> { System.out.println("Status: " + response.getStatusLine()); System.out.println("Body: " + EntityUtils.toString(response.getEntity())); return null; }); } catch (Exception e) { e.printStackTrace(); } ``` -------------------------------- ### Get Screen Schemes (Python) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-schemes Retrieves a paginated list of screen schemes using Python. This example uses the 'requests' library to make a GET request to the Jira API. ```python import requests url = "https://your-domain.atlassian.net/rest/api/3/screenscheme" headers = { "Accept": "application/json" } response = requests.get(url, headers=headers) print(response.status_code) print(response.json()) ``` -------------------------------- ### Get all labels (Node.js) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-labels Provides a Node.js example for fetching a paginated list of labels from Jira Cloud via the REST API v3. It uses the 'request' library to make the GET request to /rest/api/3/label. ```javascript const request = require('request'); const options = { method: 'GET', url: 'https://your-domain.atlassian.net/rest/api/3/label', headers: { 'Accept': 'application/json', 'Authorization': 'Basic YOUR_AUTH_TOKEN' } }; request(options, function (error, response) { if (error) throw new Error(error); console.log(response.body); }); ``` -------------------------------- ### Get User Nav Property (curl) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-other-operations Example using curl to get a user navigation property. Requires appropriate authentication and permissions. ```bash curl -s -X GET \ -H "Accept: application/json" \ "https://your-domain.atlassian.net/rest/api/3/user/nav4-opt-property/{propertyKey}?accountId=5b10ac8d82e05b22cc7d4ef5" ``` -------------------------------- ### Get Workflows API Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-workflows An example of the JSON response structure when retrieving a list of Jira workflows. It includes details like workflow name, description, last modified date, and the number of steps. ```json [ { "default": true, "description": "A classic Jira workflow", "lastModifiedDate": "01-01-2011", "lastModifiedUser": "admin", "lastModifiedUserAccountId": "5b10a2844c20165700ede21g", "name": "classic workflow", "steps": 5 } ] ``` -------------------------------- ### Get Screen Schemes (PHP) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-schemes Retrieves a paginated list of screen schemes using PHP. This example uses cURL to make a GET request to the Jira API. ```php ``` -------------------------------- ### Get User Nav Property (Java) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-other-operations Java example using Apache HttpClient to get a user navigation property. Handles request and response processing. ```java import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; public class JiraApiUtil { public static void getUserNavProperty(String propertyKey, String accountId) throws IOException { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet request = new HttpGet( String.format("https://your-domain.atlassian.net/rest/api/3/user/nav4-opt-property/%s?accountId=%s", propertyKey, accountId)); request.addHeader("Accept", "application/json"); // Add authentication header here (e.g., Basic Auth or OAuth) httpClient.execute(request, response -> { System.out.println("Status Code: " + response.getStatusLine().getStatusCode()); String json = EntityUtils.toString(response.getEntity()); System.out.println("Response Body: " + json); return null; }); } } } ``` -------------------------------- ### Search Projects using PHP Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects A PHP example demonstrating how to search for Jira projects using cURL. This code makes a GET request to the project search API and outputs the result. ```php "; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } curl_close($ch); // Assuming result is JSON, you might want to decode it: // $data = json_decode($result, true); // print_r($data); echo $result; ?> ``` -------------------------------- ### Get Project Data Policies (Example Response) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-app-data-policies An example JSON response structure for project data policies. It details the 'projectDataPolicies' array, where each item contains 'dataPolicy' (with 'anyContentBlocked') and an 'id'. ```json { "projectDataPolicies": [ { "dataPolicy": { "anyContentBlocked": false }, "id": 1000 }, { "dataPolicy": { "anyContentBlocked": true }, "id": 1001 } ] } ``` -------------------------------- ### Get JQL Autocomplete Data (PHP) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jql Demonstrates fetching JQL autocomplete data with PHP. This example outlines the process of making a GET request to the Jira API endpoint, ensuring the 'Accept: application/json' header is correctly set. ```php // Example for PHP - replace with your actual cURL or stream context logic // $ch = curl_init("/rest/api/3/jql/autocompletedata"); // curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json')); // $response = curl_exec($ch); // curl_close($ch); // echo $response; ``` -------------------------------- ### Get Screen Schemes (Node.js) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-schemes Retrieves a paginated list of screen schemes using Node.js. This example uses the 'request' library to make a GET request to the Jira API. ```javascript const request = require('request'); const options = { method: 'GET', url: 'https://your-domain.atlassian.net/rest/api/3/screenscheme', headers: { Accept: 'application/json' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(response.statusCode); console.log(body); }); ``` -------------------------------- ### Get Screen Schemes (Java) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-schemes Retrieves a paginated list of screen schemes using Java. This example utilizes Apache HttpClient to perform a GET request to the Jira API. ```java import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; public class GetScreenSchemes { public static void main(String[] args) throws Exception { try (CloseableHttpClient client = HttpClients.createDefault()) { HttpGet request = new HttpGet("https://your-domain.atlassian.net/rest/api/3/screenscheme"); request.addHeader("Accept", "application/json"); client.execute(request, response -> { System.out.println(response.getStatusLine().getStatusCode()); System.out.println(EntityUtils.toString(response.getEntity())); return null; }); } } } ``` -------------------------------- ### Get Jira Project Components using Node.js Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-components Demonstrates how to fetch project components from the Jira REST API using Node.js. This example utilizes a hypothetical 'apiClient' for making the GET request and expects a JSON response. ```javascript const apiClient = require('../utils/apiClient'); async function getProjectComponents(projectKeyOrId) { try { const response = await apiClient.get(`/rest/api/3/project/${projectKeyOrId}/components`); console.log('Project Components:', JSON.stringify(response.data, null, 2)); return response.data; } catch (error) { console.error('Error fetching project components:', error); throw error; } } // Example usage: // getProjectComponents('YOUR_PROJECT_KEY_OR_ID'); ``` -------------------------------- ### Get Jira Configuration using cURL Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jira-settings A command-line example using cURL to fetch Jira configuration details. It specifies the API endpoint and the expected JSON response format. ```bash curl --request GET \ --url '/rest/api/3/configuration' \ --header "Accept: application/json" ``` -------------------------------- ### Example Response for Application Properties Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-jira-settings Provides an example of the JSON response when retrieving application properties, showcasing default values, descriptions, IDs, keys, names, types, and current values. ```json [ { "defaultValue": "", "desc": "Jira home directory", "id": "jira.home", "key": "jira.home", "name": "jira.home", "type": "string", "value": "/var/jira/jira-home" }, { "defaultValue": "CLONE -", "id": "jira.clone.prefix", "key": "jira.clone.prefix", "name": "The prefix added to the Summary field of cloned issues", "type": "string", "value": "CLONE -" } ] ``` -------------------------------- ### Get Project Notification Scheme (curl) Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Demonstrates how to retrieve the notification scheme details for a Jira project using `curl`. This command-line example sends a GET request to the specified API endpoint with appropriate authentication headers. ```bash curl --request GET \ --url 'https://your-domain.atlassian.net/rest/api/3/project/{projectKeyOrId}/notificationscheme' \ --header 'Accept: application/json' \ --user 'email:apiToken' ``` -------------------------------- ### Issue Data Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search An example of the JSON response structure for issue data, including details about issuelinks and worklogs. ```APIDOC ## GET /rest/api/3/issue/{issueIdOrKey} ### Description Retrieves the details of a specific Jira issue, including its links to other issues and worklog information. ### Method GET ### Endpoint /rest/api/3/issue/{issueIdOrKey} ### Parameters #### Path Parameters - **issueIdOrKey** (string) - Required - The ID or key of the issue to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the issue. - **key** (string) - The key of the issue (e.g., 'PR-2'). - **self** (string) - The URL of the issue. - **fields** (object) - Contains various fields related to the issue, such as status, summary, and assignees. - **issuelinks** (array) - A list of issues linked to the current issue. - **id** (string) - The ID of the issue link. - **outwardIssue** (object) - Details of the issue linked in an outward direction. - **inwardIssue** (object) - Details of the issue linked in an inward direction. - **type** (object) - The type of link between the issues. - **worklog** (array) - A list of worklogs recorded for the issue. - **author** (object) - Information about the user who recorded the worklog. - **comment** (string) - The comment associated with the worklog. - **timeSpent** (string) - The time spent on the worklog. - **started** (string) - The start date and time of the worklog. - **updated** (string) - The last update date and time of the worklog. - **visibility** (object) - The visibility settings for the worklog. - **timetracking** (object) - Information about time tracking for the issue. #### Response Example ```json { "id": "10002", "key": "ED-1", "self": "https://your-domain.atlassian.net/rest/api/3/issue/10002", "fields": { "issuelinks": [ { "id": "10001", "outwardIssue": { "fields": { "status": { "name": "Open" } }, "id": "10004L", "key": "PR-2", "self": "https://your-domain.atlassian.net/rest/api/3/issue/PR-2" }, "type": { "name": "Dependent" } }, { "id": "10002", "inwardIssue": { "fields": { "status": { "name": "Open" } }, "id": "10004", "key": "PR-3", "self": "https://your-domain.atlassian.net/rest/api/3/issue/PR-3" }, "type": { "name": "Dependent" } } ], "worklog": [ { "author": { "displayName": "Mia Krystof", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g" }, "comment": "I did some work here.", "id": "100028", "issueId": "10002", "self": "https://your-domain.atlassian.net/rest/api/3/issue/10010/worklog/10000", "started": "2021-01-17T12:34:00.000+0000", "timeSpent": "3h 20m", "timeSpentSeconds": 12000, "updateAuthor": { "displayName": "Mia Krystof", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g" }, "updated": "2021-01-18T23:45:00.000+0000", "visibility": { "type": "group", "value": "jira-developers" } } ] }, "updated": 1, "timetracking": { "originalEstimate": "10m", "remainingEstimate": "3m", "timeSpent": "6m" } } ``` ``` -------------------------------- ### Fetch Jira Project Information in Java Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Illustrates how to retrieve Jira project details using Java. This example utilizes the Apache HttpClient library for making the GET request to the Jira REST API. It handles JSON parsing for the response. ```java import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; import java.io.IOException; public class JiraProjectFetcher { public void getProjectDetails(String projectIdOrKey) { try (CloseableHttpClient httpClient = HttpClients.createDefault()) { HttpGet request = new HttpGet("https://your-domain.atlassian.net/rest/api/3/project/" + projectIdOrKey); request.addHeader("Accept", "application/json"); request.addHeader("Authorization", "Basic YOUR_AUTH_TOKEN"); // Replace with your auth token String responseBody = httpClient.execute(request, httpResponse -> { int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode >= 200 && statusCode < 300) { return EntityUtils.toString(httpResponse.getEntity()); } else { throw new IOException("Unexpected status code: " + statusCode); } }); System.out.println("Project Details: " + responseBody); } catch (IOException e) { e.printStackTrace(); } } public static void main(String[] args) { JiraProjectFetcher fetcher = new JiraProjectFetcher(); fetcher.getProjectDetails("{projectIdOrKey}"); } } ``` -------------------------------- ### Example Jira Project JSON Response Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects This is a sample JSON response obtained from the Jira REST API v3 when requesting project details. It includes information about the project's avatar, components, description, and issue types. ```json { "assigneeType": "PROJECT_LEAD", "avatarUrls": { "16x16": "https://your-domain.atlassian.net/secure/projectavatar?size=xsmall&pid=10000", "24x24": "https://your-domain.atlassian.net/secure/projectavatar?size=small&pid=10000", "32x32": "https://your-domain.atlassian.net/secure/projectavatar?size=medium&pid=10000", "48x48": "https://your-domain.atlassian.net/secure/projectavatar?size=large&pid=10000" }, "components": [ { "ari": "ari:cloud:compass:fdb3fdec-4e70-be56-11ee-0242ac120002:component/fdb3fdec-4e70-11ee-be56-0242ac120002/fdb3fdec-11ee-4e70-be56-0242ac120002", "assignee": { "accountId": "5b10a2844c20165700ede21g", "accountType": "atlassian", "active": false, "avatarUrls": { "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16", "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24", "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32", "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48" }, "displayName": "Mia Krystof", "key": "", "name": "", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g" }, "assigneeType": "PROJECT_LEAD", "description": "This is a Jira component", "id": "10000", "isAssigneeTypeValid": false, "lead": { "accountId": "5b10a2844c20165700ede21g", "accountType": "atlassian", "active": false, "avatarUrls": { "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16", "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24", "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32", "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48" }, "displayName": "Mia Krystof", "key": "", "name": "", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g" }, "metadata": { "icon": "https://www.example.com/icon.png" }, "name": "Component 1", "project": "HSP", "projectId": 10000, "realAssignee": { "accountId": "5b10a2844c20165700ede21g", "accountType": "atlassian", "active": false, "avatarUrls": { "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16", "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24", "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32", "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48" }, "displayName": "Mia Krystof", "key": "", "name": "", "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g" }, "realAssigneeType": "PROJECT_LEAD", "self": "https://your-domain.atlassian.net/rest/api/3/component/10000" } ], "description": "This project was created as an example for REST.", "email": "from-jira@example.com", "id": "10000", "insight": { "lastIssueUpdateTime": "2021-04-22T05:37:05.000+0000", "totalIssueCount": 100 }, "issueTypes": [ { "avatarId": 1, "description": "A task that needs to be done.", "hierarchyLevel": 0, "iconUrl": "https://your-domain.atlassian.net/secure/viewavatar?size=xsmall&avatarId=10299&avatarType=issuetype", "id": "3", "name": "Task", "self": "https://your-domain.atlassian.net/rest/api/3/issueType/3", "subtask": false }, { "avatarId": 10002, "description": "A problem with the software.", "entityId": "9d7dd6f7-e8b6-4247-954b-7b2c9b2a5ba2", "hierarchyLevel": 0, "iconUrl": "https://your-domain.atlassian.net/secure/viewavatar?size=xsmall&avatarId=10316&avatarType=issuetype" } ] } ``` -------------------------------- ### Get Attachment Content (Expanded Raw) - cURL Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments Example of how to get the raw content of an attachment using a GET request with an expand parameter. This operation requires the attachment 'id' and appropriate project browsing permissions. ```curl curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ "https://your-domain.atlassian.net/rest/api/3/attachment/{id}/expand/raw" ``` -------------------------------- ### Retrieve Project Details in PHP Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Demonstrates fetching Jira project details using PHP. This example uses cURL to make the HTTP GET request to the Jira REST API. It outputs the raw JSON response. ```php <\?php function getProjectDetails($projectIdOrKey) { $url = "https://your-domain.atlassian.net/rest/api/3/project/{$projectIdOrKey}"; $headers = [ 'Accept: application/json', 'Authorization: Basic YOUR_AUTH_TOKEN' // Replace with your auth token ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { if ($httpCode == 200) { echo "Project Details: "; echo $response; } else { echo "Error: " . $httpCode . "\n"; echo $response; } } curl_close($ch); return $response; } getProjectDetails('{projectIdOrKey}'); ?> ``` -------------------------------- ### Get Attachment Content (Expanded Human) - cURL Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments Example of how to get a human-readable representation of attachment content using a GET request with an expand parameter. This operation requires the attachment 'id' and relevant project browsing permissions. ```curl curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ "https://your-domain.atlassian.net/rest/api/3/attachment/{id}/expand/human" ``` -------------------------------- ### Jira Cloud Platform REST API v3 Overview Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro Introduction to the Jira REST API v3, its capabilities, and its purpose for programmatic integration with Jira. ```APIDOC ## About Jira REST API v3 ### Description The Jira REST API enables you to interact with Jira programmatically. Use this API to build apps, script interactions with Jira, or develop any other type of integration. This page documents the REST resources available in Jira Cloud, including the HTTP response codes and example requests and responses. ### Version Information This documentation is for **version 3** of the Jira Cloud platform REST API, which is the latest version. Version 2 and version 3 of the API offer the same collection of operations. However, version 3 provides support for the Atlassian Document Format (ADF) in: * `body` in comments, including where comments are used in issue, issue link, and transition resources. * `comment` in worklogs. * `description` and `environment` fields in issues. * `textarea` type custom fields (multi-line text fields) in issues. Single line custom fields (`textfield`) accept a string and don't handle Atlassian Document Format content. ``` -------------------------------- ### GET Jira API v3 Version Unresolved Issue Count Response Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-project-versions Example JSON response for getting the unresolved issue count of a Jira version. ```json { "issuesCount": 30, "issuesUnresolvedCount": 23, "self": "https://your-domain.atlassian.net/rest/api/3/version/10000" } ``` -------------------------------- ### Get Jira Project Details using Node.js Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-projects Provides a Node.js example for fetching Jira project details. This snippet assumes the use of a library like 'axios' for making HTTP requests. It targets the Jira REST API v3 and expects a JSON response. ```javascript const axios = require('axios'); async function getProjectDetails(projectIdOrKey) { const url = `https://your-domain.atlassian.net/rest/api/3/project/${projectIdOrKey}`; const headers = { 'Accept': 'application/json', 'Authorization': 'Basic YOUR_AUTH_TOKEN' // Replace with your auth token }; try { const response = await axios.get(url, { headers }); console.log('Project Details:', response.data); return response.data; } catch (error) { console.error('Error fetching project details:', error.response ? error.response.data : error.message); } } getProjectDetails('{projectIdOrKey}'); ``` -------------------------------- ### Get Attachment Thumbnail - cURL Example Source: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-attachments Example of how to retrieve a thumbnail of an attachment using a GET request. It requires the attachment 'id' and the 'Browse projects' permission. ```curl curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ "https://your-domain.atlassian.net/rest/api/3/attachment/thumbnail/{id}" ```