# Content APIs (CMS)

# Content List and Filtering

Method: GET
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}
Description: List all contents of the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Parameter:

Key Description Required Example
data search by attribute name and value N data.name=name&data.age=1
fileFilter Specify the name of the attribute that is storing a private file's data to include the binary data of the file into the response body (it is excluded by default). See section "File Search". N fileFilter=image1&fileFilter=image2
exclude Query by exclude criteria with content that relate to N exclude=consent-acceptance.subject_id:coach
subCondition Query criteria in syntax via parameter N subCondition=data.shopNameTh:hellocafe OR data.shopNameEn:hellocafe
page The requested page number to display N page=0
size The page size of the result in response body N size=10
sort Sorting criteria. Default sort order is ascending. Multiple sort criteria are supported. N sort=data.name&sort=data.rating,desc
createdBy.<operator_name> search by createdBy that support operator only 'equals' N createdBy.equals=admin
createdDate.<operator_name>. search by createdDate that support operator 'greaterThan', 'greaterOrEqualThan', 'lessThan', 'lessOrEqualThan' and 'between' N createdDate.greaterThan='2020-04-16T02:15:11.455Z'
lastModifiedBy.<operator_name> search by lastModifiedBy that support operator only 'equals' N lastModifiedBy.equals=admin
lastModifiedDate.<operator_name> search by lastModifiedDate that support operator 'greaterThan', 'greaterOrEqualThan', 'lessThan', 'lessOrEqualThan' and 'between' N lastModifiedDate.greaterOrEqualThan='2020-04-16T02:15:11.455Z'

Operator_Name:

Operator Description Required Example
equals search by key and value N createdBy.equals=admin
greaterThan search date type that can search greater than date in value N createdDate.greaterThan='2020-04-16T02:15:11.455Z'
greaterOrEqualThan search date type that can search greater or equal than date in value N createdDate.greaterOrEqualsThan='2020-04-16T02:15:11.455Z'
lessThan search date type that can search less or equal than date in value N lastModifiedDate.lessThan='2020-04-16T02:15:11.455Z'
lessThanOrEqualThan search date type that can search less or equal than date in value N lastModifiedDate.lessOrEquallThan='2020-04-16T02:15:11.455Z'
between search date type that can search between start date and end date in value N createdDate.between='2020-04-16T00:00:00.000Z,2020-04-16T23:59:59.999Z'

Example Request:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner?data.name=top_banner' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "id": "124hh901023hs87sj37",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "7-11 Banner",
            "alias": "7-11-banner"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "top_banner"
        }
    }
]

This API doesn't return file content in the response body unless you specify the attribute that is storing the file content in the request param called fileFilter

Example Data:

"data": {
    "name": "top_banner",
    "image1": {
        "data": "BINARY",
        "contentType": "image/jpg",
        "type": "FILE"
    },
    "image2": {
        "data": "BINARY",
        "contentType": "image/jpg",
        "type": "FILE"
    }
}

Example Request:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner?data.name=top_banner&fileFilter=image1' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "id": "124hh901023hs87sj37",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "7-11 Banner",
            "alias": "7-11-banner"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "top_banner",
            "image1": {
                "data": "iVBORw0KGgoAAAANSUhEUgAAAC4AAAAcCAYAAAAeC42RAAAKv2lDQ1BJQ0MgUHJvZmlsZQAASImV...",
                "contentType": "image/jpg",
                "type": "FILE"
            },
            "image2": {
                "contentType": "image/jpg",
                "type": "FILE"
            }
        }
    }
]

# Search By Audit Fields

Example Data:

[
    {
        "createdBy": "66897977620",
        "createdDate": "2020-04-16T02:15:11.455Z",
        "lastModifiedBy": "66897977620",
        "lastModifiedDate": "2020-04-16T02:15:11.455Z",
        "createdByApp": null,
        "lastModifiedByApp": null,
        "id": "5e9e7b189877d80001d96a74",
        "contentType": {
            "id": "5e97bee0976af500012050db",
            "name": "7-11 Banner",
            "alias": "7-11 Banner",
            "searchEngine": null
        },
        "projectId": "5e956b904a70c90001bb48d1",
        "data": {
              "name": "top_banner"
        }
    },
    {
        "createdBy": "user",
        "createdDate": "2020-03-16T02:16:11.455Z",
        "lastModifiedBy": "user",
        "lastModifiedDate": "2020-03-16T02:16:11.455Z",
        "createdByApp": null,
        "lastModifiedByApp": null,
        "id": "5e97bf44976af500012050dc",
        "contentType": {
            "id": "5e97bee0976af500012050db",
            "name": "7-11 Banner",
            "alias": "7-11 Banner",
            "searchEngine": null
        },
        "projectId": "5e956b904a70c90001bb48d1",
        "data": {
            "name": "7-11_banner"
        }
    }
]

