Skip to content

Link a case to the requirement with a key, made if the project has none

POST
/v1/test-cases/{id}/requirements/by-key
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).

id
required
string
Media type application/json
object
key
required

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.

string
>= 1 characters <= 40 characters /^[A-Za-z0-9._-]{1,40}$/
Example
{
"key": "KAN-12"
}

Linked already; the same answer

Media type application/json
object
requirement
required
object
id
required
string
key
required
string
type
required
string
Allowed values: user_story feature epic
status
required
string
Allowed values: draft active done
title
required
string
requirements
required

The case’s requirements, the linked one among them.

Array<object>
object
id
required
string
key
required
string
type
required
string
Allowed values: user_story feature epic
status
required
string
Allowed values: draft active done
title
required
string
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)

Media type application/json
object
requirement
required
object
id
required
string
key
required
string
type
required
string
Allowed values: user_story feature epic
status
required
string
Allowed values: draft active done
title
required
string
requirements
required

The case’s requirements, the linked one among them.

Array<object>
object
id
required
string
key
required
string
type
required
string
Allowed values: user_story feature epic
status
required
string
Allowed values: draft active done
title
required
string
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

Media type application/json
object
error
required
string
code
required
string
Allowed values: invalid_key not_found archived
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

Media type application/json
object
error
required
string
code
required
string
Allowed values: invalid_key not_found archived
Example
{
"error": "test case '6f1c2b3a-0000-4000-8000-0000000000c1' not found",
"code": "not_found"
}

archived - the requirement with that key is archived

Media type application/json
object
error
required
string
code
required
string
Allowed values: invalid_key not_found archived
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.

Media type application/json
object
error
required
string
Example generated
{
"error": "example"
}
Retry-After
integer

Seconds until the window rolls over