Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Excerpt

Create contentAdd 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.

 Example

JSON data with information about the transaction. Most of the values must be agreed upon in advance with Express, and will be documented in the contract between dialogportal™ and the application.

 

Endpoint ID:

9001

Method:

URL:

POST /user/content/

  

tagged

Request body:

title
Required fields:
 

tags:

 
 

content:

 

Optional fields:
 contenttype: 
 reference:

 

 value:

 

 activeFrom:

 

 activeTo: 

 

 

Code Block

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.

Note

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.
Code Block
titleExample 1: Create HTML content. Existing content with tags \["t1","t2"\] and data\["uniqueKey"\]=97531 will be replaced.
{
   "tags": [ "tag1t1", "tag2t2" ],
                // required - at least one tag must be present.
                                               //    Tags must be url-safe, with this RegEx:
                                               //    [a-zA-Z]+[a-zA-Z0-9-_]*"content": "PGh0bWw+PGJvZHk+TW9yZSBIVE1MIGNvbnRlbnQ8L2JvZHk+PC9odG1sPg==",
   "contentType": "text/html",
   "data": {
           // optional - defaults to "text/html""width": "300px",
      "contentheight": "base64 encoded content string50px",
 // required    "valuea": 65.85,
      "b": 15,
      "uniqueKey": 97531
   },
          // optional - decimal"activeFrom": "2014-01-01T01:00Z",
   "activeFromactiveTo": "2014-0103-01T0125T23:00Z",
   "overrideData": {
       // optional - ISO UTC date"uniqueKey": 97531
   }
}
Code Block
titleExample 2: Create a single pixel image
 {
   "activeTotags": [ "2014-03-25T23:00Ztag1" ],
   "content": "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==",
      // optional - ISO UTC date
}

 

 

 

 

 

Response body:

Response body on success
"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.

Code Block
titleExample
{
   "contentID": 4567
}

Status codes:

201

Content created successfully.

   400.1

Override failed - multiple content items matched

Note

Can only ever be returned in conjunction with overrideData