Example Request:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner?createdDate.greaterOrEqualThan='2020-04-16T02:15:11.455Z' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
            "createdBy": "user",
            "createdDate": "2020-04-16T02:15:11.455Z",
            "lastModifiedBy": "user",
            "lastModifiedDate": "2020-04-16T02:15:11.455Z",
            "id": "5e993fa72832085111321141",
            "contentType": {
              "id": "5e97bf2b283208318fd3e140",
              "name": "7-11 Banner",
              "alias": "7-11 Banner",
              "searchEngine": null
            },
            "projectId": "5e956b904a70c90001bb48d1",
            "data": {
              "name": "top_banner"
            }
            },
            {
               "createdBy": "user",
               "createdDate": "2020-03-16T02:16:11.455Z",
               "lastModifiedBy": "user",
               "lastModifiedDate": "2020-03-16T02:16:11.455Z",
               "createdByApp": null,
               "lastModifiedByApp": null,
               "id": "5e97bf44976af500012050dc",
               "contentType": {
                   "id": "5e97bee0976af500012050db",
                   "name": "7-11 Banner",
                   "alias": "7-11 Banner",
                   "searchEngine": null
               },
               "projectId": "5e956b904a70c90001bb48d1",
               "data": {
                   "name": "7-11_banner"
            }
]

Example Request to search multiple criteria:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner?createdDate.greaterOrEqualThan='2020-04-16T02:15:11.455Z'&createdDate.lessOrEqualThan='2020-04-16T02:15:12.455Z' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "createdBy": "user",
        "createdDate": "2020-04-16T02:15:11.455Z",
        "lastModifiedBy": "user",
        "lastModifiedDate": "2020-04-16T02:15:11.455Z",
        "id": "5e993fa72832085111321141",
        "contentType": {
          "id": "5e97bf2b283208318fd3e140",
          "name": "7-11 Banner",
          "alias": "7-11 Banner",
          "searchEngine": null
        },
        "projectId": "5e956b904a70c90001bb48d1",
        "data": {
          "name": "top_banner"
        }
    }
]

Parameter:

Key Description Required Example
data.<attribute_name>.latitude a latitude of origin point to search Y 13.689495
data.<attribute_name>.longitude a longitude of origin point to search Y 100.609009
data.<attribute_name>.radius a radius (in metres) from origin point to search Y 1000
data.<attribute_name>.showDistance a flag to show/hide distance in response N true/false
page The requested page number to display N 0
size The page size of the result in response body N 10

Example Request:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/shop?data.latitude=13.689495&data.longitude=100.609009&data.radius=1000&data.showDistance=true' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Data:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "id": "124hh901023hs87sj37",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "Shop",
            "alias": "shop"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "starbucks บางจาก"
            "location": {
                "longitude": "100.604825",
                "latitude": "13.696787",
                "type": "POINT_LOCATION"
            }
        }   
    },
    {
        "id": "124hh901023hs87sj38",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "Shop",
            "alias": "shop"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "starbucks อโศก"
                "location": {
                "longitude": "100.563829",
                "latitude": "13.749703",
                "type": "POINT_LOCATION"
            }
        }   
    },
    {
        "id": "124hh901023hs87sj39",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "Shop",
            "alias": "shop"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "starbucks สยาม"
                "location": {
                "longitude": "100.534112",
                "latitude": "13.745607",
                "type": "POINT_LOCATION"
            }
        }   
    }
]

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "id": "124hh901023hs87sj37",
        "contentType": {
            "id": "ds98sd7gdl2337sk19",
            "name": "Shop",
            "alias": "shop"
        },
        "projectId": "12791v1a6104ka02",
        "data": {
            "name": "starbucks บางจาก"
            "location": {
                "longitude": "100.604825",
                "latitude": "13.696787",
                "type": "POINT_LOCATION",
                "distance": 929.3553562483169
            }
        }   
    }
]

