BrenzuriStart free
Site connections endpoint
Reference

Site connections endpoint

The connection id a key needs to deliver an article, without opening the interface.

GET /api/v1/sites/{siteID}/connections returns the connection that delivers a site’s articles, so a key can find the connectionId that `POST /articles/{id}/deliver` needs. The full route description is under Export and delivery.

Deliver without opening the interface#

curl "$BRENZURI_URL/api/v1/sites/$SITE_ID/connections" \
  -H "Authorization: Bearer $BRENZURI_KEY"
  • A site has at most one connection, so the array has none or one entry. An empty array means a person has not connected the site yet.
  • Use id exactly as returned: it is the upper-case UUID the deliver route matches as written.
  • target is only the host, never the full address, and nothing secret is ever in the answer.
  • publishPolicy is draft or approval. Both deliver a draft.
  • lastDeliveryAt is when something last arrived through it.
const base = `${process.env.BRENZURI_URL}/api/v1`;
const headers = { Authorization: `Bearer ${process.env.BRENZURI_KEY}`, 'Content-Type': 'application/json' };

const [connection] = await (await fetch(`${base}/sites/${siteId}/connections`, { headers })).json();
if (!connection) throw new Error('This site has no connection yet');

const delivery = await (
  await fetch(`${base}/articles/${articleId}/deliver`, {
    method: 'POST',
    headers,
    body: JSON.stringify({ connectionId: connection.id }),
  })
).json();