### Example: Get List of Projects Source: https://developer.atlassian.com/server/jira/platform/oauth An example of using the OAuth client to retrieve a list of projects from the Jira REST API. The response is a JSON array of project objects. ```bash java -jar OAuthTutorialClient-1.0.jar request http://localhost:8080/rest/api/latest/project ``` -------------------------------- ### Jira Startup Output Example Source: https://developer.atlassian.com/server/jira/platform/creating-workflow-extensions This output indicates that Tomcat has started and Jira is successfully running. Note the port and URL for accessing your Jira instance. ```text [INFO] [talledLocalContainer] Tomcat 6.x started on port [2990] [INFO] jira started successfully in 149s at http://atlas-laptop:2990/jira [INFO] Type Ctrl-D to shutdown gracefully [INFO] Type Ctrl-C to exit ``` -------------------------------- ### Jira Startup Confirmation Source: https://developer.atlassian.com/server/jira/platform/creating-a-custom-field-in-jira This output indicates that Jira has successfully started with your app installed. Note the URL for accessing your Jira instance. ```bash [INFO] jira started successfully in 71s at http://localhost:2990/jira [INFO] Type CTRL-D to shutdown gracefully [INFO] Type CTRL-C to exit ``` -------------------------------- ### Get All Boards Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-board Example JSON response when successfully retrieving a list of boards. It includes the board's ID, name, self URL, and type. ```json { "id": 10001, "name": "Scrum Board", "self": "http://www.example.com/jira/rest/agile/1.0/board/10001", "type": "scrum" } ``` -------------------------------- ### Clone App Source Code Source: https://developer.atlassian.com/server/jira/platform/adding-content-to-the-jira-view-issue-page Clone the tutorial's app source code from Bitbucket to check your work or get started. ```bash git clone https://bitbucket.org/atlassian_tutorial/jira-add-content-to-view-issue-screen ``` -------------------------------- ### Customizing Page Setup for JIRA Excel Output Source: https://developer.atlassian.com/server/jira/platform/customizing-jira-excel-output This example demonstrates how to customize page setup settings like orientation, margins, and footers in JIRA's Excel export using @page CSS definitions. ```html ``` -------------------------------- ### Run Jira Development Server Source: https://developer.atlassian.com/server/jira/platform/creating-a-project-template Execute this command in your project's root directory to build, install, and run your Jira app with the custom project template. This command starts a local Jira instance for testing. ```bash atlas-run ``` -------------------------------- ### Complete atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/jira/platform/adding-menu-items-to-jira This is a complete example of the atlassian-plugin.xml file, including the plugin information, resources, and the custom web section and web items. ```xml ${project.description} ${project.version} images/pluginIcon.png images/pluginLogo.png com.atlassian.auiplugin:ajs jira-menu-items http://www.atlassian.com http://www.atlassian.com http://confluence.atlassian.com ``` -------------------------------- ### Get All Cluster Nodes Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-cluster Example JSON response for the 'Get all cluster nodes' API call. ```json { "alive": true, "cacheListenerPort": 2154, "ip": "", "lastStateChangeTimestamp": 2154, "nodeBuildNumber": 2154, "nodeId": "", "nodeVersion": "", "state": "ACTIVE" } ``` -------------------------------- ### Complete atlassian-plugin.xml Example Source: https://developer.atlassian.com/server/jira/platform/writing-gadgets-for-jira This is a complete example of the atlassian-plugin.xml file, including plugin info, gadget declaration, message bundle resource, and REST module configuration. ```xml A sample plugin showing how to add a gadget to JIRA. 1.0 Provides the REST resource for the project list. ``` -------------------------------- ### Get User Anonymization Rerun Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-user Example response for validating a user anonymization re-run process. ```json { "affectedEntities": {}, "businessLogicValidationFailed": true, "deleted": false, "displayName": "Fred Flinston", "email": "fred@example.com", "errors": {}, "expand": "", "operations": [ "USER_TRANSFER_OWNERSHIP_PLUGIN_POINTS", "USER_DISABLE", "USER_KEY_CHANGE_PLUGIN_POINTS", "USER_KEY_CHANGE", "USER_NAME_CHANGE_PLUGIN_POINTS", "USER_NAME_CHANGE", "USER_EXTERNAL_ID_CHANGE", "USER_ANONYMIZE_PLUGIN_POINTS" ], "success": true, "userKey": "JIRAUSER10100", "userName": "fred", "warnings": {} } ``` -------------------------------- ### Get Issue Link Type Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-issuelinktype Example response for a successful GET request to retrieve an issue link type. ```json { "id": "10000", "inward": "is duplicated by", "name": "Duplicate", "outward": "duplicates", "self": "http://www.example.com/jira/rest/api/2/issueLinkType/10000" } ``` -------------------------------- ### Example Plugin Info Block for Data Center Compatibility Source: https://developer.atlassian.com/server/jira/platform/developing-for-high-availability-and-clustering This example shows a complete plugin-info block including the Data Center compatibility parameters. ```xml ${project.description} ${project.version} compatible true ``` -------------------------------- ### Get Version Unresolved Issues Count Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-version Example JSON response for the Get Version Unresolved Issues Count endpoint. ```json { "issuesUnresolvedCount": 23, "self": "http://www.example.com/jira/rest/api/2/version/10000" } ``` -------------------------------- ### Example Created Project Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-project A sample JSON response indicating successful project creation. ```json { "id": 10010, "key": "EX", "self": "http://example/jira/rest/api/2/project/10042" } ``` -------------------------------- ### Get Issue Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/intro Example of how to retrieve an issue using its ID or key with cURL. ```APIDOC ## GET /rest/api/2/issue/{issueIdOrKey} ### Description Retrieves details of a specific issue. ### Method GET ### Endpoint http://localhost:8080/jira/rest/api/2/issue/{issueIdOrKey} ### Parameters #### Path Parameters - **issueIdOrKey** (string) - Required - The ID or key of the issue to retrieve. ### Request Example ```bash curl -u admin:admin http://localhost:8080/jira/rest/api/2/issue/TEST-10 | python -mjson.tool ``` ### Response #### Success Response (200) - **id** (string) - The ID of the issue. - **key** (string) - The key of the issue. - **self** (string) - The URL of the issue. #### Response Example ```json { "id":"10009", "key":"TEST-10", "self":"http://localhost:8080/jira/rest/api/2/issue/10009" } ``` ``` -------------------------------- ### Worklog List Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-worklog Example JSON response for the 'Get Worklogs by IDs' endpoint, detailing a single worklog entry with author, comment, timestamps, and visibility. ```json { "author": { "active": true, "avatarUrls": {}, "displayName": "Fred F. User", "emailAddress": "fred@example.com", "key": "fred", "name": "Fred", "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "timeZone": "Australia/Sydney" }, "comment": "I did some work here.", "created": "2010-07-14T18:23:23.733+0000", "id": "100028", "issueId": "10002", "self": "http://www.example.com/jira/rest/api/2/issue/10010/worklog/10000", "started": "2010-07-14T18:23:23.733+0000", "timeSpent": "3h 20m", "timeSpentSeconds": 12000, "updateAuthor": { "active": true, "avatarUrls": {}, "displayName": "Fred F. User", "emailAddress": "fred@example.com", "key": "fred", "name": "Fred", "self": "http://www.example.com/jira/rest/api/2/user?username=fred", "timeZone": "Australia/Sydney" }, "updated": "2010-07-14T18:23:23.733+0000", "visibility": { "type": "group", "value": "jira-software-users" } } ``` -------------------------------- ### Web Resource Configuration Example Source: https://developer.atlassian.com/server/jira/platform/web-resource This example shows the basic structure for declaring a web resource module in a Jira plugin's configuration. The `key` attribute is mandatory for identifying the resource. ```xml com.atlassian.aui:ajs-editor jira-core-user-profile ``` -------------------------------- ### Build the Maven Client Source: https://developer.atlassian.com/server/jira/platform/oauth Execute this command in the terminal from the 'java' directory to compile and package the client application. This prepares the client for use in the OAuth example. ```bash mvn clean compile assembly:single ``` -------------------------------- ### Worklog Deleted Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-worklog Example JSON response for the 'Get Deleted Worklogs' endpoint, showing pagination details and a list of deleted worklog entries with their update times. ```json { "isLastPage": true, "lastPage": true, "nextPage": "http://www.example.com/jira/rest/api/2/worklog/updated?since=1438013693136", "self": "http://www.example.com/jira/rest/api/2/worklog/updated?since=1438013671136", "since": 1438013671562, "until": 1438013693136, "values": [ { "updatedTime": 1438013671562, "worklogId": 103 } ] } ``` -------------------------------- ### Initialize HelpUtil for Jira help URLs Source: https://developer.atlassian.com/server/jira/platform/extending-jira-help-links Use HelpUtil.getInstance() or new HelpUtil() to get Jira's default help URLs. For custom properties, use new HelpUtil(Properties). ```java HelpUtil.getInstance() ``` ```java new HelpUtil() ``` ```java new HelpUtil(Properties) ``` -------------------------------- ### Get Jira Server Info (Python) Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-serverinfo This Python script fetches Jira server information using the `requests` library. Ensure you have `requests` installed (`pip install requests`). ```python import requests def get_jira_server_info(base_url, email, api_token): url = f"{base_url}/rest/api/2/serverInfo" headers = { "Accept": "application/json" } try: response = requests.get(url, headers=headers, auth=(email, api_token)) response.raise_for_status() # Raise an exception for bad status codes return response.json() except requests.exceptions.RequestException as e: print(f"Error fetching Jira server info: {e}") return None # Example usage: # base_url = 'http://your-jira-instance.com' # email = 'your-email@example.com' # api_token = 'your-api-token' # server_info = get_jira_server_info(base_url, email, api_token) # if server_info: # print(server_info) ``` -------------------------------- ### Java Example: Accessing Assets Facade Source: https://developer.atlassian.com/server/jira/platform/assets-app-development This Java example demonstrates how to inject and use the `ObjectFacade` to load Assets objects by their key within your plugin. ```java ... import com.riadalabs.jira.plugins.insight.channel.external.api.facade.ObjectFacade; import com.riadalabs.jira.plugins.insight.services.model.ObjectBean; public class MyPluginResource { ... private final ObjectFacade objectFacade; ... public MyPluginResource(final ObjectFacade objectFacade) { this.objectFacade = objectFacade; } public ObjectBean getInsightObject(String key) throws Exception { return objectFacade.loadObjectBean(key); } } ``` -------------------------------- ### Component Import Example Source: https://developer.atlassian.com/server/jira/platform/workflow-modules Example of importing a component, such as application properties, using a unique key. ```xml ``` -------------------------------- ### Get User Preference Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-mypreferences Example of a successful response when retrieving a user preference. ```json "" ``` -------------------------------- ### Get All Fields Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-field This is an example of a successful 200 OK response when retrieving all fields. It shows the structure of a FieldBean object, detailing properties like `id`, `name`, and `schema`. ```json { "clauseNames": [ "[description]" ], "custom": false, "id": "description", "name": "Description", "navigable": true, "orderable": true, "schema": {}, "searchable": true } ``` -------------------------------- ### Package Plugin as JAR using Command Line Source: https://developer.atlassian.com/server/jira/platform/creating-a-custom-preset-filter Use the 'jar' command-line tool to create a JAR file containing the atlassian-plugin.xml descriptor. Ensure the atlassian-plugin.xml file is in the current directory when running this command. ```bash jar -cvf plugin-name.jar atlassian-plugin.xml ``` -------------------------------- ### Version JSON Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-board Example JSON response for a version, including details like name, description, release date, and project association. ```json { "archived": false, "description": "An excellent version", "expand": "10000", "id": "10000", "moveUnfixedIssuesTo": "http://localhost:8090/jira/rest/api/2/version/10000/move", "name": "New Version 1", "overdue": true, "project": "PXA", "projectId": 10000, "releaseDate": "", "releaseDateSet": false, "released": true, "self": "http://localhost:8090/jira/rest/api/2/version/10000", "startDate": "", "startDateSet": false, "userReleaseDate": "2012-09-15T21:11:01.834+0000", "userStartDate": "2012-08-15T21:11:01.834+0000" } ``` -------------------------------- ### Get All Project Categories - Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-projectcategory Example JSON response when successfully retrieving all project categories. ```json { "description": "This is a project category", "id": "10000", "name": "My Project Category", "self": "http://www.example.com/jira/rest/api/2/projectCategory/10000" } ``` -------------------------------- ### Get Remote Version Links Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-version Example JSON response for retrieving remote version links. ```json { "links": [ { "link": "{\"rel\":\"issue\",\"url\":\"http://www.example.com/jira/rest/api/2/issue/10000\"}", "name": "Issue 10000", "self": "http://www.example.com/jira/rest/api/2/issue/10000" } ] } ``` -------------------------------- ### Install Plugin using SDK Source: https://developer.atlassian.com/server/jira/platform/jira-service-desk-development-guide-33727339 This command installs a packaged plugin JAR file to UPM, shortening the development flow. Ensure the plugin is packaged using `atlas-package` first. ```bash atlas-install-plugin ``` -------------------------------- ### Get all defined terminology entries response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-terminology Example JSON response when retrieving all defined terminology entries. ```json { "isDefault": true, "newName": "", "newNamePlural": "", "originalName": "", "originalNamePlural": "" } ``` -------------------------------- ### Clone the app source code repository Source: https://developer.atlassian.com/server/jira/platform/writing-jira-event-listeners-with-the-atlassian-event-library Use this command to clone the example application source code from Bitbucket. This is useful for checking your work or skipping ahead in the tutorial. ```bash git clone https://bitbucket.org/atlassian_tutorial/jira-event-listener ``` -------------------------------- ### Get epic details response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-epic Example JSON response when successfully retrieving an epic's details. ```json { "color": { "key": "ghx-label-1" }, "done": true, "id": 10000, "key": "PR-1", "name": "Epic 1", "self": "http://www.example.com/jira/rest/api/2/issue/10000", "summary": "Epic 1 summary" } ``` -------------------------------- ### Example Project Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-project A sample JSON response when retrieving project data. ```json { "archived": false, "avatarUrls": {}, "description": "Example", "id": "10000", "key": "EX", "name": "Example", "self": "http://www.example.com/jira/rest/api/2/project/EX" } ``` -------------------------------- ### Example response for getting all application roles Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-applicationrole An example JSON response when successfully retrieving all application roles. It includes details such as default groups, defined status, associated groups, seat information, and user counts. ```json { "defaultGroups": [ "jira-software-users" ], "defined": false, "groups": [ "jira-software-users", "jira-testers" ], "hasUnlimitedSeats": false, "key": "jira-software", "name": "Jira Software", "numberOfSeats": 10, "platform": false, "remainingSeats": 5, "selectedByDefault": false, "userCount": 5, "userCountDescription": "5 developers" } ``` -------------------------------- ### Run Standalone JIRA Instance Source: https://developer.atlassian.com/server/jira/platform/jira-service-desk-development-guide-33727339 Use this command to start a standalone JIRA instance for development and testing. Ensure the version is set to 7.0.0 or later. ```bash atlas-run-standalone --product jira --version 7.0.0. ``` -------------------------------- ### Start Confluence Instance Source: https://developer.atlassian.com/server/jira/platform/implementing-application-links-in-jira Use this command to start a standalone Confluence instance for testing your Jira plugin. This is a necessary step before configuring application links. ```bash atlas-run-standalone --product confluence ``` -------------------------------- ### Get statuses Source: https://developer.atlassian.com/server/jira/platform/jira.10003.postman.json Returns paginated list of filtered statuses. You can filter by project IDs and control the starting index. ```APIDOC ## GET /rest/api/2/status ### Description Returns paginated list of filtered statuses. ### Method GET ### Endpoint {{protocol}}://{{host}}/rest/api/2/status ### Parameters #### Query Parameters - **projectIds** (string) - Optional - The list of project ids to filter statuses. - **startAt** (string) - Optional - The index of the first status to return. ### Request Example ```json { "example": "" } ``` ### Response #### Success Response (200) - **field1** (type) - Description ### Response Example ```json { "example": "" } ``` ``` -------------------------------- ### Example Response: Properties Keys Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-comment This is an example of a successful response when retrieving the keys of all properties for a comment. ```json { "keys": [ { "key": "issue.support", "self": "http://www.example.com/jira/rest/api/2/issue/EX-2/properties/issue.support" } ] } ``` -------------------------------- ### Example Project Type Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-project A sample JSON response for a project type, including its key, description, and icon. ```json { "color": "#FFFFFF", "descriptionI18nKey": "Project type for software projects", "formattedKey": "Software", "icon": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOC4xLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAzMiAzMiIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzIgMzIiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZmlsbD0iIzY2NjY2NiIgZD0iTTE2LDBDNy4yLDAsMCw3LjIsMCwxNmMwLDguOCw3LjIsMTYsMTYsMTZjOC44LDAsMTYtNy4yLDE2LTE2QzMyLDcuMiwyNC44LDAsMTYsMHogTTI1LjcsMjMNCgkJYzAsMS44LTEuNCwzLjItMy4yLDMuMkg5LjJDNy41LDI2LjIsNiwyNC44LDYsMjNWOS44QzYsOCw3LjUsNi42LDkuMiw2LjZoMTMuMmMwLjIsMCwwLjQsMCwwLjcsMC4xbC0yLjgsMi44SDkuMg0KCQlDOSw5LjQsOC44LDkuNiw4LjgsOS44VjIzYzAsMC4yLDAuNCwwLjQsMC40LDAuNGgxMy4yYzAuMiwwLDAuNC0wLjIsMC40LTAuNHYtNS4zbDIuOC0yLjhWMjN6IE0xNS45LDIxLjNMMTEsMTYuNGwyLTIsMi45LDIuOQ0KCQlMMjYuNCw2LjhjMC42LDAuNywxLjIsMS41LDEuNywyLjNMMTUuOSwyMS4zeiIvPg0KPC9nPg0KPC9zdmc+", "key": "software" } ``` -------------------------------- ### Get All Statuses - Response Example Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-status This is an example of the JSON response when successfully retrieving all Jira issue statuses. It includes details like description, icon URL, ID, name, self URL, status category, and status color. ```json { "description": "The issue is currently being worked on.", "iconUrl": "http://localhost:8090/jira/images/icons/progress.gif", "id": "10000", "name": "In Progress", "self": "http://localhost:8090/jira/rest/api/2.0/status/10000", "statusCategory": { "colorName": "blue-gray", "id": 1, "key": "new", "name": "To Do", "self": "http://localhost:8090/jira/rest/api/2.0/statuscategory/1" }, "statusColor": "green" } ``` -------------------------------- ### Get Specific Remote Version Link Response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-version Example JSON response for fetching a specific remote version link. ```json { "link": "{\"rel\":\"issue\",\"url\":\"http://www.example.com/jira/rest/api/2/issue/10000\"}", "name": "Issue 10000", "self": "http://www.example.com/jira/rest/api/2/issue/10000" } ``` -------------------------------- ### Searching for issues with pagination Source: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples This example demonstrates how to search for issues and control the pagination of results using `startAt` and `maxResults`. ```APIDOC ## GET /rest/api/2/search ### Description Searches for issues and allows control over the starting point and number of results returned. ### Method GET ### Endpoint /rest/api/2/search ### Parameters #### Query Parameters - **jql** (string) - Required - The JQL query to execute. - **startAt** (integer) - Optional - The index of the first issue to return (0-based). - **maxResults** (integer) - Optional - The maximum number of issues to return. ### Request Example ```bash curl \ -D- \ -u charlie:charlie \ -X GET \ -H "Content-Type: application/json" \ http://localhost:8080/rest/api/2/search?jql=assignee=charlie&startAt=2&maxResults=2 ``` ### Response #### Success Response (200) (Response body structure is the same as the basic search example, with `startAt`, `maxResults`, and `total` reflecting the pagination parameters.) #### Response Example (Response example not provided in source, but would contain issues starting from index 2, with a maximum of 2 results.) ``` -------------------------------- ### Get all boards Source: https://developer.atlassian.com/server/jira/platform/jira.11000.postman.json Retrieves a list of all boards, with options to filter by maximum results, name, project, type, and starting index. ```APIDOC ## GET {{basePath}}agile/1.0/board ### Description Get all boards. This endpoint allows filtering by maximum results, name, project key or ID, type (scrum or kanban), and starting index for pagination. ### Method GET ### Endpoint {{protocol}}://{{host}}/{{basePath}}agile/1.0/board ### Query Parameters - **maxResults** (integer) - Optional - The maximum number of boards to return per page. Default: 50. - **name** (string) - Optional - Filters results to boards that match or partially match the specified name. - **projectKeyOrId** (string) - Optional - Filters results to boards that are relevant to a project. - **type** (string) - Optional - Filters results to boards of the specified type. Valid values: scrum, kanban. - **startAt** (integer) - Optional - The starting index of the returned boards. Base index: 0. ### Request Example ```json { "example": "request body" } ``` ### Response #### Success Response (200) - **field1** (type) - Description ``` -------------------------------- ### Component Import Example Source: https://developer.atlassian.com/server/jira/platform/index-document-configuration This example shows how to declare a component import, where 'appProps' is the key for the module declaration. ```xml ``` -------------------------------- ### Get refined velocity setting response Source: https://developer.atlassian.com/server/jira/platform/rest/v11003/api-group-board Example JSON response when retrieving the refined velocity setting. Indicates if the setting is enabled. ```json { "value": true } ``` -------------------------------- ### Successful build output example Source: https://developer.atlassian.com/server/jira/platform/displaying-content-in-a-dialog-in-jira This output indicates that the code was successfully built and the integration tests passed. ```text [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 minutes 19 seconds [INFO] Finished at: Sat Nov 26 13:26:03 EST 2011 [INFO] Final Memory: 70M/123M [INFO] ------------------------------------------------------------------------ ``` -------------------------------- ### Basic TestKit Integration Test Setup Source: https://developer.atlassian.com/server/jira/platform/smarter-integration-testing-with-testkit Sets up a JIRA instance for integration testing using TestKit. It restores a blank instance, adds a test user, disables websudo, and enables sub-tasks. ```java package it; import com.atlassian.jira.functest.framework.FuncTestCase; import com.atlassian.jira.testkit.client.Backdoor; import com.atlassian.jira.testkit.client.util.TestKitLocalEnvironmentData; import com.atlassian.jira.testkit.client.util.TimeBombLicence; public class MyPluginTest extends FuncTestCase { @Override protected void setUpTest() { super.setUpTest(); Backdoor testKit = new Backdoor(new TestKitLocalEnvironmentData()); testKit.restoreBlankInstance(TimeBombLicence.LICENCE_FOR_TESTING); testKit.usersAndGroups().addUser("test-user"); testKit.websudo().disable(); testKit.subtask().enable(); } public void testIntegration() { // Put your test logic here } } ``` -------------------------------- ### Basic Component Import Declaration Source: https://developer.atlassian.com/server/jira/platform/component-import An example of an atlassian-plugin.xml file demonstrating a basic component import. This configuration imports a service defined by 'com.myapp.HelloWorldService' and assigns it the key 'helloWorldService'. ```xml A basic component import module test 1.0 com.myapp.HelloWorldService ``` -------------------------------- ### Get paginated list of filtered issue types Source: https://developer.atlassian.com/server/jira/platform/jira.11003.postman.json Returns a paginated list of issue types, with options to filter by project and starting index. ```APIDOC ## GET /rest/api/2/issuetype ### Description Returns paginated list of filtered issue types. ### Method GET ### Endpoint {{basePath}}api/2/issuetype ### Query Parameters - **projectIds** (string) - Optional - The set of project ids to filter issue types. - **startAt** (string) - Optional - The index of the first issue type to return. ``` -------------------------------- ### Get Issue Types Source: https://developer.atlassian.com/server/jira/platform/jira.11001.postman.json Returns a paginated list of filtered issue types. You can filter by project IDs and control the starting index for pagination. ```APIDOC ## GET /rest/api/2/issuetype ### Description Returns paginated list of filtered issue types. ### Method GET ### Endpoint /rest/api/2/issuetype ### Parameters #### Query Parameters - **projectIds** (string) - Optional - The set of project ids to filter issue types. - **startAt** (string) - Optional - The index of the first issue type to return. ### Response #### Success Response (200) - **values** (array) - List of issue types. - **startAt** (integer) - The index of the first issue type returned. - **maxResults** (integer) - The maximum number of issue types to return. - **total** (integer) - The total number of issue types available. ``` -------------------------------- ### Define Help Paths Properties Source: https://developer.atlassian.com/server/jira/platform/extending-jira-help-links Configure help link URLs and titles using properties files. Use `.ondemand` suffixes for Cloud-specific overrides. The `docs.version` variable is replaced with the current Jira documentation version. ```properties # Prefixes url-prefix=https://docs.atlassian.com/jira/docs-${docs.version}/ url-prefix.ondemand=https://confluence.atlassian.com/display/Cloud/ # Section: Jira 101 jira101.url=Jira 101 jira101.url.ondemand=Get+a+feel+for+Jira jira101.title=Jira 101 jira101.title.ondemand=Jira+Cloud ``` -------------------------------- ### Get Service Desks Source: https://developer.atlassian.com/server/jira/platform/exploring-the-jira-service-desk-domain-model-via-the-rest-apis Retrieves a paginated list of all service desks in the system. You can control the number of results per page and the starting index. ```APIDOC ## GET /rest/servicedeskapi/servicedesk ### Description Retrieves a list of service desks. Supports pagination via `start` and `limit` query parameters. ### Method GET ### Endpoint /rest/servicedeskapi/servicedesk ### Query Parameters - **start** (integer) - Optional - The starting index for the list of service desks. - **limit** (integer) - Optional - The maximum number of service desks to return per page. ### Response #### Success Response (200) - **_links** (object) - Contains links to related resources, including pagination links. - **isLastPage** (boolean) - Indicates if this is the last page of results. - **limit** (integer) - The limit applied to the current page. - **size** (integer) - The number of items returned in the current page. - **start** (integer) - The starting index for the current page. - **values** (array) - An array of service desk objects. - **_links** (object) - Contains a link to the service desk resource. - **id** (integer) - The unique identifier for the service desk. - **projectId** (integer) - The ID of the associated Jira project. - **projectName** (string) - The name of the associated Jira project. ### Request Example ```bash curl -H "X-ExperimentalApi: true" -u agent:agent -X GET "http://localhost:2990/jira/rest/servicedeskapi/servicedesk?start=0&limit=5" ``` ### Response Example ```json { "_links": { "base": "http://localhost:2990/jira", "context": "/jira", "next": "http://localhost:2990/jira/rest/servicedeskapi/servicedesk?limit=5&start=5", "self": "http://localhost:2990/jira/rest/servicedeskapi/servicedesk?start=0&limit=5" }, "isLastPage": false, "limit": 5, "size": 5, "start": 0, "values": [ { "_links": { "self": "http://localhost:2990/jira/rest/servicedeskapi/servicedesk/15" }, "id": 15, "projectId": 11041, "projectName": "All Teams Service Desk" } ] } ``` ``` -------------------------------- ### Supplying Basic Auth Headers Manually Source: https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-basic-authentication-6291732 This example demonstrates how to manually construct and supply the 'Authorization: Basic' header for basic authentication. ```APIDOC ## Supplying Basic Auth Headers Manually ### Description This example demonstrates how to manually construct and supply the 'Authorization: Basic' header for basic authentication. This involves Base64 encoding the username:password string. ### Method GET ### Endpoint http://kelpie9:8081/rest/api/2/issue/QA-31 ### Request Example ```bash curl -D- -X GET -H "Authorization: Basic ZnJlZDpmcmVk" -H "Content-Type: application/json" "http://kelpie9:8081/rest/api/2/issue/QA-31" ``` ``` -------------------------------- ### Jira Integration Test Setup Source: https://developer.atlassian.com/server/jira/platform/writing-a-custom-importer-using-the-jira-importers-add-on Sets up the testing environment by initializing a backdoor client and restoring a blank Jira instance. This is essential for integration tests. ```java public void setUp() { backdoor = new Backdoor(new TestKitLocalEnvironmentData()); backdoor.restoreBlankInstance(); jira = new JiraTestedProduct(null, new EnvironmentBasedProductInstance()); } ```