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",
    "details": {
      "body": "<p>Something about VAT</p>\n"
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "redirects": [

    ],
    "publishing_app": "publisher",
    "rendering_app": "frontend",
    "need_ids": [
      "100123",
      "100124"
    ],
    "phase": "beta",
    "analytics_identifier": "GDS01",
    "document_type": "nonexistent-schema",
    "schema_name": "nonexistent-schema",
    "first_published_at": "2014-01-02T03:04:05Z",
    "base_path": "/vat-rates",
    "description": "VAT rates for goods and services",
    "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": "nonexistent-schema",
          "schema_name": "nonexistent-schema",
          "base_path": "/vat-rates",
          "description": "VAT rates for goods and services",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false,
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "locale": "en"
        }
      ]
    },
    "format": "nonexistent-schema",
    "navigation_document_supertype": "other",
    "user_journey_document_supertype": "thing",
    "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",
    "details": {
      "body": "<p>Something about VAT</p>\n"
    },
    "routes": [
      {
        "path": "/vat-rates",
        "type": "exact"
      }
    ],
    "redirects": [

    ],
    "publishing_app": "publisher",
    "rendering_app": "frontend",
    "need_ids": [
      "100123",
      "100124"
    ],
    "phase": "beta",
    "analytics_identifier": "GDS01",
    "document_type": "nonexistent-schema",
    "schema_name": "nonexistent-schema",
    "first_published_at": "2014-01-02T03:04:05Z",
    "base_path": "/vat-rates",
    "description": "VAT rates for goods and services",
    "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": "nonexistent-schema",
          "schema_name": "nonexistent-schema",
          "base_path": "/vat-rates",
          "description": "VAT rates for goods and services",
          "api_path": "/api/content/vat-rates",
          "withdrawn": false,
          "content_id": "582e1d3f-690e-4115-a948-e05b3c6b3d88",
          "locale": "en"
        }
      ]
    },
    "format": "nonexistent-schema",
    "navigation_document_supertype": "other",
    "user_journey_document_supertype": "thing",
    "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": "nonexistent-schema",
    "schema_name": "nonexistent-schema",
    "format": "nonexistent-schema",
    "need_ids": [
      "100123",
      "100124"
    ],
    "first_published_at": "2014-01-02T03:04:05.000+00:00",
    "public_updated_at": "2014-05-14T13:00:06.000+00:00",
    "publishing_app": "publisher",
    "redirects": [

    ],
    "rendering_app": "frontend",
    "locale": "en",
    "phase": "beta",
    "details": {
      "body": "<p>Something about VAT</p>\n"
    },
    "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": "nonexistent-schema",
          "locale": "en",
          "public_updated_at": "2014-05-14T13:00:06.000+00:00",
          "schema_name": "nonexistent-schema",
          "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": "nonexistent-schema",
    "schema_name": "nonexistent-schema",
    "format": "nonexistent-schema",
    "need_ids": [
      "100123",
      "100124"
    ],
    "first_published_at": "2014-01-02T03:04:05.000+00:00",
    "public_updated_at": "2014-05-14T13:00:06.000+00:00",
    "publishing_app": "publisher",
    "redirects": [

    ],
    "rendering_app": "frontend",
    "locale": "en",
    "phase": "beta",
    "details": {
      "body": "<p>Something about VAT</p>\n"
    },
    "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": "nonexistent-schema",
          "locale": "en",
          "public_updated_at": "2014-05-14T13:00:06.000+00:00",
          "schema_name": "nonexistent-schema",
          "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
}