• Register

Penguin Random House Developer Blog

Enhanced API v1.2.13 released

On Thursday November 17, 2016, version 1.2.13 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.2.13 release notes

This release has several minor enhancements.

Additional promo image fields

The first relates to promo images and includes a couple new fields (releaseB2B and releaseB2C) as well as a link added to be able to fetch the indicated image.

/domains/PRH.US/titles/9780307269942/promoimages

    "promoImages": [
      {
        "promoImageId": 2809,
        "category": "5",
        "contributor": null,
        "copyright": null,
        "imageName": "9780307269942_1287.jpg",
        "videoLink": null,
        "photoCredit": null,
        "photoDate": null,
        "photoCaption": null,
        "releaseB2B": null,
        "releaseB2C": "2009-04-23",
        "_links": [
          {
            "rel": "icon",
            "href": "https:\/\/images.randomhouse.com\/promo_image\/9780307269942_1287.jpg",
            "method": "GET",
            "parameters": null
          }
        ],
        "_embeds": null
      },

Handling empty results

The next change involves a new parameter, returnEmptyLists, which takes a boolean 'true' or 'false' and alters how the API handles 404 results. For example, this request for the e-book version of work ID #12 normally returns a 404.

/domains/PRH.US/works?workId=12&format=EL

{
  "code": 404,
  "message": "Not found",
  "request": {
    "method": "listWorks",
    "parameters": {
      "domain": "PRH.US",
      "workId": "12",
      "format": "EL",
      "clientGroup": "Public"
    },
    "url": "http:\/\/api.penguinrandomhouse.com\/resources\/v2\/title\/domains\/PRH.US\/works"
  },
  "exception": null
}

However if we specify returnEmptyLists=true, then we'll get back a 200.

/domains/PRH.US/works?workId=12&format=EL&returnEmptyLists=true

{
  "status": "ok",
  "recordCount": 0,
  "startTimestamp": "2016-11-17T12:43Z",
  "endTimestamp": "2016-11-17T12:43Z",
  "timeTaken": 4,
  "data": [
    
  ],
  "error": null,
  "params": {
    "domain": "PRH.US",
    "workId": "12",
    "format": "EL",
    "clientGroup": "Public"
  }
}

More filters

The sales platform requested that we add some more filters and so we've added filter parameters ignoreDivisionCode, ignoreSaleStatus and ignoreSalesRestriction. In addition we've created a new parameter called siteFilter though it is still in development and not currently ready to be used. Basically the idea with that is that the Common Reads site wanted to be able to use an existing domain that contains a superset of all the titles they want to display. Further, they are developing a standard set of filters that they will want applied to *all* the calls being made from that site. Since it would be cumbersome to try to maintain that filter list separately on each different call for the site, I agreed to take a copy of those filters in JSON form and add it to the API configuration under the key "CommonReads". Then what we can do is expose to them this siteFilter parameter such that when they append '&siteFilter=CommonReads' to their calls, it will automatically add all of those configured filters to the call. Like I said, this is not completed yet and when we have a better working example of this feature, I will demonstrate it in the release notes. If you have need of this kind of functionality or think it would aid your development, get in touch with the API team and we can discuss adding a site filter specific to your site as well. Using these site filters helps to limit the explosion of site-specific domains.

Other changes

There are a few other miscellaneous changes as well. Of those, the only one relevant to our users is that the views also-purchased and matches-on-tag can now be filtered by formatFamily

Bug

  • [RHAPI-606] - Please add two new UK domains

New Feature

  • [RHAPI-597] - Add three new ignore parameters: divisionCode, saleStatus, salesRestriction
  • [RHAPI-604] - Add parameter so that empty lists return 200 instead of 404
  • [RHAPI-605] - Add support for formatFamily parameter to matches-on-tag and also-purchased views

Task

  • [RHAPI-598] - Add Common Reads guides (new promo images) into product-display

Sub-task

  • [RHAPI-600] - Add two fields to ISBNxPROMOIMAGE in datamover