Skip to content

Commit ddadbbd

Browse files
committed
First draft
1 parent 187f8e5 commit ddadbbd

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

source/presentation/4.0/index.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,22 +2713,56 @@ e.g., painting TextualBody on Canvas
27132713

27142714
# Protocol
27152715

2716+
This section outlines recommendations and requirements related to URIs, HTTP requests, and authentication for IIIF resources.
27162717

2718+
## URI Recommendations
2719+
2720+
While any HTTP(S) URI is technically acceptable for any of the resources in the API, there are several best practices for designing the URIs for the resources.
2721+
2722+
* The URI _SHOULD_ use the HTTPS scheme, not HTTP.
2723+
* The URI _SHOULD NOT_ include query parameters or fragments.
2724+
* Once published, they _SHOULD_ be as persistent and unchanging as possible.
2725+
* Special characters _MUST_ be encoded.
27172726

27182727
## HTTP Requests and Responses
27192728

2720-
### URI Recommendations
2729+
This section describes the _RECOMMENDED_ request and response interactions for the API. The REST and simple HATEOAS approach is followed where an interaction will retrieve a description of the resource, and additional calls may be made by following links obtained from within the description. All of the requests use the HTTP GET method; creation and update of resources is not covered by this specification. It is _RECOMMENDED_ that implementations also support HTTP HEAD requests.
27212730

27222731
### Requests
27232732

2733+
Clients are only expected to follow links to Presentation API resources. Unlike [IIIF Image API][image-api] requests, or other parameterized services, the URIs for Presentation API resources cannot be assumed to follow any particular pattern.
2734+
27242735
### Responses
27252736

2726-
### Authentication
2737+
The format for all responses is JSON, as described above. It is good practice for all resources with an HTTP(S) URI to provide their description when the URI is dereferenced. If a resource is [referenced][prezi30-terminology] within a response, rather than being [embedded][prezi30-terminology], then it _MUST_ be able to be dereferenced.
2738+
2739+
If the server receives a request with an `Accept` header, it _SHOULD_ respond following the rules of [content negotiation][org-rfc-7231-conneg]. Note that content types provided in the `Accept` header of the request _MAY_ include parameters, for example `profile` or `charset`.
2740+
2741+
If the request does not include an `Accept` header, the HTTP `Content-Type` header of the response _SHOULD_ have the value `application/ld+json` (JSON-LD) with the `profile` parameter given as the context document: `http://iiif.io/api/presentation/4/context.json`.
2742+
2743+
{% include api/code_header.html %}
2744+
```
2745+
Content-Type: application/ld+json;profile="http://iiif.io/api/presentation/4/context.json"
2746+
```
2747+
{: .urltemplate}
2748+
2749+
If the `Content-Type` header `application/ld+json` cannot be generated due to server configuration details, then the `Content-Type` header _SHOULD_ instead be `application/json` (regular JSON), without a `profile` parameter.
2750+
2751+
{% include api/code_header.html %}
2752+
```
2753+
Content-Type: application/json
2754+
```
2755+
{: .urltemplate}
27272756

2757+
The HTTP server _MUST_ follow the [CORS requirements][org-w3c-cors] to enable browser-based clients to retrieve the descriptions. If the server receives a request with one of the content types above in the Accept header, it _SHOULD_ respond with that content type following the rules of [content negotiation][org-rfc-7231-conneg]. Recipes for enabling CORS and conditional Content-Type headers are provided in the [Apache HTTP Server Implementation Notes][notes-apache].
27282758

2759+
Responses _SHOULD_ be compressed by the server as there are significant performance gains to be made for very repetitive data structures.
27292760

2761+
## Authentication
27302762

2763+
It may be necessary to restrict access to the descriptions made available via the Presentation API. As the primary means of interaction with the descriptions is by web browsers using XmlHttpRequests across domains, there are some considerations regarding the most appropriate methods for authenticating users and authorizing their access. The approach taken is described in the [Authentication][iiif-auth] specification, and requires requesting a token to add to the requests to identify the user. This token might also be used for other requests defined by other APIs.
27312764

2765+
It is possible to include Image API service descriptions within the Manifest, and within those it is also possible to include links to the Authentication API's services that are needed to interact with the image content. The first time an Authentication API service is included within a Manifest, it _MUST_ be the complete description. Subsequent references _SHOULD_ be just the URI of the service, and clients are expected to look up the details from the full description by matching the URI. Clients _MUST_ anticipate situations where the Authentication service description in the Manifest is out of date: the source of truth is the Image Information document, or other system that references the Authentication API services.
27322766

27332767
# Accessibility
27342768

0 commit comments

Comments
 (0)