Save your reading position
const url = 'http://localhost:8080/api/v1/publications/1/progress';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expectedRevision":1,"locator":{"href":"example","type":"application/xhtml+xml","title":"example","locations":{"fragments":["example"],"progression":1,"totalProgression":1,"position":1},"text":{"before":"example","highlight":"example","after":"example"}}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url http://localhost:8080/api/v1/publications/1/progress \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expectedRevision": 1, "locator": { "href": "example", "type": "application/xhtml+xml", "title": "example", "locations": { "fragments": [ "example" ], "progression": 1, "totalProgression": 1, "position": 1 }, "text": { "before": "example", "highlight": "example", "after": "example" } } }'Saves only if the stored revision is still expectedRevision. If
another device saved since, the response is a conflict carrying that
position; the client asks the reader which one to keep and saves
again with the revision from the conflict. The server never resolves a
conflict by keeping the position furthest along.
A demo account’s save is answered as saved but not kept, since everyone trying the demo shares the account.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
The revision last read, or 0 when nothing was saved.
A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.
object
The resource’s media type.
Example
application/xhtml+xmlobject
Position within the resource.
Position within the publication.
object
Responses
Section titled “Responses”The position was saved.
object
Counts saves; 0 when nothing has been saved.
A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.
object
The resource’s media type.
object
Position within the resource.
Position within the publication.
object
The device name of the session that saved it.
Example
{ "locator": { "type": "application/xhtml+xml" }}The request was malformed.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The request has no valid session token.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The resource does not exist.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}Another device saved first; current is its position.
object
object
Counts saves; 0 when nothing has been saved.
A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.
object
The resource’s media type.
object
Position within the resource.
Position within the publication.
object
The device name of the session that saved it.
Example
{ "code": "progress_conflict", "current": { "locator": { "type": "application/xhtml+xml" } }}The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}