# Search by Sub-condition

Parameter:

Key Description Required Example
subCondition Query criteria in syntax via parameter N data.shopNameTh:hellocafe OR data.shopNameEn:hellocafe

Logic Supported:

Operator Description Required Example
OR 'or' logic Y data.province:.*กรุงเทพ.* OR data.province:.*นนทบุรี.*

Operator Keyword:

Operator Description Required Example
: Equal N data.province:กรุงเทพ
> Greater than N data.age>25
< Less than N data.salary<15000
>: Greater than or equal N data.price>:50
<: Less than or equal N data.price<:100

Escape character for value:

Character Escape character
(Need remove blank space)
Original value Replace Escape Value
' '
(Blank space)
&#32 ; data.country:Unites states data.country:United&#32 ;states
: &#58 ; data.movie:xXx:chapter2 data.movie:xXx&#58 ;chapter2
> &#62 ; data.symbol:gt=> data.symbol:gt=&#62 ;
< &#60 ; data.symbol:gt=< data.symbol:gt=&#60 ;

Example Request:

curl -X GET \
  'https://dev-platform.weomni-test.com/cms/api/projects/5d42a4b6f085380001da6a63/c/test-content?subCondition=data.nameTh:.*Rice%26%2332;topped.* OR data.nameEn:.*Rice%26%2332;topped.*&subCondition=data.price>:45 OR data.price<:50&data.province=Bangkok' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

URL Decoded & Readable:

https://dev-platform.weomni-test.com/cms/api/projects/5d42a4b6f085380001da6a63/c/test-content?
    subCondition=data.nameTh:.*Rice&#32;topped.* OR data.nameEn:.*Rice&#32;topped.*
    &subCondition=data.price>:45 OR data.price<:50
    &data.province=Bangkok

Example Data:

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "id": "5ffc107743a28d00012ced0a",
        "contentType": {
            "id": "5ffc102143a28d00012ced09",
            "name": "test-content",
            "alias": "test-content",
            "searchEngine": null,
            "webhook": false
        },
        "projectId": "5d42a4b6f085380001da6a63",
        "data": {
            "nameTh": "ข้าวคะน้าหมูกรอบ",
            "nameEn": "Rice topped with Stir fry Kai Land and crispy pork",
            "province": "Samut Prakan",
            "price": 50.0,
            "order": 3.0
        }
    },
    {
        "id": "5ffc109d43a28d00012ced0b",
        "contentType": {
            "id": "5ffc102143a28d00012ced09",
            "name": "test-content",
            "alias": "test-content",
            "searchEngine": null,
            "webhook": false
        },
        "projectId": "5d42a4b6f085380001da6a63",
        "data": {
            "nameTh": "ข้าวกระเพราหมูสับ",
            "nameEn": "Rice topped with stir-fried pork and basil",
            "province": "Bangkok",
            "price": 45.0,
            "order": 22.0
        }
    },
    {
        "id": "5ffc1169c32a420001acd14e",
        "contentType": {
            "id": "5ffc102143a28d00012ced09",
            "name": "test-content",
            "alias": "test-content",
            "searchEngine": null,
            "webhook": false
        },
        "projectId": "5d42a4b6f085380001da6a63",
        "data": {
            "nameTh": "สเต็กหมู",
            "nameEn": "pork Steak",
            "province": "Bangkok",
            "price": 140.0,
            "order": 3.0
        }
    }
]

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
    {
        "id": "5ffc109d43a28d00012ced0b",
        "contentType": {
            "id": "5ffc102143a28d00012ced09",
            "name": "test-content",
            "alias": "test-content",
            "searchEngine": null,
            "webhook": false
        },
        "projectId": "5d42a4b6f085380001da6a63",
        "data": {
            "nameTh": "ข้าวกระเพราหมูสับ",
            "nameEn": "Rice topped with stir-fried pork and basil",
            "province": "Bangkok",
            "price": 45.0,
            "order": 22.0
        }
    }
]

Limitation:

  • Aggregate function is not supported
  • Location search more than one location is not supported

Known Issues

  1. Sometime the returned result contains contents from another content type (Jira (opens new window))

