Update a Filter Set¶
Change the information of an existing filter set.
Endpoint¶
PATCH https://api.crowdynews.com/collection/sets/{id}
Request Parameters¶
HEADER FIELD | VALUE DESCRIPTION |
---|---|
Content-Type | The content type of the request body, must be set to application/json . |
URL PARAMETER | VALUE DESCRIPTION |
---|---|
id | The resource ID of the set. The consumer that wants to update the set must have access to the contract said set belongs to, otherwise this action is forbidden. |
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 | Optional. Identifies the set in a human readable way and must be unique inside a contract. |
rules | Array | Optional. The filter rules that determine if a content item is rejected or accepted. Each element is a rule object. |
or | Boolean | Optional. Specifies if all rules must be evaluated before determining if a content item should be rejected or if we can stop processing the rules as soon the first rule evaluates to true , rejecting the content item. The first happens when the or property is set to true . |
preCondition | Object | Optional. A rule object that must evaluate to true before the filter rules will be evaluated. The entire set will be skipped when the precondition evaluates to false . |
active | Boolean | Optional. Specifies if this collection will be processed by the platform. |
REQUEST BODY DATA (RULE OBJECT) | VALUE TYPE | VALUE DESCRIPTION |
---|---|---|
operator | String | The kind of logic used by the rule. Supported operators are:
|
field | String | The content item property used by the rule to apply operator logic against. |
value | String or Number or Array | Optional. The value a rule uses to evaluate a content item. This may be an array of values when in or patternin are used as operators, alternatively a list can be used in combination with these operators, in which case a listId property must be specified instead of the value property. |
listId | String | Optional. The resource ID that specifies which list of values must be used by the rule. A list can only be used in combination with the in and patternin operators. The list must belong to the same contract that is referenced in the contractId property of the set and the consumer that wants to create this set must have access to said contract, otherwise this action is forbidden. |
not | Boolean | Flips the value the rule evaluates to. For example, when a rule evaluates to true and the not property is set to true , the rule will evaluate to false . |
Response Format¶
On success, the HTTP status code in the response header is
200 OK
and the response body will contain a set Object
in JSON format. On error, the header status code is an
error code
and the response body contains an error object.
Example Request¶
Request:
PATCH https://api.crowdynews.com/collection/sets/565d4de4056f859526d53389?access_token={your access token}
{
"rules": [
{
"operator": "equals",
"field": "user",
"value": "Justin Bieber",
"not": false
},
{
"operator": "datediff",
"field": "pusblished",
"value": 86400,
"not": false
}
]
}
Response:
HTTP/1.1 201
{
"_id": "565d4de4056f859526d53389",
"created": "2016-05-03T10:26:22.009Z",
"lastModified": "2016-05-03T10:26:22.009Z",
"lastModifiedBy": "John Doe",
"createdBy": "John Doe",
"contractId": "565c4df4056e859526e62257",
"name": "Twitter Blacklist",
"preCondition": {
"operator": "equals",
"field": "service",
"value": "twitter",
"not": false
},
"active": true,
"rules": [
{
"operator": "equals",
"field": "user",
"value": "Justin Bieber",
"not": false
},
{
"operator": "datediff",
"field": "pusblished",
"value": 86400,
"not": false
}
],
"or": false
}