Skip to content

Commit 2cdcf4e

Browse files
authored
docs: publish CoreLink v1 30-minute quickstart
* Publish v1 30-minute quickstart * Link the v1 quickstart * Expose the developer quickstart * Index the v1 quickstart * Validate quickstart contract markers
1 parent f64412f commit 2cdcf4e

5 files changed

Lines changed: 197 additions & 4 deletions

File tree

.github/workflows/documentation.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ jobs:
2020
test -s README.md
2121
test -s docs/README.md
2222
test -s docs/v1/README.md
23+
test -s docs/v1/quickstart.md
2324
grep -Fq '1.0.0-draft' docs/v1/README.md
2425
grep -Fq 'corelink_device_id' docs/v1/README.md
26+
grep -Fq 'Authorization: Bearer $CORELINK_ACCESS_TOKEN' docs/v1/quickstart.md
27+
grep -Fq 'Idempotency-Key: $CORELINK_IDEMPOTENCY_KEY' docs/v1/quickstart.md
28+
grep -Fq '/api/v1/tenants/$CORELINK_TENANT_ID/devices' docs/v1/quickstart.md
2529
if grep -Fq 'API contract repository also has unpopulated' README.md; then
2630
echo "stale API-contract status returned" >&2
2731
exit 1

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ define the public API/event boundary.
1010
- [Documentation index](docs/README.md)
1111
- [v1 documentation](docs/v1/README.md) — targets the current `1.0.0-draft`
1212
public Device and Command contract and canonical event envelope.
13+
- [30-minute v1 quickstart](docs/v1/quickstart.md) — bearer auth, tenant scope,
14+
Device creation/read and idempotent Command submission using the public contract.
1315

1416
CoreLink v1 is not a Stable release. TypeScript and Python clients are
1517
prerelease; Java SDK, CLI, MCP server and mock server remain Scaffold/Planned.

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| Docs version | Contract target | Status | Entry point |
44
| --- | --- | --- | --- |
5-
| v1 | `corelink-public-v1.yaml` `1.0.0-draft` | Alpha documentation for a draft public boundary | [v1](v1/README.md) |
5+
| v1 | `corelink-public-v1.yaml` `1.0.0-draft` | Alpha docs + contract-backed quickstart | [v1](v1/README.md) · [30-minute quickstart](v1/quickstart.md) |
66

77
## Versioning policy
88

