---
canonical: https://amplience.com/developers/docs/apis/content-management-reference/snapshots-publishing/
title: "Snapshots and publishing jobs"
description: "API reference for snapshot and publishing job endpoints. Covers immutable content snapshots and publishing job management."
audience: Developer
date_published: 2023-08-29
date_modified: 2026-07-05
---

# Snapshots and publishing jobs

**Base URL:** `https://api.amplience.net/v2/content`

> **Note: Authorization and status codes**
> For authorization and status codes see the [API Reference overview](https://amplience.com/developers/docs/apis/content-management-reference/).

## Snapshots

| Method | Endpoint | Summary |
|--------|----------|---------|
| `GET` | `/hubs/{hubId}/snapshots` | [List snapshots](#list-snapshots) |
| `POST` | `/hubs/{hubId}/snapshots` | [Create snapshot](#create-snapshot) |
| `POST` | `/hubs/{hubId}/snapshots/batch` | [Create batch of snapshot](#create-batch-of-snapshot) |
| `GET` | `/hubs/{hubId}/snapshots/search` | [Search snapshots](#search-snapshots) |
| `GET` | `/snapshots/{snapshotId}` | [Get snapshot](#get-snapshot) |
| `GET` | `/snapshots/{snapshotId}/edition-links` | [Get snapshot edition links](#get-snapshot-edition-links) |
| `POST` | `/snapshots/{snapshotId}/edition-links` | [Create snapshot edition link](#create-snapshot-edition-link) |
| `DELETE` | `/snapshots/{snapshotId}/edition-links/{editionId}` | [Delete snapshot edition link](#delete-snapshot-edition-link) |
| `GET` | `/snapshots/{snapshotId}/publishing-jobs` | [List all publishing jobs for a snapshot](#list-all-publishing-jobs-for-a-snapshot) |
| `POST` | `/snapshots/{snapshotId}/publishing-jobs` | [Create publishing-job for snapshot](#create-publishing-job-for-snapshot) |
| `POST` | `/snapshots/search/facet` | [Snapshot facets](#snapshot-facets) |

### List snapshots

`GET /hubs/{hubId}/snapshots`

<small>`https://api.amplience.net/v2/content/hubs/{hubId}/snapshots`</small>

List all of the snapshots created for a hub. The list can be filtered by user or system created snapshots.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `hubId` | path | string | ✓ | Hub ID<br/>Example: `00112233445566778899aabb` |
| `page` | query | integer |  | Page number<br/>Example: `0` |
| `size` | query | integer |  | Page size<br/>Example: `20` |
| `sort` | query | string |  | Sort paramter<br/>Example: `createdDate,asc` |
| `type` | query | string (user, system, generated) |  | Type filter<br/>Example: `user` |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Paginated Snapshot List |

<details>
<summary>Response Example (200)</summary>

```json
{
  "_embedded": {
    "snapshots": [
      {
        "id": "00112233445566778899aabb",
        "comment": "This is a example snapshot.",
        "createdDate": "2019-01-01T00:00:00.000Z",
        "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
        "createdFrom": "content-item",
        "type": "USER",
        "meta": [
          {
            "key": "example-key",
            "value": "example value"
          }
        ],
        "taggedEdition": [
          {
            "editionId": "00112233445566778899aabb",
            "createdDate": "2019-01-01T00:00:00.000Z",
            "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
            "name": "Example Edition 1",
            "editionName": "Example Edition 1"
          }
        ],
        "locale": "en-US",
        "contentRoot": "00112233-4455-6677-8899-aabbccddeeff",
        "rootContentItem": {
          "label": "Banner Ad Homepage",
          "contentTypeUri": "Banner Ad Homepage",
          "id": "00112233-4455-6677-8899-aabbccddeeff"
        },
        "rootContentItems": [],
        "_links": {
          "self": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
          },
          "snapshot": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
          },
          "publishing-jobs": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs{?page,size,sort}",
            "templated": true
          },
          "create-publishing-job": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs"
          },
          "edition-links": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links"
          },
          "hub": {
            "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb"
          },
          "content-root": {
            "href": "https://api.amplience.net/v2/content/content-items/00112233445566778899aabb"
          },
          "snapshot-content-item": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/content-items{/id}",
            "templated": true
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb?page=0&size=20"
    },
    "first": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb?page=0&size=20"
    },
    "last": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb?page=0&size=20"
    },
    "search": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/search"
    }
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}
```

</details>

### Create snapshot

`POST /hubs/{hubId}/snapshots`

<small>`https://api.amplience.net/v2/content/hubs/{hubId}/snapshots`</small>

Create a new Snapshot for a particular Content-Item.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `hubId` | path | string | ✓ | Hub ID<br/>Example: `00112233445566778899aabb` |

**Request Body**

Content-Type: `application/json`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `comment` | string | ✓ | Comment |
| `createdFrom` | string (content-item, edition) | ✓ | Indicates if this Snapshot was created by an Edition or a Content-Item |
| `type` | string (USER, SYSTEM) | ✓ | Indicates the type of Snapshot (USER or SYSTEM) |
| `contentRoot` |  | ✓ | ID of the root Content-Item |

<details>
<summary>Request example</summary>

```json
{
  "comment": "This is a example snapshot.",
  "createdFrom": "content-item",
  "type": "USER",
  "contentRoot": "00112233-4455-6677-8899-aabbccddeeff"
}
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 201 | Paginated Snapshot List |

<details>
<summary>Response Example (201)</summary>

```json
{
  "id": "00112233445566778899aabb",
  "comment": "This is a example snapshot.",
  "createdDate": "2019-01-01T00:00:00.000Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "createdFrom": "content-item",
  "type": "USER",
  "meta": [
    {
      "key": "example-key",
      "value": "example value"
    }
  ],
  "taggedEdition": [
    {
      "editionId": "00112233445566778899aabb",
      "createdDate": "2019-01-01T00:00:00.000Z",
      "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
      "name": "Example Edition 1",
      "editionName": "Example Edition 1"
    }
  ],
  "locale": "en-US",
  "contentRoot": "00112233-4455-6677-8899-aabbccddeeff",
  "rootContentItem": {
    "label": "Banner Ad Homepage",
    "contentTypeUri": "Banner Ad Homepage",
    "id": "00112233-4455-6677-8899-aabbccddeeff"
  },
  "rootContentItems": [
    {
      "label": "Banner Ad Homepage",
      "contentTypeUri": "Banner Ad Homepage",
      "id": "00112233-4455-6677-8899-aabbccddeeff"
    }
  ],
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "snapshot": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "publishing-jobs": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs{?page,size,sort}",
      "templated": true
    },
    "create-publishing-job": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs"
    },
    "edition-links": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links"
    },
    "hub": {
      "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb"
    },
    "content-root": {
      "href": "https://api.amplience.net/v2/content/content-items/00112233445566778899aabb"
    },
    "snapshot-content-item": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/content-items{/id}",
      "templated": true
    }
  }
}
```

</details>

### Create batch of snapshot

`POST /hubs/{hubId}/snapshots/batch`

<small>`https://api.amplience.net/v2/content/hubs/{hubId}/snapshots/batch`</small>

Create new Snapshots for a batch of Content Items.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `hubId` | path | string | ✓ | Hub ID<br/>Example: `00112233445566778899aabb` |

**Request Body**

Content-Type: `application/json`

<details>
<summary>Request example</summary>

```json
[
  {
    "id": "00112233445566778899aabb",
    "comment": "This is a example snapshot.",
    "createdDate": "2019-01-01T00:00:00.000Z",
    "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
    "createdFrom": "content-item",
    "type": "USER",
    "meta": [
      {
        "key": "example-key",
        "value": "example value"
      }
    ],
    "taggedEdition": [
      {
        "editionId": "00112233445566778899aabb",
        "createdDate": "2019-01-01T00:00:00.000Z",
        "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
        "name": "Example Edition 1",
        "editionName": "Example Edition 1"
      }
    ],
    "locale": "en-US",
    "contentRoot": "00112233-4455-6677-8899-aabbccddeeff",
    "rootContentItem": {
      "label": "Banner Ad Homepage",
      "contentTypeUri": "Banner Ad Homepage",
      "id": "00112233-4455-6677-8899-aabbccddeeff"
    },
    "rootContentItems": [
      {
        "label": "Banner Ad Homepage",
        "contentTypeUri": "Banner Ad Homepage",
        "id": "00112233-4455-6677-8899-aabbccddeeff"
      }
    ]
  }
]
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 201 | Paginated Snapshot List |

<details>
<summary>Response Example (201)</summary>

```json
{
  "hubId": "00112233445566778899aabb",
  "snapshot": [
    {
      "id": "00112233445566778899aabb",
      "comment": "This is a example snapshot.",
      "createdDate": "2019-01-01T00:00:00.000Z",
      "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
      "createdFrom": "content-item",
      "type": "USER",
      "meta": [
        {
          "key": "example-key",
          "value": "example value"
        }
      ],
      "taggedEdition": [
        {
          "editionId": "00112233445566778899aabb",
          "createdDate": "2019-01-01T00:00:00.000Z",
          "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
          "name": "Example Edition 1",
          "editionName": "Example Edition 1"
        }
      ],
      "locale": "en-US",
      "contentRoot": "00112233-4455-6677-8899-aabbccddeeff",
      "rootContentItem": {
        "label": "Banner Ad Homepage",
        "contentTypeUri": "Banner Ad Homepage",
        "id": "00112233-4455-6677-8899-aabbccddeeff"
      },
      "rootContentItems": [
        {
          "label": "Banner Ad Homepage",
          "contentTypeUri": "Banner Ad Homepage",
          "id": "00112233-4455-6677-8899-aabbccddeeff"
        }
      ],
      "_links": {
        "self": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
        },
        "snapshot": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
        },
        "publishing-jobs": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs{?page,size,sort}",
          "templated": true
        },
        "create-publishing-job": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs"
        },
        "edition-links": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links"
        },
        "hub": {
          "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb"
        },
        "content-root": {
          "href": "https://api.amplience.net/v2/content/content-items/00112233445566778899aabb"
        },
        "snapshot-content-item": {
          "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/content-items{/id}",
          "templated": true
        }
      }
    }
  ],
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb/snapshots/batch"
    },
    "snapshots": {
      "href": "https://api.amplience.net/...",
      "templated": true
    },
    "hub": {
      "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb"
    }
  }
}
```

</details>

### Search snapshots

`GET /hubs/{hubId}/snapshots/search`

<small>`https://api.amplience.net/v2/content/hubs/{hubId}/snapshots/search`</small>

