A pact between Publishing API and Content Store

Requests from Publishing API to Content Store

Interactions

Given a content item exists with base_path /vat-rates and payload_version 0, upon receiving a request to create a content item from Publishing API, with

{
  "method": "put",
  "path": "/content/vat-rates",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "title": "VAT rates",
    "public_updated_at": "2014-05-14T13:00:06Z",
    "publishing_app": "publisher",
    "rendering_app": "frontend",
    "phase": "beta",
    "analytics_identifier": "GDS01",
    "document_type": "services_and_information",
    "schema_name": "generic",
    "first_published_at": "2014-01-02T03:04:05Z",
    "base_path": "/vat-rates",
    "description": "VAT rates for goods and services",
    "details": {
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "redirects": [

    ],
    "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
    "locale": "en",
    "expanded_links": {
      "available_translations": [
        {
          "title": "VAT rates",
          "public_updated_at": "2014-05-14T13:00:06Z",
          "analytics_identifier": "GDS01",
          "document_type": "services_and_information",
          "schema_name": "generic",
          "base_path": "/vat-rates",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false,
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "locale": "en"
        }
      ]
    },
    "user_journey_document_supertype": "finding",
    "email_document_supertype": "other",
    "government_document_supertype": "other",
    "content_purpose_subgroup": "other",
    "content_purpose_supergroup": "other",
    "payload_version": 5
  }
}

Content Store will respond with:

{
  "status": 200,
  "headers": {
    "Content-Type": "application/json; charset=utf-8"
  }
}

Given a content item exists with base_path /vat-rates and payload_version 10, upon receiving a request to create a content item from Publishing API, with

{
  "method": "put",
  "path": "/content/vat-rates",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "title": "VAT rates",
    "public_updated_at": "2014-05-14T13:00:06Z",
    "publishing_app": "publisher",
    "rendering_app": "frontend",
    "phase": "beta",
    "analytics_identifier": "GDS01",
    "document_type": "services_and_information",
    "schema_name": "generic",
    "first_published_at": "2014-01-02T03:04:05Z",
    "base_path": "/vat-rates",
    "description": "VAT rates for goods and services",
    "details": {
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "redirects": [

    ],
    "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
    "locale": "en",
    "expanded_links": {
      "available_translations": [
        {
          "title": "VAT rates",
          "public_updated_at": "2014-05-14T13:00:06Z",
          "analytics_identifier": "GDS01",
          "document_type": "services_and_information",
          "schema_name": "generic",
          "base_path": "/vat-rates",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false,
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "locale": "en"
        }
      ]
    },
    "user_journey_document_supertype": "finding",
    "email_document_supertype": "other",
    "government_document_supertype": "other",
    "content_purpose_subgroup": "other",
    "content_purpose_supergroup": "other",
    "payload_version": 5
  }
}

Content Store will respond with:

{
  "status": 409,
  "headers": {
    "Content-Type": "application/json; charset=utf-8"
  }
}

Given a content item exists with base_path /vat-rates and payload_version 0, upon receiving a request to create a content item originating from v1 endpoint from Publishing API, with

{
  "method": "put",
  "path": "/content/vat-rates",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "analytics_identifier": "GDS01",
    "base_path": "/vat-rates",
    "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
    "description": "VAT rates for goods and services",
    "document_type": "services_and_information",
    "schema_name": "generic",
    "first_published_at": "2014-01-02T03:04:05.000Z",
    "public_updated_at": "2014-05-14T13:00:06.000Z",
    "publishing_app": "publisher",
    "redirects": [

    ],
    "rendering_app": "frontend",
    "locale": "en",
    "phase": "beta",
    "details": {
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "title": "VAT rates",
    "expanded_links": {
      "available_translations": [
        {
          "analytics_identifier": "GDS01",
          "base_path": "/vat-rates",
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "description": "VAT rates for goods and services",
          "document_type": "services_and_information",
          "locale": "en",
          "public_updated_at": "2014-05-14T13:00:06.000Z",
          "schema_name": "generic",
          "title": "VAT rates",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false
        }
      ]
    },
    "payload_version": 5
  }
}

Content Store will respond with:

{
  "status": 200,
  "headers": {
    "Content-Type": "application/json; charset=utf-8"
  }
}

Given a content item exists with base_path /vat-rates and payload_version 10, upon receiving a request to create a content item originating from v1 endpoint from Publishing API, with

{
  "method": "put",
  "path": "/content/vat-rates",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "analytics_identifier": "GDS01",
    "base_path": "/vat-rates",
    "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
    "description": "VAT rates for goods and services",
    "document_type": "services_and_information",
    "schema_name": "generic",
    "first_published_at": "2014-01-02T03:04:05.000Z",
    "public_updated_at": "2014-05-14T13:00:06.000Z",
    "publishing_app": "publisher",
    "redirects": [

    ],
    "rendering_app": "frontend",
    "locale": "en",
    "phase": "beta",
    "details": {
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "title": "VAT rates",
    "expanded_links": {
      "available_translations": [
        {
          "analytics_identifier": "GDS01",
          "base_path": "/vat-rates",
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "description": "VAT rates for goods and services",
          "document_type": "services_and_information",
          "locale": "en",
          "public_updated_at": "2014-05-14T13:00:06.000Z",
          "schema_name": "generic",
          "title": "VAT rates",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false
        }
      ]
    },
    "payload_version": 5
  }
}

Content Store will respond with:

{
  "status": 409,
  "headers": {
    "Content-Type": "application/json; charset=utf-8"
  }
}

Given a content item exists with base_path /vat-rates, upon receiving a request to delete the content item from Publishing API, with

{
  "method": "delete",
  "path": "/content/vat-rates"
}

Content Store will respond with:

{
  "status": 200
}

Given no content item exists with base_path /vat-rates, upon receiving a request to delete the content item from Publishing API, with

{
  "method": "delete",
  "path": "/content/vat-rates"
}

Content Store will respond with:

{
  "status": 404
}