API pipeline: Tag cards with rubrics

Index: API pipelines — index

Goal: tag your cards with rubrics, build your own rubric tree, and browse the public rubrics.

A rubric is a card (card_type: rubric). Kind tag classifies cards; kind place is a geographic node (rub.geo-…) and is set as a card's location, never as a tag. Rubrics form trees: a rubric contains its sub-rubrics, in order.

A. Browse public rubrics

1. Roots.

POST /v0/search/graph/keyword
{"query": "", "card_type": "rubric", "filters": {"roots_only": true}, "limit": 50}
→ {"hits": [{"card_type": "rubric", "nonce": "447697459225821184", "handle": "rub.iab", "title": "IAB Taxonomies", "kind": "tag", …},
            {"nonce": "447799256720343040", "handle": "rub.isic", "title": "International Standard Industrial Classification (ISIC Rev.4)", …}, …]}

2. Children.

GET /v0/graph/rubrics/@rub.iab?contained_limit=200&contained_offset=0
→ {"nonce": "447697459225821184", "kind": "tag",
   "contained": [{"card_type": "rubric", "nonce": "…", "title": "Automotive"}, …],
   "contained_next_offset": 200}

Page with contained_offset until contained_next_offset is null. Find a rubric by word: {"query": "dental", "card_type": "rubric", "filters": {"kind": "tag"}} on the same search.

3. Cards under a rubric. Search with a rubric filter: "filters": {"rubrics": [["<rubric nonce>"]]} (inner lists OR, outer AND; rubrics_not excludes).

B. Tag a card

Rubrics are a field of the card. Send the whole list on create or PATCH; it replaces the previous one. Each rubric the new list adds needs the right to mark with it (B3); rubrics the card already has stay.

PATCH /v0/my/articles/470000000000000042
{"rubrics": ["<rubric nonce>", "470000000000000077"], "location": "<place nonce>"}

B2. Mark a card: add and remove in one call

Change some rubrics of a card without resending the whole list.

PATCH /v0/my/cards/470000000000000042/rubrics
{"add": ["470000000000000081"], "remove": ["470000000000000090"]}
→ {"nonce": "470000000000000042", "card_type": "article",
   "rubrics": ["470000000000000081", "…"], "added": ["470000000000000081"],
   "removed": ["470000000000000079", "470000000000000090"],
   "transitions": [{"parent": "470000000000000078", "from": "470000000000000079", "to": "470000000000000081"}]}

Stage trees. Set exclusive_children: true on a rubric of yours (on create or PATCH) and it takes one child at a time on a card: adding a child replaces the sibling the card had. Use it for stages, e.g. New → Contacted → Won: one call per move, jumps allowed. transitions lists each move per tree (from: null: the card entered the tree; to: null: it left it).

History. Every mark is recorded as a change: what was added and removed, the stage moves, who made it and when.

B3. Who may mark with a rubric

Adding a rubric to a card needs the right to mark with that rubric. Removing a rubric never does.

C. Your own rubric tree

1. Create.

POST /v0/my/rubrics
Idempotency-Key: rub-1f3a…
{"title": "Wedding services", "content": "What we offer for weddings.", "language": "en",
 "parent": "470000000000000070"}
→ {"nonce": "470000000000000077", "card_type": "rubric", "kind": "tag", "visibility": "Private", …}

2. Add, remove, reorder sub-rubrics.

POST   /v0/my/rubrics/{rubric}/{child rubric}   {"seqnum": 3}    → 204   (seqnum optional: default = last)
PATCH  /v0/my/rubrics/{rubric}/{child rubric}   {"seqnum": 0}    → 204   (move)
DELETE /v0/my/rubrics/{rubric}/{child rubric}                    → 204

Both must be rubrics you can write, and filing also needs the right to mark with the parent (B3); a cycle is refused. Other cards are not filed this way: they carry rubrics in their own rubrics field (B).

3. Edit, delete. PATCH /v0/my/rubrics/{nonce} (title, content, handle, visibility, project, …); DELETE /v0/my/rubrics/{nonce}. Yours: GET /v0/my/rubrics, GET /v0/my/rubrics/{nonce}.

Behind

Rules (400)

API surface

Endpoint Purpose FE AI / oracle
POST /v0/search/graph/keyword (card_type: rubric) Find roots and rubrics yes yes
GET /v0/graph/rubrics, GET /v0/graph/rubrics/{nonce} Public rubrics, a rubric's children yes yes
rubrics, primary_rubrics, location on a card create / PATCH Tag a card yes yes
POST /v0/my/rubrics, PATCH/DELETE /v0/my/rubrics/{nonce} Your rubrics no yes
POST/PATCH/DELETE /v0/my/rubrics/{nonce}/{child} File, move, remove sub-rubrics no yes
GET /v0/my/rubrics, GET /v0/my/rubrics/{nonce} Yours no yes
PATCH /v0/my/cards/{nonce}/rubrics Add / remove rubrics in one call; stage moves no yes

Mentioned