List all of the support search queries for a Snapshot

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `hubId` | path | string | ✓ | Hub ID<br/>Example: `00112233445566778899aabb` |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Snapshot Search Links |

<details>
<summary>Response Example (200)</summary>

```json
{
  "_links": {
    "facet": {
      "href": "https://api.amplience.net/...",
      "templated": true
    },
    "self": {
      "href": "https://api.amplience.net/..."
    }
  }
}
```

</details>

### Get snapshot

`GET /snapshots/{snapshotId}`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}`</small>

Return the snapshot with the specified ID.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `snapshotId` | path | string | ✓ | Snapshot ID<br/>Example: `00112233445566778899aabb` |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Snapshot Response |

<details>
<summary>Response Example (200)</summary>

```json
{
  "id": "00112233445566778899aabb",
  "comment": "This is a example snapshot.",
  "createdDate": "2019-01-01T00:00:00.000Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "createdFrom": "content-item",
  "type": "USER",
  "meta": [
    {
      "key": "example-key",
      "value": "example value"
    }
  ],
  "taggedEdition": [
    {
      "editionId": "00112233445566778899aabb",
      "createdDate": "2019-01-01T00:00:00.000Z",
      "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
      "name": "Example Edition 1",
      "editionName": "Example Edition 1"
    }
  ],
  "locale": "en-US",
  "contentRoot": "00112233-4455-6677-8899-aabbccddeeff",
  "rootContentItem": {
    "label": "Banner Ad Homepage",
    "contentTypeUri": "Banner Ad Homepage",
    "id": "00112233-4455-6677-8899-aabbccddeeff"
  },
  "rootContentItems": [
    {
      "label": "Banner Ad Homepage",
      "contentTypeUri": "Banner Ad Homepage",
      "id": "00112233-4455-6677-8899-aabbccddeeff"
    }
  ],
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "snapshot": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "publishing-jobs": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs{?page,size,sort}",
      "templated": true
    },
    "create-publishing-job": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/publishing-jobs"
    },
    "edition-links": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links"
    },
    "hub": {
      "href": "https://api.amplience.net/v2/content/hubs/00112233445566778899aabb"
    },
    "content-root": {
      "href": "https://api.amplience.net/v2/content/content-items/00112233445566778899aabb"
    },
    "snapshot-content-item": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/content-items{/id}",
      "templated": true
    }
  }
}
```

</details>

### Get snapshot edition links

`GET /snapshots/{snapshotId}/edition-links`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}/edition-links`</small>

