Connexions/cnx-archive — pull request #87 by karenc (2013-10-16 22:23:31+00:00)
Title: Add history and download information into the API

History information is available from the contents API together with other metadata. For example, if you go to http://localhost:6543/contents/e79ffde3-7fb4-4af3-9ec8-df648b391597@1.7, you'll get the usual metadata like:

```
"id": "e79ffde3-7fb4-4af3-9ec8-df648b391597",
"subject": "Mathematics and Statistics,Science and Technology",
"title": "College Physics",
"version": "1.7",
```

But now you'll also get this:

```
"history": [
{
"changes": "New version 1.7",
"version": "1.7",
"revised": "2013-08-31 21:07:20.342798+02",
"publisher": {
"website": null,
"surname": null,
"suffix": null,
"firstname": "OpenStax College",
"title": null,
"othername": null,
"email": "info@openstaxcollege.org",
"fullname": "OpenStax College",
"id": "e5a07af6-09b9-4b74-aa7a-b7510bee90b8"
}
},
{
"changes": "Updated something",
"version": "1.6",
"revised": "2013-07-31 21:07:20.342798+02",
"publisher": {
"website": null,
"surname": null,
"suffix": null,
"firstname": "OpenStax College",
"title": null,
"othername": null,
"email": "info@openstaxcollege.org",
"fullname": "OpenStax College",
"id": "e5a07af6-09b9-4b74-aa7a-b7510bee90b8"
}
}
]
```

That's the history information.

As for the downloads, you'll need to get it from another API. For example, if you go to http://localhost:6543/exports-allowable-types/e79ffde3-7fb4-4af3-9ec8-df648b391597@1.7, you'll get this:

```
[
{
"path": "/exports/e79ffde3-7fb4-4af3-9ec8-df648b391597@1.7.pdf",
"filename": "college-physics.pdf",
"details": "PDF file, for viewing content offline and printing.",
"format": "PDF"
},
{
"path": "/exports/e79ffde3-7fb4-4af3-9ec8-df648b391597@1.7.epub",
"filename": "college-physics.epub",
"details": "Electronic book format file, for viewing on mobile devices.",
"format": "EPUB"
},
{
"path": "/exports/e79ffde3-7fb4-4af3-9ec8-df648b391597@1.7.zip",
"filename": "college-physics.zip",
"details": "An offline HTML copy of the content. Also includes XML, included media files, and other support files.",
"format": "Offline ZIP"
}
]
```

This implementation is based on http://mountainbunker.org/~ew2/rewrite/OpenStaxCNX_DesignRevisions_v2.pdf (page 7 and 8)