Create a Filter List¶
Create a filter list to let filter rules use multiple values to evaluate content items.
Endpoint¶
POST https://api.crowdynews.com/collection/lists
Request Parameters¶
HEADER FIELD | VALUE DESCRIPTION |
---|---|
Content-Type | The content type of the request body, must be set to application/json . |
QUERY PARAMETER | VALUE DESCRIPTION |
---|---|
access_token | A valid OAuth access token with the correct permission(s). |
REQUEST BODY DATA | VALUE TYPE | VALUE DESCRIPTION |
---|---|---|
name | String | Identifies the list in a human readable way and must be unique inside a contract. This name can be changed after creation. |
contractId | String | The resource ID that specifies to which contract this list belongs. The consumer that wants to create the list must have access to the provided contract, otherwise this action is forbidden. |
type | String | The list type. Either strings or patterns . |
entries | Array | Contains rule values. Depending on the list type, the entries are either plain strings or string patterns. |
active | Boolean | Optional. Specifies if this list will be processed by the platform. This property defaults to true when omitted. |
Response Format¶
On success, the HTTP status code in the response header is
201 Created
and the response body will contain a list
object in JSON format. On error, the header status code is
an error code
and the response body contains an error object.
Example Requests¶
1. Create a List with String Entries¶
Request:
POST https://api.crowdynews.com/collection/lists?access_token={your access token}
{
"name": "My Profanity List",
"contractId": "565c4df4056e859526e62257"
"type": "strings",
"entries": [
"shit",
"fuck"
]
}
Response:
HTTP/1.1 201
{
"_id": "565d4de40d6f659557f64355",
"created": "2016-03-22T15:01:49.081Z",
"createdBy": "John Doe",
"lastModified": "2016-03-22T15:01:49.081Z",
"lastModifiedBy": "John Doe",
"active": true,
"contractId": "565c4df4056e859526e62257",
"name": "My Profanity List",
"type": "strings",
"entries": [
"shit",
"fuck"
]
}
2. Create a List with Pattern Entries¶
Request:
POST https://api.crowdynews.com/collection/lists?access_token={your access token}
{
"name": "My Profanity Pattern List",
"contractId": "565c4df4056e859526e62257"
"type": "patterns",
"entries": [
"/shi+t*/i",
"/fu+ck*/i"
]
}
Response:
HTTP/1.1 201
{
"_id": "565d4de40d6f659557f64356",
"created": "2016-03-22T15:01:49.081Z",
"createdBy": "John Doe",
"lastModified": "2016-03-22T15:01:49.081Z",
"lastModifiedBy": "John Doe",
"active": true,
"contractId": "565c4df4056e859526e62257",
"name": "My Profanity Pattern List",
"type": "patterns",
"entries": [
"/shi+t*/i",
"/fu+ck*/i"
]
}