Return a list of edition links for the specified snapshot. 
 Simply follow the HAL link with rel "snapshot-edition-links" from a snapshot response.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `snapshotId` | path | string | ✓ | Snapshot ID<br/>Example: `00112233445566778899aabb` |
| `page` | query | integer |  | Page number<br/>Example: `0` |
| `size` | query | integer |  | Page size<br/>Example: `20` |
| `sort` | query | string |  | Sort paramter<br/>Example: `createdDate,asc` |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Snapshot Edition Get Links Response |

<details>
<summary>Response Example (200)</summary>

```json
{
  "_embedded": {
    "edition-links": [
      {
        "editionId": "00112233445566778899aabb",
        "createdDate": "2019-01-01T00:00:00Z",
        "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
        "edition": "00112233445566778899aabb",
        "_links": {
          "edition": {
            "href": "https://api.amplience.net/v2/content/editions/00112233445566778899aabb"
          },
          "delete": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links/00112233445566778899aabb"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links?page=0&size=20"
    },
    "first": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links?page=0&size=20"
    },
    "last": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links?page=0&size=20"
    }
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}
```

</details>

### Create snapshot edition link

`POST /snapshots/{snapshotId}/edition-links`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}/edition-links`</small>

Create a link between the specified snapshot and edition.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `snapshotId` | path | string | ✓ | Snapshot ID<br/>Example: `00112233445566778899aabb` |

**Request Body**

Content-Type: `application/json`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `edition` | string | ✓ | Edition ID |

<details>
<summary>Request example</summary>

```json
{
  "edition": "00112233445566778899aabb"
}
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Snapshot Edition Link Create Response |

