/
Scripting

Scripting

We are often asked whether it is possible to script the creation of requirements.

Accessing the Jira issue through the REST API

It is possible to access the details of a Jira issue using:

{baseUrl}/rest/api/latest/issue/{issueKey}

For example, assuming the Jira issue is http://jira.local:2990/jira/browse/SCRUM-10, then the REST API is http://jira.local:2990/jira/rest/api/latest/issue/SCRUM-10.

It is also possible to write into the same URL. For example, go to a Jira issue, open the Javascript console and write the following code (after modifying the parameters) and it will set the requirements to FN-01:

$.ajax({ type: "PUT", url: AJS.contextPath() + "/rest/api/2/issue/" + RY.getIssueKey(), // ID of the current issue data: JSON.stringify({ "fields": { // "summary": "New summary", "customfield_10300": [ // ID of the Requirement Yogi Custom Field { "applinkId": "f6c9112d-0dbf-3f28-9307-f30e55632e0c", "spaceKey": "TEAM", "key": "FN-01", "relationship": "implements", "baseline": null // Can be omitted } ] }, }), contentType: "application/json; charset=utf-8" });

Confluence

You can access the search results using {baseUrl}/rest/reqs/1/requirement2/{spaceKey}

For example, assuming TEAM as a space key: http://confluence.local:1990/confluence/rest/reqs/1/requirement2/TEAM

The full REST documentation (URL parameters, etc.) is provided on our developer portal.