It should contains only the contents of the requested content type. We are working on it.

Method: GET
Path: /cms/api/projects/{projId}/search/{contentTypeAlias}
Description: To search with free text

Client Scope: cms.ct.s
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Parameter:

Key Description Required Example
q The text to search Y q=monitor

Example Request:

curl -X GET \
  'http://platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/search/7-11-banner?q=top_banner' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
[
  {
    "score": 0.2876821,
    "id": "5e8ff1dac473af00019a0f91",
    "contentType": null,
    "projectId": null,
    "data": {
      "name": "top_banner"
    }
  }
]

# Get Content

Method: GET
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/{contentId}
Description: Get a content of the specified content type by content ID

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Example Request:

curl -X GET \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Example Response:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "1",
    "data": {
        "name": "top_banner"
    }
}

# Create Content

Method: POST
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}
Description: Create a content under the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
data The attributes and values of the content Object Y

Request Body Example:

"data":{
   "name":"content1",
   "description": "description1"
}

Request Example:

curl -X POST \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '{
  "data": {
    "name": "top_banner",
    "description": "top banner"
  }

Response Example:

HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "1",
    "data": {
        "name": "top_banner",
        "description": "top banner"
    }
}

# Update Content

Method: PUT
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/{contentId}
Description: Update a content of the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
data The attributes and desired values of the content. The value of any missing attribute will be replaced by null Object Y

Request Example:

Existing Data:

"data": {
    "name": "bottom_banner",
    "description": "bottom banner"
}

Request:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '{
  "data": {
    "name": "bottom_banner_medium",
    "description": "bottom banner medium size"
  }

Response Example:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "1",
    "data": {
        "name": "bottom_banner_medium",
        "description": "bottom banner medium size"
    }
}

# Patch Content

Method: PATCH
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/{id}
Description: This API for patch update specific field of content

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
data The attributes and values of the content Object Y

Example:

"data":{
   "name":"new_name"
}

Example Data:

{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "12791v1a6104ka02",
    "data": {
        "name": "top_banner",
         "file":{
            "data":"BINARY",
            "contentType":"image/jpg",
            "type":"FILE"
         },
         "location" : {
            "latitude" : "120.12",
            "longitude" : "24.14",
            "type" : "POINT_LOCATION"
         }
    }
}

Request Example:

curl -X PATCH \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '{
  "data": {
    "name": "new_name"
  }

Response Example:

HTTP/1.1 200 SUCCESS
Content-Type: application/json
{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "12791v1a6104ka02",
    "data": {
        "name": "new_name",
         "file":{
            "data":"BINARY",
            "contentType":"image/jpg",
            "type":"FILE"
         },
         "location" : {
            "latitude" : "120.12",
            "longitude" : "24.14",
            "type" : "POINT_LOCATION"
         }
    }
}

# Delete Content

Method: DELETE
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/{contentId}
Description: Delete a content of the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Example:

curl -X DELETE \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'

Response Example:

HTTP/1.1 200 OK

# Attribute Increment

Method: POST Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/{contentId}/increment
Description: Increase or decrease the value of an attribute. Only support attribute of type DECIMAL and the value is number.

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
attribute The name of the attribute to do increment String Y
amount The amount to do increment. If it is positive, then attribute will be increased by this value. On the other hand, if it is negative the attribute will be decreased by this value. Number T

Example:

{
   "attribute":"remaining_items",
   "amount": -1
}

Example of amount value:

  • 1 (positive integer)
  • -1 (negative integer)
  • 0.5 (positive decimal)
  • -0.5 (negative decimal)

Request Example:

Existing data:

{
    "name": "bottom_banner_medium",
    "description": "bottom banner medium size"
    "views": 0
}

Request:

curl -X POST \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37/increment' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '{
     "attribute":"views",
     "amount": 1
   }

Response Example:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "id": "124hh901023hs87sj37",
    "contentType": {
        "id": "ds98sd7gdl2337sk19",
        "name": "7-11 Banner",
        "alias": "7-11-banner"
    },
    "projectId": "12791v1a6104ka02",
    "data": {
        "name": "bottom_banner_medium",
        "description": "bottom banner medium size",
        "views": 1
    }
}

# Create Bulk Contents

