GET redemption api - Tizra/Tizra-Customer-Tracker GitHub Wiki

(Server) GET to get information on redemption codes

The administrative base URL for redemption codes is /admin-api/<site>/redemptions.

Information about what redemption batches exist

A GET to this URL will return an array of information about what batches of redemptions are defined for the site:

[
    {
        "batch": "batch1", 
        "url": "/admin-api/9p2/redemptions/batch1"
    }, 
    {
        "batch": "more", 
        "url": "/admin-api/9p2/redemptions/more"
    }
]

Currently the batch URL is predictable from the name, but it is best to use the URL given in the list, as that could change.

Information about the codes within a batch

a GET from a batch URL will return an array of records, each describing a code in that batch. The results contain some fields that are not explained in the POST-redemption-api documentation, because they are not updatable:

  • redeemed-users A list of user-account names that have redeemed this code.
  • used-date The most recent date that this code was redeeemed.
  • redemption-url A URL to which a user can be directed and which will prompt for registration or login, on arrival.

The access-control-id is may be returned as an integer or as a tizra-id. If the value is a string, it's a tizra-id. In either case, it identifies the offer describing the terms and content to be licensed to a claiming user, or the terms to be applied to matching content for the claiming user.

Parameter to get batch contents request

It's possible to request formatted URLs when fetching a batch of redemption codes. This can be done by adding a target-url query parameter to the request.

Examples

Here's an example:

GET:
https://secure.agilepdf.com/admin-api/redemptions/test%20batch

[
    {
        "access-code": "08ab3362418d22ea", 
        "access-control-id": 118226, 
        "action-type": "apply-offer", 
        "batch": "test batch", 
        "is-valid": true, 
        "redeemed-users": [
            "[email protected]"
        ], 
        "remaining-redemptions": 0, 
        "used-date": "2014-09-11 22:30:59.114"
    }, 
    {
        "access-code": "a4efe57ef94ed379", 
        "access-control-id": 118226, 
        "action-type": "apply-offer", 
        "batch": "test batch", 
        "is-valid": true, 
        "redeemed-users": [], 
        "remaining-redemptions": 1
    },
    {
        "access-code": "06940f24c2bdce08", 
        "access-control-id": 118226, 
        "action-type": "session-license-match", 
        "batch": "test batch", 
        "is-valid": true, 
        "match-specification": {
            "all": [], 
            "any": [
                "Title:111Gateways to  Science, Grade 5, Unit 2, Matter and Energy, Lesson 1"
            ], 
            "excluded": []
        }, 
        "redeemed-users": [], 
        "remaining-redemptions": 2, 
        "used-date": "2014-09-11 23:10:23.233"
    }, 
    {
        "access-code": "a0107f66370afe72", 
        "access-control-id": 118226, 
        "action-type": "session-license-match", 
        "batch": "test batch", 
        "is-valid": true, 
        "match-specification": {
            "all": [], 
            "any": [
                "Title:111Gateways to  Science, Grade 5, Unit 2, Matter and Energy, Lesson 1"
            ], 
            "excluded": []
        }, 
        "redeemed-users": [], 
        "remaining-redemptions": 4
    }
]
GET
https://secure.agilepdf.com/admin-api/9p2/redemptions/more?target-url=/time
[
    {
        "access-code": "45cf6f1c492ee668",
        "action-type": "add-user-tag",
        "batch": "more",
        "is-valid": false,
        "redeemed-users": [],
        "redemption-url": "https://secure.autotest.com:8090/redeem/9p2?redemptionCode=45cf6f1c492ee668&successUrl=%2Ftime",
        "remaining-redemptions": 0,
        "used-date": "2013-04-24 17:55:07.874",
        "user-tags": "code;teg"
    },
    {
        "access-code": "b2a747e3bf42413d",
        "action-type": "add-user-tag",
        "batch": "more",
        "is-valid": false,
        "redeemed-users": [],
        "redemption-url": "https://secure.autotest.com:8090/redeem/9p2?redemptionCode=b2a747e3bf42413d&successUrl=%2Ftime",
        "remaining-redemptions": 0,
        "used-date": "2013-04-24 19:18:45.043",
        "user-tags": "code;teg"
    }
]
⚠️ **GitHub.com Fallback** ⚠️