curl --request PUT \
--url https://api.pincast.fm/v1/sets/{set} \
--header 'Content-Type: application/json' \
--header 'X-Pincast-Key: <api-key>' \
--data '
{
"name": "Central Park Trees",
"meta": {
"city": "New York"
},
"cards": [
{
"key": "species:ginkgo",
"type": "species",
"title": "Ginkgo",
"subtitle": "Ginkgo biloba",
"fact": "21,024 in New York",
"rarity": "common",
"image": {
"url": "https://images.example.org/ginkgo.jpg",
"credit": "A. Photographer",
"license": "CC BY-SA 4.0"
},
"data": {
"count": 21024
}
},
{
"key": "tree:2614648",
"type": "tree",
"parent": "species:ginkgo",
"title": "Ginkgo on East Drive",
"url": "https://app.example.org/tree/2614648",
"lat": 40.77945,
"lng": -73.96318
}
]
}
'const options = {
method: 'PUT',
headers: {'X-Pincast-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Central Park Trees',
meta: {city: 'New York'},
cards: [
{
key: 'species:ginkgo',
type: 'species',
title: 'Ginkgo',
subtitle: 'Ginkgo biloba',
fact: '21,024 in New York',
rarity: 'common',
image: {
url: 'https://images.example.org/ginkgo.jpg',
credit: 'A. Photographer',
license: 'CC BY-SA 4.0'
},
data: {count: 21024}
},
{
key: 'tree:2614648',
type: 'tree',
parent: 'species:ginkgo',
title: 'Ginkgo on East Drive',
url: 'https://app.example.org/tree/2614648',
lat: 40.77945,
lng: -73.96318
}
]
})
};
fetch('https://api.pincast.fm/v1/sets/{set}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pincast.fm/v1/sets/{set}"
payload = {
"name": "Central Park Trees",
"meta": { "city": "New York" },
"cards": [
{
"key": "species:ginkgo",
"type": "species",
"title": "Ginkgo",
"subtitle": "Ginkgo biloba",
"fact": "21,024 in New York",
"rarity": "common",
"image": {
"url": "https://images.example.org/ginkgo.jpg",
"credit": "A. Photographer",
"license": "CC BY-SA 4.0"
},
"data": { "count": 21024 }
},
{
"key": "tree:2614648",
"type": "tree",
"parent": "species:ginkgo",
"title": "Ginkgo on East Drive",
"url": "https://app.example.org/tree/2614648",
"lat": 40.77945,
"lng": -73.96318
}
]
}
headers = {
"X-Pincast-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"app": "demo",
"set": "central-park-trees",
"name": "Central Park Trees",
"setCreated": true,
"cards": {
"created": 2,
"updated": 0,
"unchanged": 0,
"parentsSet": 1
},
"active": {
"species": 1,
"tree": 1
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}Register a card set, or update it and its cards
Creates the set the first time and updates its name and meta after that. Cards are matched by key: a new key adds a card, a known key updates it, and a card you leave out of the call is kept as it is (send it with status retired to retire it). A card’s parent may be in the same call or already registered. The whole call is one transaction: one bad card fails the call and nothing is written. Safe to send again: an unchanged card counts as unchanged and is not touched. With an Idempotency-Key, a retry answers the first answer (setCreated true, the first counts) and writes nothing.
curl --request PUT \
--url https://api.pincast.fm/v1/sets/{set} \
--header 'Content-Type: application/json' \
--header 'X-Pincast-Key: <api-key>' \
--data '
{
"name": "Central Park Trees",
"meta": {
"city": "New York"
},
"cards": [
{
"key": "species:ginkgo",
"type": "species",
"title": "Ginkgo",
"subtitle": "Ginkgo biloba",
"fact": "21,024 in New York",
"rarity": "common",
"image": {
"url": "https://images.example.org/ginkgo.jpg",
"credit": "A. Photographer",
"license": "CC BY-SA 4.0"
},
"data": {
"count": 21024
}
},
{
"key": "tree:2614648",
"type": "tree",
"parent": "species:ginkgo",
"title": "Ginkgo on East Drive",
"url": "https://app.example.org/tree/2614648",
"lat": 40.77945,
"lng": -73.96318
}
]
}
'const options = {
method: 'PUT',
headers: {'X-Pincast-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Central Park Trees',
meta: {city: 'New York'},
cards: [
{
key: 'species:ginkgo',
type: 'species',
title: 'Ginkgo',
subtitle: 'Ginkgo biloba',
fact: '21,024 in New York',
rarity: 'common',
image: {
url: 'https://images.example.org/ginkgo.jpg',
credit: 'A. Photographer',
license: 'CC BY-SA 4.0'
},
data: {count: 21024}
},
{
key: 'tree:2614648',
type: 'tree',
parent: 'species:ginkgo',
title: 'Ginkgo on East Drive',
url: 'https://app.example.org/tree/2614648',
lat: 40.77945,
lng: -73.96318
}
]
})
};
fetch('https://api.pincast.fm/v1/sets/{set}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.pincast.fm/v1/sets/{set}"
payload = {
"name": "Central Park Trees",
"meta": { "city": "New York" },
"cards": [
{
"key": "species:ginkgo",
"type": "species",
"title": "Ginkgo",
"subtitle": "Ginkgo biloba",
"fact": "21,024 in New York",
"rarity": "common",
"image": {
"url": "https://images.example.org/ginkgo.jpg",
"credit": "A. Photographer",
"license": "CC BY-SA 4.0"
},
"data": { "count": 21024 }
},
{
"key": "tree:2614648",
"type": "tree",
"parent": "species:ginkgo",
"title": "Ginkgo on East Drive",
"url": "https://app.example.org/tree/2614648",
"lat": 40.77945,
"lng": -73.96318
}
]
}
headers = {
"X-Pincast-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text){
"app": "demo",
"set": "central-park-trees",
"name": "Central Park Trees",
"setCreated": true,
"cards": {
"created": 2,
"updated": 0,
"unchanged": 0,
"parentsSet": 1
},
"active": {
"species": 1,
"tree": 1
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}{
"url": "<string>",
"statusCode": 499,
"statusMessage": "<string>",
"message": "<string>",
"stack": "<string>",
"data": {
"code": "key_missing",
"fix": "<string>",
"field": "<string>"
}
}Authorizations
Your app's key, sent on every call from your server only. It reads pck_, your app id, an underscore, then a secret of 20 or more letters, digits, underscores or hyphens. Never put it in a web page, an app bundle or a query string. Placecard stores only its sha256.
Your app can hold two live keys at once, so a key is replaced with no outage: the new key works at once, and the old one keeps working until its expiry (seven days after the new key is made, unless you ask for less). A revoked key is refused from the next call.
X-Placecard-Key, the older name of this header, is taken too, at either address. Send one of the two; if both come and they differ, the call answers 400 key_conflict.
Headers
Optional, on the three writes. A string your app makes for one request, a UUID for example, and sends again unchanged with each retry of that request. Placecard keeps the first 200 answer to it for 24 hours, for your app only. A retry with the same key and the same request (method, path and body; the order of keys in the body does not matter) answers that answer again, marked Idempotent-Replayed: true, and runs nothing. The same key with a different request answers 422. A refused call keeps nothing, so its retry runs again. 1 to 255 visible ASCII characters, with no spaces.
^[\x21-\x7E]{1,255}$Path Parameters
Body
Anything about the set your app wants kept, under 8000 characters as JSON. Two keys matter to every app: listed (false keeps the set off the map, the front page and card pages for people who do not hold its cards) and checkout (refused with field_invalid unless it is one of Pincast's own checkout paths for your app; selling through Pincast's checkout comes later).
Response
The set is registered. The counts say what this call changed; active counts the set's active cards by type after it.