Profile: document

Profile Schema

The document profile is the “base” profile for all CDS documents; every document (and subdocument/asset) is required to list this profile in their profile list. The document profile specifies the base set of requirements needed by CDS to correctly process the document.

Please read: Within the profile documentation we have examples for asset and subdocument JSON. Some of these may not have the document profile referenced however in reality they should. If you see this just note that in order to be valid, any of these documents need to include /v1/profiles/document in the profiles array.

Structure

The document profile specifies two required properties:

  • id - Each document in CDS must have an ID. IDs must be compliant with the regex specified in the documentId schema.
  • profiles - Each document in CDS must specify a list of profiles that it is compliant with. Profiles are represented by links to CDS profile documents. For more informaiton, see the “Profiles” section below.

It also specifies two optional attributes:

  • authorizedOrgServiceIds - Documents, by default, can be modified by any client that shares a prefix with its ID. In addition, it can be modified by any client that shares an authorizedOrgServiceIds entry with it. This allows documents to be modified by clients that they were not originally created by.
  • meta - This field is for CDS’ internal use only. On creation, this field should be absent from documents; if present, it will be ignored. For updates, if meta is present on retrieval, it should be returned as-is to CDS.

Profiles

Profile links can be broken into two categories: “type” and “non-type” profiles. Right now, any profile can be used as a “type” profile.

Documents must have one and only one “type” profile. The “type” profile is designated by adding the type rel to the profile link.

Example document

{
  "id": "12345",
  "profiles": [
    {
      "href": "/v1/profiles/document"
    },
    {
      "href": "/v1/profiles/story",
      "rels": [
        "type"
      ]
    }
  ],

  "authorizedOrgServiceIds": [
    "s1",
    "s350",
    "s999"
  ],

  "meta": {
    "cdsSecretCode": "40723097957p345234532"
  }
}

© 2024 npr