<details>
<summary>Response Example (200)</summary>

```json
{
  "editionId": "00112233445566778899aabb",
  "createdDate": "2019-01-01T00:00:00Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "edition": "00112233445566778899aabb",
  "_links": {
    "edition": {
      "href": "https://api.amplience.net/v2/content/editions/00112233445566778899aabb"
    },
    "delete": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb/edition-links/00112233445566778899aabb"
    }
  }
}
```

</details>

### Delete snapshot edition link

`DELETE /snapshots/{snapshotId}/edition-links/{editionId}`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}/edition-links/{editionId}`</small>

Delete a Snapshot Edition Link

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `editionId` | path | string | ✓ | Edition ID<br/>Example: `00112233445566778899aabb` |

**Responses**

| Status | Description |
|--------|-------------|
| 204 | Successfully removed the Snapshot Edition link |

### List all publishing jobs for a snapshot

`GET /snapshots/{snapshotId}/publishing-jobs`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}/publishing-jobs`</small>

Get a list of all Publishing Jobs for a Snapshot

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `snapshotId` | path | string | ✓ | Snapshot ID |
| `page` | query | integer |  | Page number<br/>Example: `0` |
| `size` | query | integer |  | Page size<br/>Example: `20` |
| `sort` | query | string |  | Sort paramter<br/>Example: `createdDate,asc` |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | List of all publishing jobs for a Snapshot Response |

<details>
<summary>Response Example (200)</summary>

