Discrepancies between the streaming and REST API

Hi,

I’m working on a project for HMRC collaborating with yourselves at Companies House to bring in non XBRL Companies House “accounts” category returns of type

  • AA
  • AAMD
  • AA01
  • AA02

This is to help tax investigators see the approximate 15% of CH accounts returns (including amendments) that are not filed electronically.

When receiving data on the streaming API filings endpoint I seem to be getting back different data than from the REST endpoint.

I didn’t get the links.document_metadata back from the streaming API

{
  "resource_kind":"filing-history",
  "resource_uri":"/company/05404300/filing-history/MzI1NTQ5MDgxNWFkaXF6a2N4",
  "resource_id":"MzI1NTQ5MDgxNWFkaXF6a2N4",
  "data":{
    "barcode":"A8XCP2JM",
    "category":"accounts",
    "date":"2020-01-28",
    "description":"accounts-amended-with-accounts-type-total-exemption-full",
    "description_values":{
      "made_up_date":"2019-03-31"
    },
    "links":{
      "self":"/company/05404300/filing-history/MzI1NTQ5MDgxNWFkaXF6a2N4"
    },
    "paper_filed":true,
    "transaction_id":"MzI1NTQ5MDgxNWFkaXF6a2N4",
    "type":"AAMD"
  },
  "event":{
    "timepoint":22300545,
    "published_at":"2020-01-28T12:19:20",
    "type":"changed"
  }
}

But I did when I called the REST API for the same record I did get links.document_metadata

{
  "action_date": "2019-03-31",
  "category": "accounts",
  "date": "2020-01-28",
  "description": "accounts-amended-with-accounts-type-total-exemption-full",
  "description_values": {
    "made_up_date": "2019-03-31"
  },
  "links": {
    "self": "/company/05404300/filing-history/MzI1NTQ5MDgxNWFkaXF6a2N4",
    "document_metadata": "https://frontend-doc-api.companieshouse.gov.uk/document/t4NXmzuJ5foitgVgM44AR08A2lR2jVrkHWCNNTlC7yM"
  },
  "paper_filed": true,
  "type": "AAMD",
  "pages": 2,
  "barcode": "A8XCP2JM",
  "transaction_id": "MzI1NTQ5MDgxNWFkaXF6a2N4"
}

Okay I thought, so maybe you only get the link to the document back when you call the REST API. But then the following came through the streaming API with a link to the document

{ 
   "resource_kind":"filing-history",
   "resource_uri":"/company/11161983/filing-history/MzI1NDcxODg4NmFkaXF6a2N4",
   "resource_id":"MzI1NDcxODg4NmFkaXF6a2N4",
   "data":{ 
      "action_date":"2019-03-31",
      "barcode":"A8WPR5Y1",
      "category":"accounts",
      "date":"2020-01-16",
      "description":"accounts-amended-with-accounts-type-group",
      "description_values":{ 
         "made_up_date":"2019-03-31"
      },
      "links":{ 
         **"document_metadata":"https://frontend-doc-api.companieshouse.gov.uk/document/gldh4UU0yubZxh__wasjhuZwi5RK5BxmH1_t8uBZL6Y"**,
         "self":"/company/11161983/filing-history/MzI1NDcxODg4NmFkaXF6a2N4"
      },
      "pages":33,
      "paper_filed":"1",
      "transaction_id":"MzI1NDcxODg4NmFkaXF6a2N4",
      "type":"AAMD"
   },
   "event":{ 
      "timepoint":22309437,
      "published_at":"2020-01-28T13:23:02",
      "type":"deleted"
   }
}

I tried requesting the same document from the REST API but I got a 404 back :frowning:

I’m confused. What rule should I follow to ensure I can always get the links.document_metadata data?

Martin