Affiliate Deep Linking

In this article we will run through a basic process for finding a performance at AMC Town Center 20 and generating a performance deep link that will credit us for ticket sales. See Showtimes for more information on finding performances.

Finding a Performance

To get started with purchasing tickets we will need to begin by selecting a theatre and a performance we would like tickets for. We will start by using AMC Town Center 20, and pulling the showtimes for today. We'll construct the URL using Town Center 20's theatre number 38 and today's date. To keep things simple we will set the page size to one and just use first result.

GET  /v2/theatres/38/showtimes/12-15-2014?page-size=1

Response

{
    "pageSize": 1,
    "pageNumber": 1,
    "count": 35,
    "_links": {
        "self": {
            "href": "https://api.amctheatres.com/v2/theatres/38/showtimes/12-15-2014?page-number=1&page-size=1",
            "templated": false
        },
        "next": {
            "href": "https://api.amctheatres.com/v2/theatres/38/showtimes/12-15-2014?page-number=2&page-size=1",
            "templated": false
        }
    },
    "_embedded": {
        "showtimes": [
            {
                "id": 29840403,
                "internalReleaseNumber": 37383,
                "performanceNumber": 3566,
                "movieId": 40722,
                "movieName": "One Direction Concert Movie",
                "sortableMovieName": "One Direction: This Is Us",
                "showDateTimeUtc": "2014-12-15T16:15:00Z",
                "showDateTimeLocal": "2014-12-15T10:15:00",
                "sellUntilDateTimeUtc": "2014-12-15T16:25:00Z",
                "isSoldOut": false,
                "isCanceled": false,
                "utcOffset": "-06:00",
                "auditorium": 9,
                "runTime": 88,
                "mpaaRating": "PG",
                "purchaseUrl": "https://www.amctheatres.com/order/towncenter/12-15-2014/3566",
                "mobilePurchaseUrl": "https://www.amctheatres.com/order/towncenter/12-15-2014/3566",
                "movieUrl": "https://www.amctheatres.com/movies/one-direction-concert-movie",
                "attributes": [
                    {
                        "code": "specialengagements",
                        "name": "Special Engagements",
                        "description": "Special Engagements"
                    }
                ],
                "ticketPrices": [
                    {
                        "price": 6,
                        "type": "ADULT",
                        "sku": "TICKET-GA-29840403-ADULT"
                    },
                    {
                        "price": 6,
                        "type": "CHILD",
                        "sku": "TICKET-GA-29840403-CHILD"
                    },
                    {
                        "price": 6,
                        "type": "SENIOR",
                        "sku": "TICKET-GA-29840403-SENIOR"
                    }
                ],
                "media": {
                    
                },
                "_links": {
                    "self": {
                        "href": "https://api.amctheatres.com/v2/showtimes/29840403",
                        "templated": false
                    },
                    "https://api.amctheatres.com/rels/v2/movie": {
                        "href": "https://api.amctheatres.com/v2/movies/40722",
                        "templated": false
                    },
                    "https://api.amctheatres.com/rels/v2/theatre": {
                        "href": "https://api.amctheatres.com/v2/theatres/38",
                        "templated": false
                    }
                }
            }
        ]
    }
}

Using the results for showtimes we can select the showtime we want, and inside we find the purchaseUrl link.

"purchaseUrl": "https://www.amctheatres.com/order/towncenter/12-15-2014/3566"

Appending your GET parameters

Simply linking users to the above URL will not give us credit for the ticket sales, to get credit for the sale we need to include an AffiliateCode. We can also provide a return URL and button text, and when the purchase is complete a button will be presented to the user to guide them back to our site. We'll use 'MyAffiliateCode', 'Back to My Site', and 'http://www.mysite.com' as our values.

"purchaseUrl": "https://www.amctheatres.com/order/towncenter/12-15-2014/3566?affiliateCode=MyAffiliateCode&returnDisplay=Back to My Site&returnUrl=http://www.mysite.com"

Now we will be credited for the sale, and when the user completes the transaction they will see a back button to return to the URL we provided.