```json
{
  "_embedded": {
    "publishing-jobs": [
      {
        "id": "00112233445566778899aabb",
        "scheduledDate": "2018-01-01T00:00:00Z",
        "createdDate": "2018-01-01T00:00:00Z",
        "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
        "state": "CREATED",
        "_links": {
          "self": {
            "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
          },
          "publishing-job": {
            "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
          },
          "snapshot": {
            "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
          },
          "cancel": {
            "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
          }
        }
      }
    ]
  },
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb?page=0&size=20"
    },
    "first": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb?page=0&size=20"
    },
    "last": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb?page=0&size=20"
    }
  },
  "page": {
    "size": 20,
    "totalElements": 1,
    "totalPages": 1,
    "number": 0
  }
}
```

</details>

### Create publishing-job for snapshot

`POST /snapshots/{snapshotId}/publishing-jobs`

<small>`https://api.amplience.net/v2/content/snapshots/{snapshotId}/publishing-jobs`</small>

Create a Publishing Job for a Snapshot

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `snapshotId` | path | string | ✓ | Snapshot ID<br/>Example: `00112233445566778899aabb` |

**Request Body**

Content-Type: `application/json`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `scheduledDate` | string | ✓ | Scheduled date and time for Publishing Job |

<details>
<summary>Request example</summary>

```json
{
  "scheduledDate": "2018-01-01T00:00:00Z"
}
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Successfully created a Publishing Job |

<details>
<summary>Response Example (200)</summary>

```json
{
  "id": "00112233445566778899aabb",
  "scheduledDate": "2018-01-01T00:00:00Z",
  "createdDate": "2018-01-01T00:00:00Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "state": "CREATED",
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "publishing-job": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "snapshot": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "cancel": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    }
  }
}
```

</details>

### Snapshot facets

`POST /snapshots/search/facet`

<small>`https://api.amplience.net/v2/content/snapshots/search/facet`</small>

Add a search facet to a snapshot.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `hubId` | query | string | ✓ | Hub ID<br/>Example: `00112233445566778899aabb` |
| `page` | query | integer |  | Page number<br/>Example: `0` |
| `size` | query | integer |  | Page size<br/>Example: `20` |
| `sort` | query | string |  | Sort<br/>Example: `createdDate,asc` |

**Request Body**

Content-Type: `application/json`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `fields` | array | ✓ | Fields to facet by |
| `returnEntities` | boolean | ✓ | Return entities in the response |

<details>
<summary>Request example: singleFacet</summary>

```json
{
  "fields": [
    {
      "facetAs": "ENUM",
      "field": "taggedEditions.editionId",
      "userFacingName": "editionId"
    }
  ],
  "returnEntities": false
}
```

</details>

<details>
<summary>Request example: basicDateRanges</summary>

```json
{
  "fields": [
    {
      "facetAs": "DATE",
      "name": "60 days +",
      "range": {
        "start": "-60:DAYS",
        "end": "-9999:YEARS"
      },
      "field": "createdDate",
      "userFacingName": "60 days +"
    },
    {
      "facetAs": "DATE",
      "name": "Last 60 days",
      "range": {
        "start": "-60:DAYS",
        "end": "NOW"
      },
      "field": "createdDate",
      "userFacingName": "Last 60 days"
    },
    {
      "facetAs": "DATE",
      "name": "Last 30 days",
      "range": {
        "start": "-30:DAYS",
        "end": "NOW"
      },
      "field": "createdDate",
      "userFacingName": "Last 30 days"
    },
    {
      "facetAs": "DATE",
      "name": "Last 14 days",
      "range": {
        "start": "-14:DAYS",
        "end": "NOW"
      },
      "field": "createdDate",
      "userFacingName": "Last 14 days"
    },
    {
      "facetAs": "DATE",
      "name": "Last 7 days",
      "range": {
        "start": "-7:DAYS",
        "end": "NOW"
      },
      "field": "createdDate",
      "userFacingName": "Last 7 days"
    }
  ],
  "returnEntities": false
}
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Paginated Snapshot List |

<details>
<summary>Response example (200): singleFacet</summary>

```json
{
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/search/facet?hubId=5d36b6cc46e0fb03cc4b27b4"
    }
  },
  "_facets": {
    "editionId": [
      {
        "_id": "5d36b6cc46e0fb03cc4b27b6",
        "count": 104
      },
      {
        "_id": "5d36b6cc46e0fb03cc4b27b8",
        "count": 52
      },
      {
        "_id": "5d36b6cc46e0fb03cc4b27b7",
        "count": 52
      }
    ]
  }
}
```

</details>

<details>
<summary>Response example (200): basicDateRanges</summary>

```json
{
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/snapshots/search/facet?hubId=5d36b6cb46e0fb03cc4b25f6"
    }
  },
  "_facets": {
    "Last 30 days": [
      {
        "_id": "-30:DAYS,NOW",
        "count": 15
      }
    ],
    "Last 14 days": [
      {
        "_id": "-14:DAYS,NOW",
        "count": 6
      }
    ],
    "Last 60 days": [
      {
        "_id": "-60:DAYS,NOW",
        "count": 27
      }
    ],
    "Last 7 days": [
      {
        "_id": "-7:DAYS,NOW",
        "count": 3
      }
    ],
    "60 days +": [
      {
        "_id": "-9999:YEARS,-60:DAYS",
        "count": 129
      }
    ]
  }
}
```

</details>

## Publishing jobs

| Method | Endpoint | Summary |
|--------|----------|---------|
| `GET` | `/publishing-jobs/{publishingJobId}` | [Get a publishing job](#get-a-publishing-job) |
| `PATCH` | `/publishing-jobs/{publishingJobId}` | [Cancelling a publishing job](#cancelling-a-publishing-job) |

### Get a publishing job

`GET /publishing-jobs/{publishingJobId}`

<small>`https://api.amplience.net/v2/content/publishing-jobs/{publishingJobId}`</small>

Get a Publishing Job

The `state` field tracks the job through its lifecycle. Possible values:

| State | Meaning |
|-------|---------|
| `CREATED` | Job has been created and is queued |
| `PREPARING` | Job is being prepared for publishing |
| `WAITING` | Job is waiting to start publishing |
| `PUBLISHING` | Publishing is in progress |
| `COMPLETED` | Publishing completed successfully |
| `FAILED` | Publishing failed |
| `CANCELLED` | Job was cancelled via `PATCH` |

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `publishingJobId` | path | string | ✓ | Publishing Job ID |

**Responses**

| Status | Description |
|--------|-------------|
| 200 | A Publishing Job response |

<details>
<summary>Response Example (200)</summary>

```json
{
  "id": "00112233445566778899aabb",
  "scheduledDate": "2018-01-01T00:00:00Z",
  "createdDate": "2018-01-01T00:00:00Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "state": "CREATED",
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "publishing-job": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "snapshot": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "cancel": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    }
  }
}
```

</details>

### Cancelling a publishing job

`PATCH /publishing-jobs/{publishingJobId}`

<small>`https://api.amplience.net/v2/content/publishing-jobs/{publishingJobId}`</small>

Cancel a Publishing Job by setting its state to `CANCELLED`. Only jobs in the `CREATED` or `PUBLISHING` state can be cancelled.

**Parameters**

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `publishingJobId` | path | string | ✓ | Publishing Job ID<br/>Example: `00112233445566778899aabb` |

**Request Body**

Content-Type: `application/json`

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `state` | string | ✓ | Assign state to "CANCELLED" |

<details>
<summary>Request example</summary>

```json
{
  "state": "CANCELLED"
}
```

</details>

**Responses**

| Status | Description |
|--------|-------------|
| 200 | Publishing Job cancelled successfully |

<details>
<summary>Response Example (200)</summary>

```json
{
  "id": "00112233445566778899aabb",
  "scheduledDate": "2018-01-01T00:00:00Z",
  "createdDate": "2018-01-01T00:00:00Z",
  "createdBy": "00112233-4455-6677-8899-aabbccddeeff",
  "state": "CANCELLED",
  "_links": {
    "self": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "publishing-job": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    },
    "snapshot": {
      "href": "https://api.amplience.net/v2/content/snapshots/00112233445566778899aabb"
    },
    "cancel": {
      "href": "https://api.amplience.net/v2/content/publishing-jobs/00112233445566778899aabb"
    }
  }
}
```

</details>
