Do fhorbróirí

Sonraíocht ar féidir leat tógáil uirthi.

Is sonraíocht é Open Brand Exchange le trí API, JSON Schemas, sonraí tástála agus tástálacha comhréireachta. Is í an tsonraíocht an fhoinse fírinne; leanann na cur chun feidhme í.

Terminal
$ curl https://brands.kestrel.example/.well-known/obx
200 OK · application/json
{
  "obx_version": "0.1",
  "publisher": { "name": "Kestrel Outfitters" },
  "api_base": "https://brands.kestrel.example/obx/v1",
  "portal_url": "https://brands.kestrel.example/",
  "capabilities": ["changes", "products", "by_gtin",
                   "renditions", "exports", "webhooks"]
}

An tsonraíocht

Leagan 0.1. OpenAPI 3.1, JSON Schema 2020-12, samplaí agus branda tástála bréige, Kestrel Outfitters. Ceadúnas CC-BY-4.0: saor le cur chun feidhme, go tráchtála freisin.

openbrandexchange/spec · Tosaigh le protocol.md

Trí API

APIDoStádasConradh
OBX Protocolbogearraí miondíoltóirí: discovery, OAuth2 client credentials, fotha athruithe, cuardach GTIN, renditions, easpórtálacha, webhooksnormatachobx-protocol.yaml · HTML
OBX Ingest APIuathoibriú branda: upserts idempotent de réir aitheantóirí an bhranda féin, uaslódálacha seolta le sha256, baisceanna, allmhairínormatachobx-ingest.yaml · HTML
Node Admin + Portal APIan riarachán comhroinnte agus an tairseach miondíoltóiríneamhnormatachnode-admin.yaml · HTML

Tairseach branda a léamh i gcúpla líne

HOST=https://brands.kestrel.example
curl -s $HOST/.well-known/obx                       # what does this brand offer?
TOKEN=$(curl -s -u "$CLIENT_ID:$CLIENT_SECRET" -d grant_type=client_credentials \
  $HOST/obx/v1/oauth/token | jq -r .access_token)
curl -s -H "Authorization: Bearer $TOKEN" "$HOST/obx/v1/changes?limit=500"   # everything, then only changes
curl -s -H "Authorization: Bearer $TOKEN" -X POST -H 'Content-Type: application/json' \
  -d '{"gtins":["2000100101025"]}' "$HOST/obx/v1/products:by-gtin"
# or let the obx tool keep a copy in a folder, only fetching what changed:
OBX_CLIENT_ID=$CLIENT_ID OBX_CLIENT_SECRET=$CLIENT_SECRET obx pull $HOST --out ./kestrel

SDK agus uirlis líne ordaithe

Tá an Go SDK in obx-go (cineálacha, cliant prótacail agus cliant ingest le díbhlúiriú, uaslódálacha ilchodacha agus baisceanna), an uirlis obx do bhrandaí, obx-conformance agus freastalaí bréige. I dteangacha eile oibríonn aon chliant HTTP: tá an conradh sna comhaid OpenAPI.

obx-go · obx

Comhréireacht

Tá cur chun feidhme comhréireach le OBX do phróifíl nuair a éiríonn le obx-conformance i ngach tástáil éigeantach den phróifíl sin. Tá ceithre phróifíl ann: protocol, ingest, portal agus security. conformance.md

obx-conformance all --url http://localhost:8080 --setup-code …   # a fresh portal: setup, fixtures, every profile
obx-conformance protocol --url https://brands.kestrel.example --client-id obxc_… --client-secret obxs_…
obx-conformance mock                                              # a mock server that passes everything

Cur chun feidhme

StórCadCeadúnasStádas
specsonraíocht, scéimeanna, sonraí tástálaCC-BY-4.00.1
obx-goGo SDK, uirlis obx, tástálacha comhréireachta, freastalaí bréigeApache-2.00.1
admin-uicomhéadan gréasáin comhroinnte: riarachán agus tairseach miondíoltóiríApache-2.00.1
node-goTairseach do Google Cloud agus Docker
Go: Docker agus Google Cloud Run
AGPL-3.00.1
node-phpTairseach d'óstáil gréasáin
PHP: gnáth-óstáil ghréasáin
AGPL-3.00.1
node-tsTairseach do Cloudflare
TypeScript: Cloudflare Workers
AGPL-3.00.1

Ag tógáil do chur chun feidhme nó do chliant féin? Cuir in iúl dúinn le issue nó pull request, agus rachaidh sé sa tábla seo a luaithe a éiríonn leis sna tástálacha comhréireachta.

Doiciméid