state-writer/PUT

Used to update the Collector’s opt-in status for an AIR MILES offer.
PUT /offers/state-reader/v1/put

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

Used to update the Collector’s opt-in status for an AIR MILES offer selected within your website or mobile app. This ensures that the Collector’s opt-in status is synchronized between your list of offers and the AIR MILES system.

Sample request

curl -X PUT 
  https://uat.airmilesapis.ca/offers/state-writer/v1/put \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --header 'x-correlation-id: bcf529ae-0de0-4ded-90f5-e050ce2df0e3' \
  --header 'x-origin-client: external:partner:web' \
  --header 'Authorization: Bearer LQoD0gWJK7l9znrmsGksWxbvIEx9a8zXkw...' \
  --data-raw '{
    "stateChanges": [
        {
            "offerId": "951d9a70-4cf8-41b1-a01e-7953f069f527",
            "states": [
                {
                    "name": "SAVE",
                    "value": "SAVED"
                },
                {
                    "name": "OPT_IN",
                    "value": "OPTED_IN"
                }
            ]
        }
    ]
}'

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.

Request properties

* Required field

Property Description
offerId* The unique ID for the offer being updated.
states* The states being updated in the API PUT request.

Sample response

HTTP/1.1 200 OK

Response codes

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