docs/v1/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ boundary until separately reviewed.
1414
| --- | --- | --- |
1515
| Public Device + Command API | Alpha / draft | [Public OpenAPI](https://github.com/CoreLinkPlatform/api-contracts/blob/main/openapi/corelink-public-v1.yaml) |
1616
| Event envelope | Alpha / draft | [AsyncAPI](https://github.com/CoreLinkPlatform/api-contracts/blob/main/asyncapi/corelink-events-v1.yaml) |
17-
| Authentication and tenant scope | Planned documentation | Contract security definitions + runtime evidence |
17+
| Authentication and tenant scope | Alpha quickstart | [30-minute quickstart](quickstart.md) + contract security definitions |
1818
| TypeScript SDK | Prerelease Alpha | [sdk-typescript](https://github.com/CoreLinkPlatform/sdk-typescript) |
1919
| Python SDK | Prerelease Alpha | [sdk-python](https://github.com/CoreLinkPlatform/sdk-python) |
2020
| Java SDK | Scaffold / Planned | [sdk-java](https://github.com/CoreLinkPlatform/sdk-java) |
@@ -25,8 +25,10 @@ boundary until separately reviewed.
2525
## Navigation contract
2626

2727
### 1. Start here
28-
Concepts, authentication, tenant isolation, canonical identifiers and first
29-
verified API call. Content beyond the linked contract is **Planned**.
28+
Begin with the [30-minute v1 quickstart](quickstart.md) for bearer authentication,
29+
tenant scoping, Device and Command calls, idempotency, failure handling and a
30+
repeatable acceptance record. Content beyond the linked Device/Command contract
31+
is **Planned**.
3032

3133
### 2. Guides
3234
Device registration/lifecycle and commands are first because they are in the

docs/v1/quickstart.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# 30-minute CoreLink v1 quickstart
2+
3+
**Maturity: Alpha documentation / `1.0.0-draft` public contract**
4+
5+
This quickstart exercises the currently reviewed public Device and Command slice
6+
without depending on a prerelease SDK. It uses the versioned OpenAPI contract as
7+
the source of truth:
8+
9+
- [CoreLink public v1 OpenAPI](https://github.com/CoreLinkPlatform/api-contracts/blob/main/openapi/corelink-public-v1.yaml)
10+
- public authentication: bearer JWT;
11+
- public tenant scope: `tenant_id` in the resource path;
12+
- public device identity: `corelink_device_id`.
13+
14+
The contract is still draft. The examples below demonstrate the accepted
15+
contract shape; they do not claim that a public production endpoint, self-service
16+
token issuer, or Stable SDK release exists.
17+
18+
## Target outcome
19+
20+
Within 30 minutes you should be able to:
21+
22+
1. configure an assigned API base URL, bearer token and tenant;
23+
2. verify readiness;
24+
3. list the tenant's devices;
25+
4. create a device when a valid `device_model_id` has been assigned;
26+
5. create an idempotent command for that device;
27+
6. inspect the command and recognize the standard failure responses.
28+
29+
## 0–5 min: prerequisites
30+
31+
You need values supplied by the CoreLink environment/operator:
32+
33+
- `CORELINK_API_URL` — base URL for the environment you are authorized to use;
34+
- `CORELINK_ACCESS_TOKEN` — bearer JWT for that environment;
35+
- `CORELINK_TENANT_ID` — UUID of the tenant you are authorized to access;
36+
- `CORELINK_DEVICE_MODEL_ID` — UUID of an allowed device model if you will
37+
create a device.
38+
39+
The draft public contract does **not** define a token-issuance endpoint. Do not
40+
invent or hard-code a client-secret flow in application code. Obtain credentials
41+
through the environment's approved onboarding path.
42+
43+
Set the values in your shell without committing them:
44+
45+
```bash
46+
export CORELINK_API_URL="https://api.example.invalid"
47+
export CORELINK_ACCESS_TOKEN="<bearer-token>"
48+
export CORELINK_TENANT_ID="<tenant-uuid>"
49+
export CORELINK_DEVICE_MODEL_ID="<device-model-uuid>"
50+
```
51+
52+
Use a real environment URL in place of `api.example.invalid`. Keep tokens out of
53+
shell history, screenshots, issue bodies and source control where practical.
54+
55+
## 5–10 min: verify the environment
56+
57+
The readiness endpoint is intentionally unauthenticated:
58+
59+
```bash
60+
curl --fail-with-body --silent --show-error \
61+
"$CORELINK_API_URL/health/ready"
62+
```
63+
64+
A ready environment returns HTTP `200`. HTTP `503` means a dependency required
65+
for traffic is unavailable; stop and resolve the environment before continuing.
66+
67+
## 10–15 min: list tenant-scoped devices
68+
69+
```bash
70+
curl --fail-with-body --silent --show-error \
71+
-H "Authorization: Bearer $CORELINK_ACCESS_TOKEN" \
72+
"$CORELINK_API_URL/api/v1/tenants/$CORELINK_TENANT_ID/devices?limit=20&offset=0"
73+
```
74+
75+
The response is a `DevicePage`. Device identifiers exposed by the public API are
76+
`corelink_device_id`; connector/provider identifiers are not public resource
77+
identities.
78+
79+
Expected authorization failures:
80+
81+
- `401` — authentication is missing or invalid;
82+
- `403` — the caller is authenticated but cannot access the requested tenant
83+
or operation.
84+
85+
Never recover from `403` by changing the tenant ID to another tenant.
86+
87+
## 15–20 min: create a device
88+
89+
Skip this step if the environment has not assigned a valid
90+
`CORELINK_DEVICE_MODEL_ID`.
91+
92+
```bash
93+
DEVICE_RESPONSE="$(curl --fail-with-body --silent --show-error \
94+
-X POST \
95+
-H "Authorization: Bearer $CORELINK_ACCESS_TOKEN" \
96+
-H "Content-Type: application/json" \
97+
"$CORELINK_API_URL/api/v1/tenants/$CORELINK_TENANT_ID/devices" \
98+
--data "{\"device_model_id\":\"$CORELINK_DEVICE_MODEL_ID\",\"name\":\"quickstart-device\",\"metadata\":{\"source\":\"docs-v1-quickstart\"}}")"
99+
100+
printf '%s\n' "$DEVICE_RESPONSE"
101+
```
102+
103+
A successful create returns HTTP `201` and a `Device` containing
104+
`corelink_device_id`. Record that value as `CORELINK_DEVICE_ID`:
105+
106+
```bash
107+
export CORELINK_DEVICE_ID="<corelink-device-uuid>"
108+
```
109+
110+
HTTP `400` means the request is invalid; `401`/`403` are authentication or
111+
tenant/permission failures; `409` means the request conflicts with current
112+
state.
113+
114+
## 20–25 min: submit one idempotent command
115+
116+
The command create operation requires `Idempotency-Key`. Reuse the same key
117+
only when retrying the same logical command.
118+
119+
```bash
120+
export CORELINK_IDEMPOTENCY_KEY="quickstart-$(date +%s)"
121+
122+
COMMAND_RESPONSE="$(curl --fail-with-body --silent --show-error \
123+
-X POST \
124+
-H "Authorization: Bearer $CORELINK_ACCESS_TOKEN" \
125+
-H "Content-Type: application/json" \
126+
-H "Idempotency-Key: $CORELINK_IDEMPOTENCY_KEY" \
127+
"$CORELINK_API_URL/api/v1/tenants/$CORELINK_TENANT_ID/devices/$CORELINK_DEVICE_ID/commands" \
128+
--data '{"command_type":"quickstart.ping","payload":{},"metadata":{"source":"docs-v1-quickstart"}}')"
129+
130+
printf '%s\n' "$COMMAND_RESPONSE"
131+
```
132+
133+
A successful submission returns HTTP `201` and a `Command`. Record its
134+
`command_id`:
135+
136+
```bash
137+
export CORELINK_COMMAND_ID="<command-uuid>"
138+
```
139+
140+
Command status is one of `queued`, `dispatching`, `sent`, `acknowledged`,
141+
`succeeded`, `failed`, `timed_out`, or `cancelled`. A `201` response
142+
means the command was accepted; it does not mean device execution succeeded.
143+
144+
## 25–30 min: inspect the command
145+
146+
```bash
147+
curl --fail-with-body --silent --show-error \
148+
-H "Authorization: Bearer $CORELINK_ACCESS_TOKEN" \
149+
"$CORELINK_API_URL/api/v1/tenants/$CORELINK_TENANT_ID/devices/$CORELINK_DEVICE_ID/commands/$CORELINK_COMMAND_ID"
150+
```
151+
152+
Expected failures use the contract's `application/problem+json` shape and carry
153+
a `correlation_id` for diagnosis. Preserve that identifier when escalating an
154+
unexpected error.
155+
156+
## Tenant-isolation check
157+
158+
If you have two explicitly authorized test tenants, repeat a read with the token
159+
and tenant combination provided for each environment. A token must never gain
160+
access merely because a caller changes `tenant_id` in the URL. Do not probe
161+
tenants you are not authorized to test.
162+
163+
## Safe retry rules
164+
165+
- GET requests may be retried according to the environment's documented policy.
166+
- For command POST retries, retain the original `Idempotency-Key`.
167+
- Do not automatically retry `400`, `401`, `403`, or `404`.
168+
- Treat `409` as a state/idempotency conflict that needs reconciliation.
169+
- A readiness `503` is an environment/dependency failure, not proof that a
170+
write failed or succeeded.
171+
172+
## Definition of a successful quickstart
173+
174+
The quickstart is complete when the developer has retained:
175+
176+
- the environment/contract baseline used;
177+
- the authorized tenant ID;
178+
- one successful tenant-scoped read;
179+
- one `corelink_device_id` from an existing or newly created device;
180+
- one command ID plus its observed terminal or current state;
181+
- any failure `correlation_id` needed for follow-up.
182+
183+
For SDK usage, sandbox packaging and broader resource guides, follow their
184+
repository maturity. TypeScript/Python are prerelease Alpha; Java, CLI, MCP and
185+
mock-server remain Scaffold/Planned until their release gates pass.

0 commit comments

Comments
 (0)