Skip to content

Commit d688363

Browse files
authored
Merge pull request #2387 from IIIF/prezi-4-protocol
Prezi 4: add protocol section
2 parents d59034c + ddadbbd commit d688363

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
@@ -2740,22 +2740,56 @@ e.g., painting TextualBody on Canvas
27402740

27412741
# Protocol
27422742

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

2745+
## URI Recommendations
2746+
2747+
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.
2748+
2749+
* The URI _SHOULD_ use the HTTPS scheme, not HTTP.
2750+
* The URI _SHOULD NOT_ include query parameters or fragments.
2751+
* Once published, they _SHOULD_ be as persistent and unchanging as possible.
2752+
* Special characters _MUST_ be encoded.
27442753

27452754
## HTTP Requests and Responses
27462755

2747-
### URI Recommendations
2756+
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.
27482757

27492758
### Requests
27502759

2760+
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.
2761+
27512762
### Responses
27522763

2753-
### Authentication
2764+
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.
2765+
2766+
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`.
2767+
2768+
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`.
2769+
2770+
{% include api/code_header.html %}
2771+
```
2772+
Content-Type: application/ld+json;profile="http://iiif.io/api/presentation/4/context.json"
2773+
```
2774+
{: .urltemplate}
2775+
2776+
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.
2777+
2778+
{% include api/code_header.html %}
2779+
```
2780+
Content-Type: application/json
2781+
```
2782+
{: .urltemplate}
27542783

2784+
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].
27552785

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

2788+
## Authentication
27572789

2790+
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.
27582791

2792+
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.
27592793

27602794
# Accessibility
27612795

0 commit comments

Comments
 (0)