Link a case to the requirement with a key, made if the project has none
const url = 'https://beta-api.plune.ai/v1/test-cases/example/requirements/by-key';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"key":"KAN-12"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://beta-api.plune.ai/v1/test-cases/example/requirements/by-key \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "key": "KAN-12" }'From an approved proposal written from a Jira ticket (#1999): the requirement of the project with the ticket’s key (any case) - a new user_story titled by the key, in draft, when there is none - and the case linked to it, in ONE transaction with the entries a create and a link write: a failure leaves no requirement behind. Two calls with the same key at once make one requirement. 201 when the link was made, 200 with the same answer when it was there. An owner’s or a member’s; a reader is refused (403). Refusals carry a code: invalid_key (400), not_found - no such live case in your projects (404), archived - the requirement with that key is archived (409).
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
The requirement’s key, a Jira ticket’s key as it is (KAN-12): letters, digits, -, _, ., not only digits and not an id. Matched in any case.
Example
{ "key": "KAN-12"}Responses
Section titled “ Responses ”Linked already; the same answer
object
object
The case’s requirements, the linked one among them.
object
Example
{ "requirement": { "id": "6f1c2b3a-0000-4000-8000-0000000000f5", "key": "KAN-12", "type": "user_story", "status": "draft", "title": "KAN-12" }, "requirements": [ { "id": "6f1c2b3a-0000-4000-8000-0000000000f5", "key": "KAN-12", "type": "user_story", "status": "draft", "title": "KAN-12" } ]}Linked (and the requirement made, if it was not there)
object
object
The case’s requirements, the linked one among them.
object
Example
{ "requirement": { "id": "6f1c2b3a-0000-4000-8000-0000000000f5", "key": "KAN-12", "type": "user_story", "status": "draft", "title": "KAN-12" }, "requirements": [ { "id": "6f1c2b3a-0000-4000-8000-0000000000f5", "key": "KAN-12", "type": "user_story", "status": "draft", "title": "KAN-12" } ]}invalid_key
object
Example
{ "error": "key is 1 to 40 letters, digits, \"-\", \"_\" or \".\", not only digits, and not an id", "code": "invalid_key"}No / invalid token or session
You are in the project as a reader
not_found - no such case in your projects
object
Example
{ "error": "test case '6f1c2b3a-0000-4000-8000-0000000000c1' not found", "code": "not_found"}archived - the requirement with that key is archived
object
Example
{ "error": "requirement 'KAN-12' is archived: restore it before linking cases", "code": "archived"}Rate-limited: the per-route throttle, or the per-minute request limit of the plan an API token counts by (#1442; the body names the plan, #2092). Retry-After carries the seconds until the window rolls over.
object
Example generated
{ "error": "example"}Headers
Section titled “Headers ”Seconds until the window rolls over