Organisations
Save a diagram as one of the organisation's patterns
Saves source as a pattern in the built-in format, checked as the built-in ones are, with every problem answered at once.
POST
/orgs/{org}/patternsTL;DR
| Question | Answer |
|---|---|
| What does it do? | Save a diagram as one of the organisation's patterns. |
| What does it take? | A JSON body of type CreateOrganisationPatternBody. |
| What does it return? | Status 201 with a body of type OrganisationPattern. |
| What can go wrong? | 400 the body is not valid; 401 not signed in, or the key is not valid; 403 the role may not (orgs.forbidden), the plan does not include the policies (plan.governance_not_included), the organisation has 50 patterns (orgs.pattern_limit_reached), or the request came from an origin that may not make changes; 404 no such organisation, or the caller is not a member of it; 409 the organisation has a pattern of that name (orgs.pattern_exists); 422 the pattern has problems (orgs.pattern_invalid, every problem in details); 429 too many requests; 503 organisations are not set up on this server. Every failure uses the one error envelope. |
What it does
Saves source as a pattern in the built-in format, checked as the built-in ones are, with every problem answered at once. Its id is org:
Path parameters
| Field | Type | Required | Description |
|---|---|---|---|
org | string | yes | The organisation's id or its slug. |
Request body
The body has the type CreateOrganisationPatternBody.
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | The name after org:: lowercase letters, digits and single hyphens, such as payments-service. Never changes. at least 1 character; at most 50 characters. |
$schema | string | no | The schema line of a pattern file (https://docs.plotwork.dev/schemas/plotwork.pattern.json (opens in a new tab)). Ignored, so a pattern file is a valid body as it is. at most 200 characters. |
title | string | yes | at most 80 characters. |
summary | string | yes | One sentence: what the diagram shows. at most 300 characters. |
whenToUse | string | no | Two or three sentences: when to start from it, and when not to. at most 600 characters. |
tags | string[] | no | Words a search should match, such as payments. |
templates | object | yes | The Plotwork source of each flavour (neutral, aws, azure, gcp), at least one, with {{slot}} markers inside quoted labels. |
templates.neutral | string | no | at most 10000 characters. |
templates.aws | string | no | at most 10000 characters. |
templates.azure | string | no | at most 10000 characters. |
templates.gcp | string | no | at most 10000 characters. |
slots | object[] | no | |
slots[].id | string | yes | Lowercase words joined with hyphens; written {{id}} inside a quoted label of the source. at least 1 character; at most 40 characters. |
slots[].default | string | yes | The text the slot has when nothing replaces it. No quotes or line breaks. Up to 60 characters, or 600 for the description slot, which is the alt text. at most 600 characters. |
slots[].meaning | string | yes | One line on what belongs in the slot, so an agent fills it with the right thing. at most 200 characters. |
notes | object | no | What to keep, what to rename, and when to split. Left out, each has a plain default. |
notes.keep | string | no | at most 400 characters. |
notes.rename | string | no | at most 400 characters. |
notes.split | string | no | at most 400 characters. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | The pattern as saved. | OrganisationPattern |
| 400 | The body is not valid. | ErrorResponse |
| 401 | Not signed in, or the key is not valid. | ErrorResponse |
| 403 | The role may not (orgs.forbidden), the plan does not include the policies (plan.governance_not_included), the organisation has 50 patterns (orgs.pattern_limit_reached), or the request came from an origin that may not make changes. | ErrorResponse |
| 404 | No such organisation, or the caller is not a member of it. | ErrorResponse |
| 409 | The organisation has a pattern of that name (orgs.pattern_exists). | ErrorResponse |
| 422 | The pattern has problems (orgs.pattern_invalid, every problem in details). | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 503 | Organisations are not set up on this server. | ErrorResponse |
Response body
A 201 answer has the type OrganisationPattern.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | yes | What the tools take: org:<name>. |
name | string | yes | The name after org:. |
title | string | yes | |
summary | string | yes | |
whenToUse | string | yes | |
kind | string | yes | The kind of diagram, such as flow. |
tags | string[] | yes | |
flavours | ("neutral" | "aws" | "azure" | "gcp")[] | yes | |
slotCount | integer | yes | minimum 0. |
createdAt | integer | yes | |
updatedAt | integer | yes | |
updatedBy | string | null | yes | The account that last saved it, or null once that account is gone. |
pictures | object | null | yes | Its pictures, drawn when it was saved: its first flavour with every slot at its default, in the organisation's brand and icons. Null for a pattern saved before pictures were kept, or whose drawing failed; the next save draws them. |
pictures.light | string | yes | The path of its light picture on this API, with the save time in it. |
pictures.dark | string | yes | The path of its dark picture on this API. |
templates | object | yes | The Plotwork source of each flavour (neutral, aws, azure, gcp), at least one, with {{slot}} markers inside quoted labels. |
templates.neutral | string | no | at most 10000 characters. |
templates.aws | string | no | at most 10000 characters. |
templates.azure | string | no | at most 10000 characters. |
templates.gcp | string | no | at most 10000 characters. |
slots | object[] | yes | |
slots[].id | string | yes | Lowercase words joined with hyphens; written {{id}} inside a quoted label of the source. at least 1 character; at most 40 characters. |
slots[].default | string | yes | The text the slot has when nothing replaces it. No quotes or line breaks. Up to 60 characters, or 600 for the description slot, which is the alt text. at most 600 characters. |
slots[].meaning | string | yes | One line on what belongs in the slot, so an agent fills it with the right thing. at most 200 characters. |
notes | object | yes | |
notes.keep | string | yes | What to leave exactly as it is. |
notes.rename | string | yes | What to rename or replace, and how. |
notes.split | string | yes | When the diagram has grown too big, and where to cut it. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |