9001: Create content

Add tagged content to the system. The content must be published using endpoint 9003: Publish content before it can be accessed.

 

New tagged content is generally appended to the system - existing data is pushed back, but may still appear in searches depending on search limits, activeTo/activeFrom dates etc.

However in certain circumstances it can be desirable to replace content. This can be done using the overrideData field, which provides a dictionary to be matched against existing content data. When a single content item matches all tags and all overrideData fields, that content will be removed before the new data is created. If no content is matched the new content is created as usual. And if more than one item is matched, a 400.1 error will be reported, and no content created.

Endpoint ID:

9001

Method:

URL:

/content/tagged

Request body:

JSON data with information about the content to be created.

Required fields:
 

tags

An array of Tags. At least one Tag must be present in the array. Tags must be url-safe, conforming to Regular Expression pattern:

[a-zA-Z]+[a-zA-Z0-9-_]*
Optional fields:
 

content

The content, formatted as a base64 encoded text string.

 contentTypeThe content mime-type, i.e. "image/gif" or "text/plain". If omitted, the content type is set to "text/html" if content is included, or "application/json" if data is included.
 data

A dictionary of strings or decimal values. These values can be used for search filtering.

String data values will only be compared with string filter values, and numeric data values will only be compared with numeric filter values. So ensure that numeric values are entered as numbers, i.e. 5.9 not "5.9".

Numeric values are not culture-specific. Use a period "." as decimal separator, and do not use thousand separators.

 titleA title string.
 activeFrom

A UTC date specifying the start of the content availability period.

 activeTo

A UTC date specifying the end of the content availability period.

 overrideDataA dictionary of strings or decimal values. When this field is present, any single tagged content item in the system with the same tags and matching all overrideData fields will be removed from the system and replaced with this content. Multiple matched content will result in a 400.1 error.
Example 1: Create HTML content. Existing content with tags ["t1","t2"] and data["uniqueKey"]=97531 will be replaced.
{
   "tags": [ "t1", "t2" ],
   "content": "PGh0bWw+PGJvZHk+TW9yZSBIVE1MIGNvbnRlbnQ8L2JvZHk+PC9odG1sPg==",
   "contentType": "text/html",
   "data": {
      "width": "300px",
      "height": "50px",
      "a": 5.5,
      "b": 15,
      "uniqueKey": 97531
   },
   "activeFrom": "2014-01-01T01:00Z",
   "activeTo": "2014-03-25T23:00Z",
   "overrideData": {
      "uniqueKey": 97531
   }
}
Example 2: Create a single pixel image
 {
   "tags": [ "tag1" ],
   "content": "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
   "contentType": "image/gif",
   "title": "clear1x1.gif"
}

Response body:


A JSON object containing the "contentID" of the newly created content. This identifier is used to publish content, and to connect entities to private content.

Example
{
   "contentID": 4567
}

Status codes:

201

Content created successfully.

 400.1

Override failed - multiple content items matched

Can only ever be returned in conjunction with overrideData

 

Â