Bespoke Content

Some reports allow users to change parts of the content within it. For example, on consumer duty where we want to add a different introduction each month.

The Bespoke Report Content API allows users to fetch and manage content for a report.


The ReportContent Resource

Properties

  • Name
    id
    Required
    Type
    integer
    Description

    Unique identifier for the content record. If the content has different versions, this will be different for each version.

  • Name
    report
    Required
    Type
    string
    Description

    The machine friendly name for the report this content is targeting.

  • Name
    section
    Required
    Type
    string
    Description

    The section of the report this content is aimed at. For example introduction or footnote.

  • Name
    content
    Required
    Type
    string
    Description

    The content to be displayed. This is stored and returned as Markdown text.

  • Name
    tags
    Required
    Type
    array<ReportContentTag>
    Description
    • Name
      key
      Required
      Type
      string
      Description

      The key of the tag, for example year, month

    • Name
      value
      Required
      Type
      string
      Description

      The value of the tag

  • Name
    dates
    Required
    Type
    DateCollection
    Description
    • Name
      created_at
      Required
      Type
      datetime
      Description

      The date the content was created, represented in YYYY-MM-DD HH:MM:SS format

    • Name
      updated_at
      Required
      Type
      datetime
      Description

      The date the content was last updated, represented in YYYY-MM-DD HH:MM:SS format

    • Name
      deleted_at
      Required
      Type
      null | datetime
      Description

      The date the content was deleted, represented in YYYY-MM-DD HH:MM:SS format. If the content is not deleted, this will be null

Report Content Resource

{
  "id": 1,
  "report": "consumer-duty",
  "section": "introduction",
  "content": "#This is a title",
  "tags": [
    {
      "key": "year",
      "value": "2024"
    },
    {
      "key": "month",
      "value": "10"
    },
  ],
  "dates": {
    "created_at": "2024-01-01 00:00:00",
    "updated_at": "2024-01-02 12:00:00",
    "deleted_at": null,
  }
}

GET/v2/reports/content

Search Content

The search content endpoint uses the standard Search package from the SDK.

An array of ReportContent resources are returned. If no results are found, an empty collection is returned.

Search Filters

  • Name
    filters.id.equals
    Required
    Type
    integer
    Description

    Match a single report content by ID

  • Name
    filters.id.in
    Required
    Type
    array<integer>
    Description

    Match report content by multiple IDs

  • Name
    filters.report.equals
    Required
    Type
    string
    Description

    Match a report content by their report name

  • Name
    filters.report.in
    Required
    Type
    array<string>
    Description

    Match report content by multiple report names

  • Name
    filters.section.equals
    Required
    Type
    string
    Description

    Match a report content by its section

  • Name
    filters.section.in
    Required
    Type
    array<string>
    Description

    Match report content by multiple sections

  • Name
    filters.tags.equals
    Required
    Type
    string
    Description

    Match report content by its tag

  • Name
    filters.tags.in
    Required
    Type
    string
    Description

    Match report content by multiple tags

  • Name
    filters.created_at.before_or_on
    Required
    Type
    datetime
    Description

    Match all report content that was created before or on this datetime.

  • Name
    filters.created_at.after_or_on
    Required
    Type
    datetime
    Description

    Match all report content that was created after or on this datetime.

  • Name
    filters.updated_at.before_or_on
    Required
    Type
    datetime
    Description

    Match all report contents that was last updated before or on this datetime.

  • Name
    filters.updated_at.after_or_on
    Required
    Type
    datetime
    Description

    Match all report contents that was last updated after or on this datetime.

  • Name
    filters.deleted_at.equals
    Required
    Type
    boolean
    Description

    If you want to only deleted report content from results, provide true. If you only non-deleted report content, provide false

Search Ordering

  • id
  • report
  • section
  • created_at
  • updated_at
  • deleted_at

Request

GET
/v2/reports/content
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;
use Compliance\Sdk\Search\Search;

private ApexV3SdkInterface $sdk;

$search = new Search();

$response = $this->sdk
  ->v2(new Machine())
  ->reports()
  ->content()
  ->search($search);

Response

{
  "data": [
    {
      "id": 1,
      "report": "consumer-duty",
      "section": "introduction",
      "tags": [
        {
          "key": "year",
          "value": "2024"
        },
        {
          "key": "month",
          "value": "10"
        },
      ],
      "dates": {
        "created_at": "2024-01-01 00:00:00",
        "updated_at": "2024-01-02 12:00:00",
        "deleted_at": null,
      }
    }
  ]
}

