# Work

A work, its editions and its contents.

Canonical: https://interlinea.aeterna-institute.org/docs/api/work

`GET /api/v1/library/{lang}/{author}/{work}`

Mirrors the work page. The contents list the default edition's reading sections in order, a page at a time.

## Parameters

| Field | Type | Description |
|---|---|---|
| `lang` | string, in path | Required. Language as in site URLs. One of `latin`, `greek`. Example `latin`. |
| `author` | string, in path | Required. Example `virgil`. |
| `work` | string, in path | Required. Work slug, as in the site URL. Example `aeneid`. |
| `limit` | integer, in query | Optional. At most 1000. Default `200`. From 1 to 1,000. |
| `offset` | integer, in query | Optional. Default `0`. From 0 to 100,000. |

## Response

`200 OK` with a `Work` object.

| Field | Type | Description |
|---|---|---|
| `title` | string |  |
| `nativeTitle` | string or null | The title in Latin or Greek, when it differs. |
| `author` | string |  |
| `lang` | string | Language code: la (Latin) or grc (Ancient Greek). One of `la`, `grc`. |
| `genre` | string or null |  |
| `words` | integer |  |
| `sections` | integer | Reading sections. |
| `urn` | string or null | CTS URN, e.g. urn:cts:latinLit:phi0690.phi003.perseus-lat2:1.1-1.11. Null when the edition has none (The Latin Library's own numbering). |
| `url` | string | Absolute URL. |
| `api` | string | Absolute URL. |
| `language` | string |  |
| `form` | string or null | prose, verse or mixed. |
| `meter` | string or null |  |
| `markdown` | string | Absolute URL. |
| `authorUrl` | string | Absolute URL. |
| `credit` | Credit or null | The default edition's credit: the text every section URL serves. |
| `credit.text` | string | Credit line for the edition: author, work, editor, source, licence and changes. Quote it when you reuse the text. |
| `credit.license` | string | CC BY-SA 4.0, CC BY 3.0, Used with permission (The Latin Library), or a public-domain note. |
| `credit.licenseUrl` | string or null |  |
| `credit.source` | string | Where the edition comes from. |
| `credit.quality` | string | ocr: an unproofread scan. One of `proofread`, `ocr`. |
| `editions` | array of object |  |
| `editions[].id` | string |  |
| `editions[].urn` | string or null | CTS URN, e.g. urn:cts:latinLit:phi0690.phi003.perseus-lat2:1.1-1.11. Null when the edition has none (The Latin Library's own numbering). |
| `editions[].default` | boolean |  |
| `editions[].credit` | Credit |  |
| `editions[].credit.text` | string | Credit line for the edition: author, work, editor, source, licence and changes. Quote it when you reuse the text. |
| `editions[].credit.license` | string | CC BY-SA 4.0, CC BY 3.0, Used with permission (The Latin Library), or a public-domain note. |
| `editions[].credit.licenseUrl` | string or null |  |
| `editions[].credit.source` | string | Where the edition comes from. |
| `editions[].credit.quality` | string | ocr: an unproofread scan. One of `proofread`, `ocr`. |
| `contents` | object |  |
| `contents.total` | integer |  |
| `contents.offset` | integer |  |
| `contents.limit` | integer |  |
| `contents.next` | string or null | The next page of contents. |
| `contents.sections` | array of object |  |
| `contents.sections[].ref` | string |  |
| `contents.sections[].refEnd` | string |  |
| `contents.sections[].label` | string |  |
| `contents.sections[].words` | integer |  |
| `contents.sections[].url` | string | Absolute URL. |

## Errors

| Status | When |
|---|---|
| `400 Bad Request` | A parameter is missing or invalid, or the reference isn't a text. |
| `404 Not Found` | Not in the library. |
| `429 Too Many Requests` | Too many requests from one address. Wait a minute. |
| `500 Internal Server Error` | Something went wrong on our side. |

Error bodies are described in [Caching, limits and errors](https://interlinea.aeterna-institute.org/docs/limits.md#errors).

## Example request

curl:

```sh
curl "https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid"
```

JavaScript:

```js
const res = await fetch("https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid")
const data = await res.json()
console.log(data)
```

Python:

```python
import json
from urllib.request import urlopen

with urlopen("https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid") as res:
    data = json.load(res)

print(data)
```

## Example response

Response (200 OK):

```json
{
  "title": "Aeneid",
  "nativeTitle": "Aeneis",
  "author": "Virgil",
  "lang": "la",
  "genre": "epic",
  "words": 63347,
  "sections": 223,
  "urn": "urn:cts:latinLit:phi0690.phi003",
  "url": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid",
  "api": "https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid",
  "language": "Latin",
  "form": "verse",
  "meter": "hexameter",
  "markdown": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid.md",
  "authorUrl": "https://interlinea.aeterna-institute.org/library/latin/virgil",
  "credit": {
    "text": "Virgil, Aeneid, ed. J. B. Greenough. Text: the Perseus Digital Library, canonical-latinLit, CC BY-SA 4.0. Changes: apostrophes normalised an…",
    "license": "CC BY-SA 4.0",
    "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
    "source": "https://github.com/PerseusDL/canonical-latinLit/blob/master/data/phi0690/phi003/phi0690.phi003.perseus-lat2.xml",
    "quality": "proofread"
  },
  "editions": [
    {
      "id": "phi0690.phi003.ll1",
      "urn": null,
      "default": false,
      "credit": {
        "text": "Virgil, AENEID. Text: The Latin Library (thelatinlibrary.com), used with permission. Changes: HTML markup removed and the text divided into…",
        "license": "Used with permission",
        "licenseUrl": "https://www.thelatinlibrary.com/about.html",
        "source": "https://www.thelatinlibrary.com/verg.html",
        "quality": "proofread"
      }
    },
    {
      "id": "phi0690.phi003.perseus-lat2",
      "urn": "urn:cts:latinLit:phi0690.phi003.perseus-lat2",
      "default": true,
      "credit": {
        "text": "Virgil, Aeneid, ed. J. B. Greenough. Text: the Perseus Digital Library, canonical-latinLit, CC BY-SA 4.0. Changes: apostrophes normalised an…",
        "license": "CC BY-SA 4.0",
        "licenseUrl": "https://creativecommons.org/licenses/by-sa/4.0/",
        "source": "https://github.com/PerseusDL/canonical-latinLit/blob/master/data/phi0690/phi003/phi0690.phi003.perseus-lat2.xml",
        "quality": "proofread"
      }
    }
  ],
  "contents": {
    "total": 223,
    "offset": 0,
    "limit": 200,
    "next": "https://interlinea.aeterna-institute.org/api/v1/library/latin/virgil/aeneid?offset=200&limit=200",
    "sections": [
      {
        "ref": "1.1",
        "refEnd": "1.45",
        "label": "Lines 1.1-1.45",
        "words": 287,
        "url": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid/1.1"
      },
      {
        "ref": "1.46",
        "refEnd": "1.86",
        "label": "Lines 1.46-1.86",
        "words": 276,
        "url": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid/1.46"
      },
      {
        "ref": "1.87",
        "refEnd": "1.130",
        "label": "Lines 1.87-1.130",
        "words": 290,
        "url": "https://interlinea.aeterna-institute.org/library/latin/virgil/aeneid/1.87"
      },
      // 197 more
    ]
  }
}
```

## Try it

Send a real GET from your browser and see the answer, its status and how long it took.

---

Previous: [Author](https://interlinea.aeterna-institute.org/docs/api/author.md)
Next: [Section](https://interlinea.aeterna-institute.org/docs/api/section.md)
