Skip to content

Save your reading position

PUT
/api/v1/publications/{publicationId}/progress
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.

publicationId
required
integer format: int64
Media typeapplication/json
object
expectedRevision
required

The revision last read, or 0 when nothing was saved.

integer format: int64
locator
required

A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.

object
href
required
string
>= 1 characters
type
required

The resource’s media type.

string

Example

application/xhtml+xml
title
string
locations
object
fragments
Array<string>
progression

Position within the resource.

number
<= 1
totalProgression

Position within the publication.

number
<= 1
position
integer
>= 1
text
object
before
string
highlight
string
after
string

The position was saved.

Media typeapplication/json
object
revision
required

Counts saves; 0 when nothing has been saved.

integer format: int64
locator
required
One of:

A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.

object
href
required
string
>= 1 characters
type
required

The resource’s media type.

string
title
string
locations
object
fragments
Array<string>
progression

Position within the resource.

number
<= 1
totalProgression

Position within the publication.

number
<= 1
position
integer
>= 1
text
object
before
string
highlight
string
after
string
device
required

The device name of the session that saved it.

string | null
updatedAt
required
string | null format: date-time

Example

{
"locator": {
"type": "application/xhtml+xml"
}
}

The request was malformed.

Media typeapplication/json
object
code
required
string
Allowed values: bad_request unauthorized forbidden not_found unavailable scan_in_progress content_changed already_set_up name_taken last_admin progress_conflict too_many_attempts not_linked identity_taken last_sign_in provider_unavailable too_many_sign_ins repository_exists repository_not_allowed repository_unreadable repository_needs_token repository_needs_password repository_needs_credentials repository_credentials_refused extension_invalid source_failed source_unavailable source_check_failed internal
message
required

Explains the problem to a developer.

string

Example

{
"code": "bad_request"
}

The request has no valid session token.

Media typeapplication/json
object
code
required
string
Allowed values: bad_request unauthorized forbidden not_found unavailable scan_in_progress content_changed already_set_up name_taken last_admin progress_conflict too_many_attempts not_linked identity_taken last_sign_in provider_unavailable too_many_sign_ins repository_exists repository_not_allowed repository_unreadable repository_needs_token repository_needs_password repository_needs_credentials repository_credentials_refused extension_invalid source_failed source_unavailable source_check_failed internal
message
required

Explains the problem to a developer.

string

Example

{
"code": "bad_request"
}

The resource does not exist.

Media typeapplication/json
object
code
required
string
Allowed values: bad_request unauthorized forbidden not_found unavailable scan_in_progress content_changed already_set_up name_taken last_admin progress_conflict too_many_attempts not_linked identity_taken last_sign_in provider_unavailable too_many_sign_ins repository_exists repository_not_allowed repository_unreadable repository_needs_token repository_needs_password repository_needs_credentials repository_credentials_refused extension_invalid source_failed source_unavailable source_check_failed internal
message
required

Explains the problem to a developer.

string

Example

{
"code": "bad_request"
}

Another device saved first; current is its position.

Media typeapplication/json
object
code
required
string
Allowed value: progress_conflict
message
required
string
current
required
object
revision
required

Counts saves; 0 when nothing has been saved.

integer format: int64
locator
required
One of:

A Readium Locator. The server checks the fields below and stores the rest as sent, up to 16 KiB in all.

object
href
required
string
>= 1 characters
type
required

The resource’s media type.

string
title
string
locations
object
fragments
Array<string>
progression

Position within the resource.

number
<= 1
totalProgression

Position within the publication.

number
<= 1
position
integer
>= 1
text
object
before
string
highlight
string
after
string
device
required

The device name of the session that saved it.

string | null
updatedAt
required
string | null format: date-time

Example

{
"code": "progress_conflict",
"current": {
"locator": {
"type": "application/xhtml+xml"
}
}
}

The server failed; details are in its log.

Media typeapplication/json
object
code
required
string
Allowed values: bad_request unauthorized forbidden not_found unavailable scan_in_progress content_changed already_set_up name_taken last_admin progress_conflict too_many_attempts not_linked identity_taken last_sign_in provider_unavailable too_many_sign_ins repository_exists repository_not_allowed repository_unreadable repository_needs_token repository_needs_password repository_needs_credentials repository_credentials_refused extension_invalid source_failed source_unavailable source_check_failed internal
message
required

Explains the problem to a developer.

string

Example

{
"code": "bad_request"
}