POST/v2/reports/content

Create Content

Will attempt to create a new report content record

Payload

  • Name
    report
    Required
    required
    Type
    string
    Description

    The report to attach the content to. Available reports: consumer-duty

  • Name
    section
    Required
    required
    Type
    string
    Description

    The section to attach the content to. Available sections: welcome, one-minute-guide, 'uptime-statistic'

  • Name
    content
    Required
    Type
    string | null
    Description

    The content to be displayed. This can be provided in Markdown format or plain text. Markdown will be ignored for single values (for example the uptime-statistic value).

  • Name
    tags
    Required
    Type
    array<string, string>
    Description

    An array of tags and values to attach to the content

Error Codes

Status Description
422 The data provided in the payload was invalid. See errors for more details.

Request

POST
/v2/reports/content
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->reports()
  ->content()
  ->create('consumer-duty', 'welcome', 'This is some example content', [
    'month' => '10',
    'year' => '2024',
  ]);

Response

{
  "data": {
    "id": 1,
    "report": "consumer-duty",
    "section": "welcome",
    "content": "This is some example content",
    "tags": [
      {
        "key": "year",
        "value": "2024"
      },
      {
        "key": "month",
        "value": "10"
      },
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 12:00:00",
      "deleted_at": null,
    }
  }
}

GET/v2/reports/content/:content_id

Retrieve Content

Will retrieve a single content entry by ID

URL Parameters

  • Name
    content_id
    Required
    required
    Type
    integer
    Description

    ID of the content to retrieve

Error Codes

Status Description
404 The requested content could not be found.

Request

GET
/v2/reports/content/:content_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->reports()
  ->content(1)
  ->get();

Response

{
  "data": {
    "id": 1,
    "report": "consumer-duty",
    "section": "welcome",
    "content": "This is some example content",
    "tags": [
      {
        "key": "year",
        "value": "2024"
      },
      {
        "key": "month",
        "value": "10"
      },
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 12:00:00",
      "deleted_at": null,
    }
  }
}

PUT/v2/reports/content/:content_id

Update Content

Will attempt to update the content.

Only values provided in the request payload will be updated.

URL Parameters

  • Name
    content_id
    Required
    required
    Type
    integer
    Description

    ID of the content record to update

Payload

  • Name
    content
    Required
    Type
    string
    Description

    The new content of the report

  • Name
    tags
    Required
    Type
    array<string, string>
    Description

    An array of tags and values to attach to the content. All existing tags will be replaced. To remove all existing tags, provide an empty array. Not providing this tags key will keep all existing tags.

Error Codes

Status Description
404 The requested content could not be found.
422 The data provided in the payload was invalid. See errors for more details.

Request

PUT
/v2/reports/content/:content_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->reports()
  ->content(1)
  ->update([
    'content' => 'This is some new content',
    'tags' => [
      'year' => '2024',
      'month' => '10'
    ]
  ]);

Response

{
  "data": {
    "id": 1,
    "report": "consumer-duty",
    "section": "welcome",
    "content": "This is some new content",
    "tags": [
      {
        "key": "year",
        "value": "2024"
      },
      {
        "key": "month",
        "value": "10"
      },
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 12:00:00",
      "deleted_at": null,
    }
  }
}

DELETE/v2/reports/content/:content_id

Delete Content

Will attempt to delete the content. This endpoint will only affect non-deleted content.

The API will return a successful response if the content is already deleted, but won't update the deleted_at timestamp.

URL Parameters

  • Name
    content_id
    Required
    required
    Type
    integer
    Description

    ID of the content to delete

Error Codes

Status Description
404 The requested content could not be found.

Request

DELETE
/v2/reports/content/:content_id
use Compliance\Sdk\ApexV3\Contracts\ApexV3SdkInterface;
use Compliance\Sdk\Authentication\Types\Machine;

private ApexV3SdkInterface $sdk;

$response = $this->sdk
  ->v2(new Machine())
  ->reports()
  ->content(1)
  ->delete();

Response

{
  "data": {
    "id": 1,
    "report": "consumer-duty",
    "section": "welcome",
    "content": "This is some example content",
    "tags": [
      {
        "key": "year",
        "value": "2024"
      },
      {
        "key": "month",
        "value": "10"
      },
    ],
    "dates": {
      "created_at": "2024-01-01 00:00:00",
      "updated_at": "2024-01-02 12:00:00",
      "deleted_at": "2024-01-03 00:00:00",
    }
  }
}