• Register

Penguin Random House Developer Blog

Enhanced API v1.3.8 released

On Friday November 17, 2017, version 1.3.8 of the Enhanced PRH API was released to production. If you encounter any problems with your applications as a result of these changes, please contact us at api@penguinrandomhouse.com.

Version 1.3.8 release notes

This release has an update to the Title object as well as a new endpoint for generating category hierarchies that performs better than the original.

Publisher element

The endpoint /titles now generates objects that contain a new code/description pair named publisher.

/domains/PRH.US/titles/9780143107453

"publisher":{"code":"6262","description":"Penguin Publishing Group"}

New category hierarchy endpoint

The original category hierarchy has always been a sore point. It was designed for a very particular business need and thus never performed well as a general purpose hierarchy representation. I had in mind an idea to rewrite it to improve performance but I was concerned with breaking backwards compatability so in the end I just rolled a completely new endpoint: /categories/views/hierarchy-alt.

/domains/PRH.US/categories/views/hierarchy-alt?catSetId=CN&depth=2

{
  "recordCount": 10,
  "startTimestamp": "2017-11-17T19:00:32Z",
  "endTimestamp": "2017-11-17T19:00:32Z",
  "timeTaken": 10,
  "data": {
    "categories": [
      {
        "catId": 2000000000,
        "catDesc": "Consumer Category",
        "catUri": null,
        "menuText": null,
        "leafNode": false,
        "titleCount": null,
        "children": [
          {
            "catId": 2000000169,
            "catDesc": "Audiobooks",
            "catUri": "\/audiobooks",
            "menuText": "Audiobooks",
            "leafNode": true,
            "titleCount": null,
            "children": [
              
            ],
            "parent": null,
            "_embeds": null,
            "_links": [
              {
                "rel": "self",
                "href": "http:\/\/api.penguinrandomhouse.com\/resources\/v2\/title\/domains\/PRH.US\/categories\/2000000169",
                "method": "GET",
                "parameters": null
              }
            ]
          },

Either you need to supply a catSetId (starting at the top of the hierarchy) or a specific catId or catUri to identify an anchor category. Then you may specify the depth to restrict the number of levels that are returned (depth=1 just returns the category you specified; depth=2 returns your category and its children). There is also an optional siteFilter and countTitles parameter that the sales sites need to support their menuing system.

The advantages of this endpoint over /categories/views/hierarchy are primarily in the performance. That original view was built recursively and so for larger hierarchies can generate a lot of queries. This new one fetches all the IDs for a particular layer at a time and then looks up all the metadata at the end so it performs much better for fetching the full tree. I also like that it has links which makes it easier to browse.

New Feature

  • [RHAPI-789] - Expose publisher name as part of Title representation

Task

  • [RHAPI-698] - Improve performance of /categories/views/hierarchy
  • [RHAPI-807] - Sales Platform | Create a site-specific title count in /categories/views/hierarchy
  • [RHAPI-819] - Create siteFilter for Higher Education

Sub-Task

  • [RHAPI-806] - Add Publisher to Title representation