Method: POST
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/bulk
Description: Create bulk contents under the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
data The attributes and values of the content Object Y

Request Body Example:

[
	{
	  "data": {
	        "name": "content_1"
	    }
	},
	{
	    "data": {
	        "name": "content_2"
	    }
	},
	{
	    "data": {
	        "name": "content_3"
	    }
	}
]

Request Success Example:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/5eb4d72cf7a73b000184ceb7/c/7-11-banner/bulk' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
      	{
      	    "data": {
      	        "name": "content_1"
      	    }
      	},
      	{
      	    "data": {
      	        "name": "content_2"
      	    }
      	},
      	{
      	    "data": {
      	        "name": "content_3"
      	    }
      	}
      ]'

Response Success Example:

HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "total": 3,
    "success": 3,
    "failure": 0,
    "failedItems": []
}

Request Failure Example:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/5eb4d72cf7a73b000184ceb7/c/7-11-banner/bulk' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
      	{
      	    "data": {
      	        "name": "content_1"
      	    }
      	},
      	{
      	    "data": {
      	        "name_invalid": "content_2"
      	    }
      	},
      	{
      	    "data": {
      	        "name": "content_3"
      	    }
      	}
      ]'

Response Failure Example:

HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "total": 3,
    "success": 2,
    "failure": 1,
    "failedItems": [
        {
            "projectId": "5eb4d72cf7a73b000184ceb7",
            "data": {
                "name_invalid": "content_2"
            },
            "error": {
                "errorKey": "error.validation",
                "entityName": "7-11-banner",
                "message": "Unsupported attribute"
            }
        }
    ]
}

Bulk can create 20 contents per request.

# Update Bulk Contents

Method: PUT
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/bulk
Description: Update bulk contents of the specified content type

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
id Id of the content String Y
data The attributes and values of the content Object Y

Existing Data:

[
	{
	    "id": "5ec6366a3e72db0001e1cb1b",
	    "data": {
	        "name": "content_1"
	    }
	},
	{
	    "id": "5ec6366a3e72db0001e1cb1c",
	    "data": {
	        "name": "content_2"
	    }
	},
	{
	    "id": "5ec6366a3e72db0001e1cb1d",
	    "data": {
	        "name": "content_3"
	    }
	}
]

Request Body Example:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/5eb4d72cf7a73b000184ceb7/c/7-11-banner/bulk' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
      	{
      	    "id": "5ec6366a3e72db0001e1cb1b",
      	    "data": {
      	        "name": "update_content_1"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1c",
      	    "data": {
      	        "name": "update_content_2"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1d",
      	    "data": {
      	        "name": "update_content_3"
      	    }
      	}
      ]'

Response Example:

HTTP/1.1 200 OK
Content-Type: application/json
{
    "total": 3,
    "success": 3,
    "failure": 0,
    "failedItems": []
}

Request Failure Example:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/5eb4d72cf7a73b000184ceb7/c/7-11-banner/bulk' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
        {
      	    "id": "5ec6366a3e72db0001e1cb1b",
      	    "data": {
      	        "name": "update_content_1"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1c",
      	    "data": {
      	        "name_invalid": "update_content_2"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1d",
      	    "data": {
      	        "name": "update_content_3"
      	    }
      	}
      ]'

Response Failure Example:

HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "total": 3,
    "success": 2,
    "failure": 1,
    "failedItems": [
        {
            "projectId": "5ec6366a3e72db0001e1cb1c",
            "data": {
      	        "name_invalid": "update_content_2"
            },
            "error": {
                "errorKey": "error.validation",
                "entityName": "7-11-banner",
                "message": "Unsupported attribute"
            }
        }
    ]
}

Bulk can update 20 contents per request.

# Patch Bulk Content

Method: PATCH
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/bulk
Description: This API for patch bulk update specific field of content

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}
Content-Type The MIME type of this content Y application/json

Request Body:

Param Description Type Required
id Id of the content String Y
data The attributes and values of the content Object Y

Existing Data:

[
	{
	    "id": "5ec6366a3e72db0001e1cb1b",
	    "data": {
	        "name": "content_1"
	    }
	},
	{
	    "id": "5ec6366a3e72db0001e1cb1c",
	    "data": {
	        "name": "content_2"
	    }
	},
	{
	    "id": "5ec6366a3e72db0001e1cb1d",
	    "data": {
	        "name": "content_3"
	    }
	}
]

