API - FlexOffer Filter

Dexcription
These APIs are used to perform CRUD operations on the FlexOffer filters.
Get FlexOffer filters
GET /channels/{icIdOrName}offermappings/{offerMappingIdOrName}/filters?page=2&size=2&sort=Name,DESC&sort=CreateDate,ASC&condition=<condition1>
Output
Table 1. Response Codes
Success 200 Ok
Error 400 Bad Request
Server Error 500 Internal Server Error
Example: Content-Type: application/json
{
    "content": [
        {
            "filterID": 21,
            "name": "abc",
            "description": "abc",
            "isDefault": true,
            "createDate": 1577975850230,
            "createBy": 2,
            "updateDate": 1577975850230,
            "updateBy": 2
        }, 
			{…}
	], 
"page": {
        "pageNumber": 0,
        "totalElements": 13,
        "totalPages": 2,
        "size": 10,
        "hasNext": true,
        "hasPrev": false
}
}
Note: This output does not include conditions of these filters.
Get FlexOffer Filter by ID or Name
GET /{icIdOrName}offermappings/{offerMappingIdOrName}/filters/{filterIdOrName}
Output
Table 2. Response Codes
Success 200 Ok
Error 400 Bad Request
Server Error 500 Internal Server Error

Example: Content-Type: application/json

{
    "filterID": 7,
    "name": "abc",
    "description": "abc",
    "conditions": [
        {
            "name": "userdefinedfield",
            "type": "STRING",
            "value": "MyTest",
            "relation": "EQUAL"
        },
	{…}
    ],
    "isDefault": true,
    "createDate": 1577798965853,
    "createBy": 2,
    "updateDate": 1577798965853,
    "updateBy": 2
}
Add FlexOffer filters
POST /channels/{icIdOrName}/offermappings/{offerMappingIdOrName}/filters
Input
Body Parameter – Content-Type: application/json
{
 "name":"abc",
 "description":"abc",
 "isDefault":true,
 "condition": [
   {
      "type": "STRING",
      "name": "userdefinedfield",
      "value":"MyTest",
      "relation":"EQUAL"
   },
   {…}
]
}
Output
Table 3. Response Codes
Created 201 Created
Miscellaneous 207 Miscellaneous
Error 400 Bad Request
Server Error 500 Internal Server Error
Update FlexOffer filter
PUT /channels/{icIdOrName}/offermappings/{offerMappingIdOrName}/filters/{filterIdOrName}
Input
Body Parameter – Content-Type: application/json
Note: Only the fields that have new values must be in the request body.
{
  "name":"testfilter2",
  "description":"testfilter2",
  "condition": [
   {
      "type": "STRING",
      "name": "userdefinedfield",
      "value":"MyTest",
      "relation":"EQUAL"
   },
   {…}
  ]
}
Output
Table 4. Response Codes
Accepted 202 Accepted
Error 400 Bad Request
Server Error 500 Internal Server Error
Delete FlexOffer filters
Delete/channels/{icIdOrName}/offermappings/{offerMappingIdOrName}/filters filters/{filterIdOrName}
Input
Body Parameter – Content-Type: application/json
Output
Table 5. Response Codes
No Content 200 Ok
Error 400 Bad Request
Server Error 500 Internal Server Error