state-reader/FIND

Used to return all offers that a Collector has opted-into/saved.
GET /offers/state-reader/v1/find

Take a look at our OpenAPI (Swagger-Spec) schema to learn more about the API calls.

Used to return all offers that a Collector has opted-into/saved, for display within a “My Saved Offers” section of your mobile app or website.

Sample request

curl -X GET 
  https://uat.airmilesapis.ca/offers/state-reader/v1/find?state=SAVE:SAVED \
  --header 'Content-Type: application/json' \
  --header 'x-correlation-id: bcf529ae-0de0-4ded-90f5-e050ce2df0e3' \
  --header 'x-origin-client: external:partner:web' \
  --header 'x-local-time: 2021-07-07T16:59:00' \
  --header 'Authorization: Bearer LQoD0gWJK7l9znrmsGksWxbvIEx9a8zXkw...' \
  --data-raw ''

Request headers

Header Description
Content-Type Indicates the media type of the resource.
x-correlation-id The unique ID for tracing the request across the system.
x-origin-client Name of the Client and Channel.
x-local-time Local time of the client, excluding the timezone.

Query parameters

Parameter Description
state The state types you want to retrieve.
partnerId The unique ID of the partner.
region The Collector region.
firstSortBy Level one, sort by type.
firstSortByDescending Level one, sort direction.
secondSortBy Level two, sort type.
secondSortByDescending Level two, sort direction.
pageNumber Page number of the results.
pageSize How many offers listed on each page.

Sample response

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Mon, 29 Oct 2018 15:27:34 GMT
{
    "offers": [
        {
            "offerId": "951d9a70-4cf8-41b1-a01e-7953f069f527",
            "collectorId": "80000000110",
            "states": [
                {
                    "name": "OPT_IN",
                    "value": "OPTED_IN",
                    "properties": {},
                    "updatedAt": "2021-07-07T20:55:26.276917Z"
                },
                {
                    "name": "SAVE",
                    "value": "SAVED",
                    "properties": {},
                    "updatedAt": "2021-07-07T20:55:26.276825Z"
                }
            ]
        },
        {
            "offerId": "e32f35ad-3d32-439d-94db-8c36a40ddbd1",
            "collectorId": "80000000110",
            "states": [
                {
                    "name": "OPT_IN",
                    "value": "OPTED_IN",
                    "properties": {},
                    "updatedAt": "2021-05-31T16:33:26.201783Z"
                },
                {
                    "name": "SAVE",
                    "value": "SAVED",
                    "properties": {},
                    "updatedAt": "2021-05-31T16:33:26.201759Z"
                }
            ]
        },
        {
            "offerId": "0095056b-b931-4431-8292-cd54f4986445",
            "collectorId": "80000000110",
            "states": [
                {
                    "name": "OPT_IN",
                    "value": "OPTED_IN",
                    "properties": {},
                    "updatedAt": "2021-05-21T14:53:47.293585Z"
                },
                {
                    "name": "SAVE",
                    "value": "SAVED",
                    "properties": {},
                    "updatedAt": "2021-05-21T14:53:47.293537Z"
                }
            ]
        }
    ],
    "returnedCount": 3
}

Response properties

Property Description
offerId The unique ID for the returned offers.
collectorId The Collector’s AIR MILES account number.
states The opt-in/saved status of the offers found for an individual Collector. Usually offers will show both the “Saved” and “Opt-in” statuses, but in certain scenarios, the Collector may have unsaved an offer they opted-into earlier.

Response codes

Code Description
200 Request Successful
400 Bad Request
401 Unauthorized
404 Record Not Found
500 Internal Server Error