Search Promotion Code(s)

Search for a list of promotion code(s) in the CDP based on conditions.

An access token of scope item is required to call this API.

POST https://api.ants.tech/access/api/item/search

Headers

Name
Type
Description

Content-Type

String

application/json

Authorization*

String

Bearer <ACCESS_TOKEN>

Request Body

Name
Type
Description

itemTypeId*

Hard-coded value

-100

itemTypeName*

Hard-coded value

promotion_code

attrs*

Array of Strings

An array of retrieving attributes. For example:

[ "id", "name", "pool_id", "date_created", "allocated_time", "allocated_audience", "audience_type", "code_status", "last_used_source", "last_used_time", "channel_id" ]

filters*

JSON

Your multi-condition filter criteria.

For example: { "OR": [ { "AND": [ { "type": 2, "column": "audience_type", "data_type": "number", "operator": "matches", "value": [ -1003 ] }, { "type": 2, "column": "allocated_audience", "data_type": "string", "operator": "matches", "extendValue": [], "value": [ "0003da4bccf6cec103a97e7a5c8485af", "00088d37411f4d90ea80de8d1bdb4175", "000a04dd2bd60fdd22209a296105519b", "000a1ad1eb9adc97483c1da44d969f3f", "000cf2ef7fd2506a06942bb523917a22" ] }, { "type": 2, "column": "code_status", "data_type": "number", "operator": "matches", "extendValue": [], "value": [ 1, 3, 4 ] }, { "type": 2, "column": "allocated_time", "data_type": "datetime", "operator": "before_date", "value": 1724605200000, "time_unit": "DAY" } ] } ] }

filters.OR[]*

Array of JSON

An array of your one...of conditions. For this API scope, it always has 1 items.

filters.OR[].AND[]*

Array of JSON

An array of your all...of conditions. For this API scope, there will be 4 items, each of which is a condition, you can either omit it (except the last item is required), or change its operators/value.

filters.OR[].AND[0]

JSON

First condition item. Your promotion code audience type (customers or visitors). Possible values are: - -1003: customer - -1007: visitor For example: { "type": 2, "column": "audience_type", "data_type": "number", "operator": "matches", "value": [ -1003, -1007 ] }

filters.OR[].AND[1]

JSON

Second condition item. Your promotion code audience IDs (required if the first condition item is presented, otherwise empty response will be returned). For example: { "type": 2, "column": "allocated_audience", "data_type": "string", "operator": "matches", "extendValue": [], "value": [ "0003da4bccf6cec103a97e7a5c8485af", "00088d37411f4d90ea80de8d1bdb4175", "000a04dd2bd60fdd22209a296105519b", "000a1ad1eb9adc97483c1da44d969f3f", "000cf2ef7fd2506a06942bb523917a22" ] }

filters.OR[].AND[2]

JSON

Third condition item. Your promotion code status. Possible values are: - 1: Available - 3: Sent - 4: Used For example: { "type": 2, "column": "code_status", "data_type": "number", "operator": "matches", "extendValue": [], "value": [ 1, 3, 4 ] }

filters.OR[].AND[3]*

JSON

Fourth condition item (This one is required). Your promotion code allocated time. Value is the date in Unix timestamp format. Possible operators are: - before_date - equals - after_date For example: { "type": 2, "column": "allocated_time", "data_type": "datetime", "operator": "before_date", "value": 1724605200000, "time_unit": "DAY" }

{
    "code": 200,
    "message": "Search Business Object success",
    "data": {
        "status": true,
        "data": [
            {
                "allocated_audience": "00088d37411f4d90ea80de8d1bdb4175",
                "audience_type": -1003,
                "allocated_time": "2024-08-16 19:29:46",
                "date_created": "2024-08-16 14:14:44",
                "last_used_source": null,
                "name": "5020772646313",
                "last_used_time": null,
                "id": "5020772646313",
                "pool_id": 26507591,
                "code_status": 3
            },
            {
                "allocated_audience": "000a04dd2bd60fdd22209a296105519b",
                "audience_type": -1003,
                "allocated_time": "2024-08-16 19:29:47",
                "date_created": "2024-08-16 14:14:43",
                "last_used_source": null,
                "name": "5020808638087",
                "last_used_time": null,
                "id": "5020808638087",
                "pool_id": 26507591,
                "code_status": 3
            },
            {
                "allocated_audience": "000a1ad1eb9adc97483c1da44d969f3f",
                "audience_type": -1003,
                "allocated_time": "2024-08-16 19:30:07",
                "date_created": "2024-08-16 14:03:13",
                "last_used_source": null,
                "name": "2014788869435",
                "last_used_time": null,
                "id": "2014788869435",
                "pool_id": 26507454,
                "code_status": 3
            },
            {
                "allocated_audience": "0003da4bccf6cec103a97e7a5c8485af",
                "audience_type": -1003,
                "allocated_time": "2024-08-17 10:06:05",
                "date_created": "2024-07-27 05:50:10",
                "last_used_source": null,
                "name": "5018570978043",
                "last_used_time": null,
                "id": "5018570978043",
                "pool_id": 24993469,
                "code_status": 3
            },
            {
                "allocated_audience": "000cf2ef7fd2506a06942bb523917a22",
                "audience_type": -1003,
                "allocated_time": "2024-08-01 10:14:56",
                "date_created": "2024-07-27 05:50:09",
                "last_used_source": null,
                "name": "5018612669277",
                "last_used_time": null,
                "id": "5018612669277",
                "pool_id": 24993469,
                "code_status": 3
            }
        ]
    }
}

An example cURL

curl --location 'https://api.ants.tech/access/api/item/search' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 5474r2x214z26484u2e4y4v5c4l5g416h4x21303XXXX' \
--data '{
    "itemTypeId": -100,
    "itemTypeName": "promotion_code",
    "attrs": [
        "id",
        "name",
        "pool_id",
        "date_created",
        "allocated_time",
        "allocated_audience",
        "audience_type",
        "code_status",
        "last_used_source",
        "last_used_time",
        "channel_id"
    ],
    "filters": {
        "OR": [
            {
                "AND": [
                    {
                        "type": 2,
                        "column": "audience_type",
                        "data_type": "number",
                        "operator": "matches",
                        "value": [
                            -1003
                        ]
                    },
                    {
                        "type": 2,
                        "column": "allocated_audience",
                        "data_type": "string",
                        "operator": "matches",
                        "extendValue": [],
                        "value": [
                            "0003da4bccf6cec103a97e7a5c8485af",
                            "00088d37411f4d90ea80de8d1bdb4175",
                            "000a04dd2bd60fdd22209a296105519b",
                            "000a1ad1eb9adc97483c1da44d969f3f",
                            "000cf2ef7fd2506a06942bb523917a22"
                        ]
                    },
                    {
                        "type": 2,
                        "column": "code_status",
                        "data_type": "number",
                        "operator": "matches",
                        "extendValue": [],
                        "value": [
                            1,
                            3,
                            4
                        ]
                    },
                    {
                        "type": 2,
                        "column": "allocated_time",
                        "data_type": "datetime",
                        "operator": "before_date",
                        "value": 1724605200000,
                        "time_unit": "DAY"
                    }
                ]
            }
        ]
    }
}'

Last updated