Canvas
Read a whole canvas as JSON blocks, Markdown or a heading outline.
Read a canvas as JSON blocks, Markdown or an outline
GET/api/v1/files/{fileId}
The canvas as JSON blocks (default), Markdown or a heading outline. Every block carries its blockId and a rev hash; the document rev comes back as ETag. Pass a block's rev as ifMatch, or the document's as If-Match, when you change it.
If nobody has the file open, OpenCanvas loads it from your load callback first.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
fileIdrequired | path | string | The host's file id 1 to 1024 characters. |
format | query | string | json (default), markdown or outline One of json, markdown, outline. |
Responses
200OK
Headers
| Header | Description |
|---|---|
ETag | The document (or block) revision, quoted. |
Idempotency-Replayed | true when this is the stored answer of an earlier request with the same Idempotency-Key |
RateLimit-Policy | Token buckets that apply: "subject";q=<burst>;w=<seconds to refill>, and "file-writes" on writes |
RateLimit | The bucket closest to empty: "<name>";r=<remaining>;t=<seconds until full> |
Link | <…?cursor=…&limit=…>; rel="next" when more follow |
Body application/json
| Field | Type | Description |
|---|---|---|
title | any | - |
rev | string | - |
truncated | boolean | - |
markdown | string | - |
blocks | array | - |
outline | array | - |
counts | object | - |
Example
{
"blocks": [
{
"blockId": "b_01m87jv4rtz1wkrv27pzmqk64r",
"node": {
"attrs": {
"blockId": "b_01m87jv4rtz1wkrv27pzmqk64r",
"level": 2
},
"content": [
{
"text": "Launch plan",
"type": "text"
}
],
"type": "heading"
},
"rev": "689ac3d33e18"
},
{
"blockId": "b_01m87jv4rtkdxymn93jwtx35sk",
"node": {
"attrs": {
"blockId": "b_01m87jv4rtkdxymn93jwtx35sk"
},
"content": [
{
"text": "Ship on Friday.",
"type": "text"
}
],
"type": "paragraph"
},
"rev": "5641be1fd2cb"
},
{
"blockId": "b_01m87jv4rtngbs1n2p5aypa4mz",
"node": {
"attrs": {
"blockId": "b_01m87jv4rtngbs1n2p5aypa4mz"
},
"content": [
{
"attrs": {
"checked": false
},
"content": [
{
"content": [
{
"text": "Write the release notes",
"type": "text"
}
],
"type": "paragraph"
}
],
"type": "taskItem"
}
],
"type": "taskList"
},
"rev": "92c98e698f58"
}
],
"rev": "fc3a67f52c7b",
"title": null,
"truncated": false
}400Bad Request: BAD_INPUT, PATCH_INVALID, CURSOR_INVALID, IDEMPOTENCY_KEY_INVALID, …
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:bad-input",
"title": "Bad Request",
"status": 400,
"detail": "rows[0].values must be an object",
"code": "BAD_INPUT"
}Codes: BAD_INPUT.
401Unauthorized: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:unauthenticated",
"title": "Unauthorized",
"status": 401,
"detail": "missing or wrong credentials",
"code": "UNAUTHENTICATED"
}Codes: UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED.
403Forbidden: ROLE_FORBIDDEN, SCOPE_REQUIRED, FILES_REQUIRED
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:scope-required",
"title": "Forbidden",
"status": 403,
"detail": "SCOPE_REQUIRED: comment_add needs canvas:comment",
"code": "SCOPE_REQUIRED"
}Codes: SCOPE_REQUIRED, ROLE_FORBIDDEN, FILES_REQUIRED.
404Not Found: API_OFF, BLOCK_NOT_FOUND, NOT_FOUND, …
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:api-off",
"title": "Not Found",
"status": 404,
"detail": "the API is not enabled for this host ([host.flags] api_v1)",
"code": "API_OFF"
}Codes: API_OFF.
429Too Many Requests: RATE_LIMITED, with Retry-After, RateLimit-Policy and RateLimit
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:rate-limited",
"title": "Too Many Requests",
"status": 429,
"detail": "too many requests (subject limit); retry later",
"code": "RATE_LIMITED"
}Codes: RATE_LIMITED.
502Bad Gateway: HOST_UNAVAILABLE: your load or save callback failed
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:host-unavailable",
"title": "Bad Gateway",
"status": 502,
"detail": "host answered 503 Service Unavailable",
"code": "HOST_UNAVAILABLE"
}Codes: HOST_UNAVAILABLE.
503Service Unavailable: UNAVAILABLE, ROOM_UNAVAILABLE, with Retry-After
Body application/problem+json
| Field | Type | Description |
|---|---|---|
typerequired | string | Format uri-reference. |
titlerequired | string | - |
statusrequired | integer | - |
detail | string | - |
coderequired | string | Machine code (BLOCK_NOT_FOUND, STALE_BLOCK, ROLE_FORBIDDEN, …) |
fresh | any | STALE_BLOCK: the current state to retry against |
Other members may appear; ignore the ones you do not know.
Example
{
"type": "urn:opencanvas:problem:unavailable",
"title": "Service Unavailable",
"status": 503,
"detail": "the idempotency store is unavailable; retry",
"code": "UNAVAILABLE"
}Codes: UNAVAILABLE.
Errors
| Status | Code | When |
|---|---|---|
| 400 | BAD_INPUT | The request is not what the operation takes: the body is not a JSON object, a field is missing or has the wrong type, an op, mode, format or event type is unknown, or fileId is longer than 1,024 bytes. detail says which. |
| 502 | HOST_UNAVAILABLE | Your load or save callback failed or timed out, so the file could not be loaded or saved. |
Also, like every operation on a file: API_OFF, UNAUTHENTICATED, TOKEN_INVALID, TOKEN_EXPIRED, SCOPE_REQUIRED, ROLE_FORBIDDEN, FILES_REQUIRED, RATE_LIMITED, UNAVAILABLE, INTERNAL.
Last changed .