Skip to main content
One call writes a set: PUT /sets/{set}. The first time, it creates the set and its cards. After that, the same call updates them. It runs on your server, with your key in the X-Pincast-Key header.

Register a set

Your app picks the set id and puts it in the path: up to 64 characters, each a lowercase letter, a digit, _ or -, starting with a letter or digit. Your key writes only your app’s sets, so another app’s set with the same id is a different set. This call registers a set of park trees with two cards, a species and one tree that belongs to it:
It answers 200 with what the call changed:

The set’s fields

meta.listed set to false keeps the set off the Placecard map, the front page and card pages for people who don’t hold its cards (How the pieces fit says when a set lists). meta.checkout is refused unless it’s one of Pincast’s own checkout paths for your app, so leave it out. Every call replaces the set’s name and meta with what it sends. A call without meta leaves the set with an empty one, which also drops a listed: false you sent before. Send the set’s full meta on every call.

The card’s fields

Each card needs a key, a type and a title. The rest is optional. An empty string or null counts as left out, and Placecard ignores fields it doesn’t know, so a misspelled field is dropped without an error.

The one type Placecard reads

Placecard gives one type a meaning of its own: experience, a card that stands for something people play from start to end, such as a walk. Placecard lists experiences apart from cards. On the Placecard map and front page, a card shows on its own when it has no parent or its parent is an experience. A card whose parent is another card, such as a tree under its species, still takes collects, and the parent shows in its place. A parent with no lat and lng of its own is placed at its nearest child.

Update the set and its cards

Send the same call again with what changed. Placecard matches each card by its key:
  • A new key adds a card.
  • A key the set already has updates that card. Every field but the key can change.
  • A card you leave out of the call is kept as it is.
A card you send replaces the stored card whole. Any field you leave out of it is cleared, its parent too, and its status goes back to active. So send each card in full every time, with status set to retired for as long as it should stay retired. This call retires the tree from the first example and adds a second one. The species card isn’t in it, so it’s kept as it was:
There’s no call that deletes a card. Retire it instead. A card’s key can’t change either: a card sent with a new key is a new card, and the old one stays until you retire it. More than 5,000 cards go in several calls. Each one carries the set’s name and full meta, and a card’s parent goes in the same call or an earlier one.

What the answer says

To read the set back, with its active cards by type, its collect counts and whether it lists, call GET /sets/{set}.

From Node

This sends the call from your server with Node 18 or later, which has fetch built in. It makes one Idempotency-Key for the request and sends the same one with each retry.

Retries

A set call is safe to send again as it is. The second call finds nothing to change: setCreated is false and every card counts as unchanged. With an Idempotency-Key, a retry gets the first call’s answer back as it was, its setCreated and counts included, marked Idempotent-Replayed: true, and writes nothing. Placecard keeps that answer 24 hours, for your app only. The key matches when the method, the path and the body are the same (the order of keys in the body doesn’t matter). The same key with a different request answers 422. A second call with the key while the first is still running waits for the first, then gets its answer. The whole call is one transaction. A call that fails writes nothing and keeps nothing for its Idempotency-Key, so its retry runs again.

When the call is refused

Placecard checks the call in order: the key, your key’s limit, the set id, the Idempotency-Key, then the body. In the body it checks name, then meta, then cards, then each card in turn, then duplicate keys and parents, and answers with the first fault. One bad card fails the whole call. For a card, the message starts with the card’s place in the array, and data.field gives the path. A second card sent without a title answers 400 with the message cards[1]: title required and this data:
The codes this call can answer with: The key and the limit answer as they do on every call: key_missing (401), key_invalid and key_expired (403), key_conflict (400) and rate_limited (429, with Retry-After). A 500 is a failure on Placecard’s side, and the same call is safe to send again. Errors has the full error body and every code.