Request Example:

curl -X PATCH \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/124hh901023hs87sj37' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
      	{
      	    "id": "5ec6366a3e72db0001e1cb1b",
      	    "data": {
      	        "name": "patch_content_1"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1c",
      	    "data": {
      	        "name": "patch_content_2"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1d",
      	    "data": {
      	        "name": "patch_content_3"
      	    }
      	}
      ]'

Response Example:

HTTP/1.1 200 SUCCESS
Content-Type: application/json
{
    "total": 3,
    "success": 3,
    "failure": 0,
    "failedItems": []
}

Request Failure Example:

curl -X PUT \
  'http://dev-platform.weomni-test.com/cms/api/projects/5eb4d72cf7a73b000184ceb7/c/7-11-banner/bulk' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
        {
      	    "id": "5ec6366a3e72db0001e1cb1b",
      	    "data": {
      	        "name": "patch_content_1"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1c",
      	    "data": {
      	        "name_invalid": "patch_content_2"
      	    }
      	},
      	{
      	    "id": "5ec6366a3e72db0001e1cb1d",
      	    "data": {
      	        "name": "patch_content_3"
      	    }
      	}
      ]'

Response Failure Example:

HTTP/1.1 201 CREATED
Content-Type: application/json
{
    "total": 3,
    "success": 2,
    "failure": 1,
    "failedItems": [
        {
            "projectId": "5ec6366a3e72db0001e1cb1c",
            "data": {
      	        "name_invalid": "patch_content_2"
            },
            "error": {
                "errorKey": "error.validation",
                "entityName": "7-11-banner",
                "message": "Unsupported attribute"
            }
        }
    ]
}

Bulk can patch 20 contents per request.

# Sync Content to Search Engine

Method: POST
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/sync-search-engine
Description: Sync contents of the specified content type to search engine (search engine must be enabled)

Client Scope: -
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}

Request Parameter:

Parameter Description Required Example
size The maximum number of contents to be processed N size=1000
data.<attribute_name> The value of attribute in contents N data.title=TV
createdBy.equals The user who created the contents N createdBy.equals=0987654321
createdDate.<operator_name> The date time which contents created with operators: 'equals','greaterThan', 'greaterOrEqualThan', 'lessThan', 'lessOrEqualThan' and 'between' N createdDate.equals=2020-05-22T09:42:38.990Z
lastModifiedBy.equals The user who last modified the contents N lastModifiedBy.equals=0987654321
lastModifiedDate.<operator_name> The date time which contents last modified with operators: 'equals','greaterThan', 'greaterOrEqualThan', 'lessThan', 'lessOrEqualThan' and 'between' N lastModifiedDate.equals=2020-05-22T09:42:38.990Z

Request:

curl -X POST \
  'http://dev-platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/sync-search-engine' \
  -H 'Authorization: Bearer {O2O Access Token}'

Response Example:

HTTP/1.1 202 ACCEPTED

# Clear Cache for List Result

Method: POST
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/clear-list-cache
Description: Clear cache for list result in the content type

Client Scope: cms.clear-cache
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}

Request:

curl -X POST \
  'http://platform.weomni-test.com/cms/api/projects/12791v1a6104ka02/c/7-11-banner/clear-list-cache' \
  -H 'Authorization: Bearer {O2O Access Token}'

Response Example:

HTTP/1.1 200 OK

# Clear Cache for Multiple Content Details

Method: POST
Path: /cms/api/projects/{projId}/c/{contentTypeAlias}/clear-content-cache
Description: Clear cache for content details

Client Scope: cms.clear-cache
Authority: -

Request Header:

Param Description Required Example
Authorization The OAuth2 authentication with the O2O System Y Bearer {O2O Access Token}

Request:

curl -X POST \
  'http://platform.weomni-test.com/cms/api/projects/5d5299f56816c000012a1dcd/c/7-11-banner/clear-content-cache' \
  -H 'Authorization: Bearer {O2O Access Token}'
  -d '[
        "5d5299f56816c000012a1dcd",
        "5d5299f56816c000012a1dca"
      ]'

Response Example:

HTTP/1.1 200 OK

Last Updated: 3/2/2021, 9:37:10 AM