Generate an affiliate link
POSThttps://api.tripleup.dev/affiliate-link-api
Generate a link for an (online) affiliate Offer. The link is specific to a single Card Account (cardholder), in order to attribute the purchase to the correct account.
Request
- application/json
Bodyrequired
Partner-defined, external Card Account ID. If the Card Account does not exist for the specified Program, it will be created with an "enrolled" date of the current day (UTC-12). Required if card_account_internal_id is not defined.
The partner-defined, external Card Program ID.
Triple Offer ID, provided by the API or offers file.
The partner-defined, external Publisher ID. Required for Portfolio Managers.
Responses
- 200
- 400
- 401
- 404
- 500
OK
- application/json
- Schema
- Example (auto)
Schema
A URL for a link for the consumer
Possible values: Value must match regular expression ^https://.+$
{
"url": "https://example.com/affiliate-link-consumer?id=long-unique-id"
}
Bad request
Unauthorized
Merchant not found
- application/json
- Schema
- Example (auto)
Schema
A description of the failure.
{
"message": "merchant_id AcmeWidgets does not exist."
}
Internal server error
Authorization: oauth2
name: triple_authtype: oauth2scopes:api.tripleup.com/partner.publishers,api.tripleup.com/partner.view_offers
description: The triple API uses OAuth2 with a client id and client secret. The URL to get an OAuth2 token is here: https://auth.tripleup.dev/oauth2/token This is an example of how to call the API from the command line. Code will need to be developed by the partner in their servers. ```bash # Fetch an access token TOKEN_URL=https://auth.tripleup.dev/oauth2/token CLIENT_ID=fake CLIENT_SECRET=another-fake # Fetch a space-separated list of scopes # If not provided, will return an access token # with all scopes to which the client has access SCOPE=api.tripleup.com/partner.publishers TOKEN_RESPONSE=$(curl -s -X POST $TOKEN_URL \ --user $CLIENT_ID:$CLIENT_SECRET \ --data grant_type=client_credentials \ --data-urlencode "scope=$SCOPE") # Use an access token ACCESS_TOKEN=$(echo $TOKEN_RESPONSE | jq -r '.access_token') TOKEN_TYPE=$(echo $TOKEN_RESPONSE | jq -r '.token_type') API_URL=https://api.tripleup.dev curl -X GET "$API_URL/partner/publishers" \ --header "Authorization: $TOKEN_TYPE $ACCESS_TOKEN" ``` See the _Client credentials grant_ section at the bottom of this [AWS blog post](https://aws.amazon.com/blogs/mobile/understanding-amazon-cognito-user-pool-oauth-2-0-grants/) for more information.flows: { "clientCredentials": { "tokenUrl": "https://auth.tripleup.dev/oauth2/token", "scopes": { "api.tripleup.com/partner.portfolios": "Manage Portfolio Manager details and portfolios of Publishers\n", "api.tripleup.com/partner.publishers": "Manage Publisher details, Card Programs, Consumers, Card Accounts,\nand Transactions\n", "api.tripleup.com/partner.view_offers": "View recommended Offers, search Offers, and view Offer details\n", "api.tripleup.com/partner.content_providers": "Manage Content Provider details, Merchants, Merchant Locations,\nand Offers\n" } } }
- python
- curl
- csharp
- go
- nodejs
- ruby
- php
- java
- powershell
- dart
- javascript
- c
- objective-c
- ocaml
- r
- swift
- kotlin
- rust
- HTTP.CLIENT
- REQUESTS
import http.client
import json
conn = http.client.HTTPSConnection("api.tripleup.dev")
payload = json.dumps({
"card_account_external_id": "string",
"card_program_external_id": "string",
"offer_id": "string",
"publisher_external_id": "string"
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
conn.request("POST", "/affiliate-link-api", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))