Skip to content

Commit ca982f0

Browse files
Add examples of what 'list space contents' response looks like.
Signed-off-by: Dmitri Zagidulin <dzagidulin@gmail.com>
1 parent 3c83dc0 commit ca982f0

File tree

1 file changed

+56
-2
lines changed

1 file changed

+56
-2
lines changed

spec.md

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,9 @@ Example error response (a space with the specified `id` already exists):
478478
* Requires appropriate authorization (root zcap invoked by the space's controller,
479479
or a zcap granting permission to read a particular space)
480480
* Returns the details for the specified space `id`
481+
* Only includes the resources the requester is authorized to see
482+
483+
The format of the response is determined based on content negotiation.
481484

482485
#### (HTTP API) GET `/space/{space_id}`
483486

@@ -490,7 +493,7 @@ Accept: application/json
490493
Authorization: Signature keyId="did:key:z6MkpBMbMaRSv5nsgifRAwEKvHHoiKDMhiAHShTFNmkJNdVW#z6MkpBMbMaRSv5nsgifRAwEKvHHoiKDMhiAHShTFNmkJNdVW" ...
491494
```
492495

493-
Example success response:
496+
Example success response (the space is empty of contents):
494497

495498
```http
496499
HTTP/1.1 200 OK
@@ -501,14 +504,65 @@ Content-type: application/json
501504
"type": ["Space"],
502505
"name": "Example space #1",
503506
"controller": "did:key:z6MkpBMbMaRSv5nsgifRAwEKvHHoiKDMhiAHShTFNmkJNdVW",
504-
"linkset": "/space/81246131-69a4-45ab-9bff-9c946b59cf2e/linkset"
507+
"linkset": "/space/81246131-69a4-45ab-9bff-9c946b59cf2e/linkset",
508+
"totalItems": 0
509+
}
510+
```
511+
512+
Example success response (resources have been added to the space):
513+
514+
* Contents listed in a format inspired by [ActivityStreams 2](https://www.w3.org/TR/activitystreams-core/#collections)
515+
Collections
516+
* No pagination used
517+
* The requester is authorized to see two of these items
518+
519+
```http
520+
HTTP/1.1 200 OK
521+
Content-type: application/json
522+
523+
{
524+
"id": "81246131-69a4-45ab-9bff-9c946b59cf2e",
525+
"type": ["Space"],
526+
"name": "Example space #1",
527+
"controller": "did:key:z6MkpBMbMaRSv5nsgifRAwEKvHHoiKDMhiAHShTFNmkJNdVW",
528+
"linkset": "/space/81246131-69a4-45ab-9bff-9c946b59cf2e/linkset",
529+
"totalItems": 2,
530+
"items": [
531+
{ "id": "https://example.com/space/81246131-69a4-45ab-9bff-9c946b59cf2e/10f6672d-7a24-486b-9622-691007ded846" },
532+
{ "id": "https://example.com/space/81246131-69a4-45ab-9bff-9c946b59cf2e/b42ec4d8-6ead-486d-b70a-c25d2ce4dfc7" }
533+
]
505534
}
506535
```
507536

537+
#### Read Space Errors
538+
508539
Example error response (missing or insufficient authorization):
509540

541+
A server MUST return the same error response in the case of missing or insufficient
542+
authorization as it would for a missing/not found space.
543+
544+
```http
545+
HTTP/1.1 404 Not Found
546+
Content-type: application/problem+json
547+
Content-Language: en
548+
{
549+
"type": "https://wallet.storage/spec#read-space-errors",
550+
"title": "Space not found or insufficient authorization."
551+
}
552+
```
553+
510554
Example error response (space id not found):
511555

556+
```http
557+
HTTP/1.1 404 Not Found
558+
Content-type: application/problem+json
559+
Content-Language: en
560+
{
561+
"type": "https://wallet.storage/spec#read-space-errors",
562+
"title": "Space not found or insufficient authorization."
563+
}
564+
```
565+
512566
### List Spaces Operation
513567

514568
* Requires appropriate authorization (root zcap invoked by the controller of one

0 commit comments

Comments
 (0)