Time to read: 3 min
The article covers the following topics:
General Info
First of all, to get started with API, you need to find your API-key. To do it, just navigate to the 'Users' Tab - > 'Users management' -> 'User edit page':
Only the General manager has permission to get the 'User edit page'.
Next thing you need is API URL, you can find it in the 'Settings' Tab -> 'Settings' -> 'Tracking domains' -> 'URLs' section:
Find out more about where you can find your/Affiliate's API-key and API URL here.
API Request Structure: GET/POST + api domain + path + ? + api-key=189471975956279174174.
It should be noted that header content-type - application/x-www-form-urlencoded is used on an ongoing basis.
[POST] Add offer
To create a new offer with Caps via API, you need to navigate to the 'Offers' section in the API Doc and choose the 'Add offer' method (follow the link):
Here you may see a lot of parameters that can be used to create a new offer.
These parameters are required:
- title - Offer title
- advertiser - Advertiser ID
- url - Tracking URL
Example on how to add new offer with Caps via API:
1) First of all, make sure that headers are entered correctly:
2) Enter required and all needed parameters in body section:
Where,
- caps[0][period] - a timeframe when the cap option is enabled. Possible values: day, month, all;
- caps[0][type] - a parameter that denotes the value the cap is limited by. Possible values: budget, conversions, clicks;
- caps[0][value] - the actual limit’s measure;
- caps[0][goal_type] - a parameter, that is used for determination when cap’s limit is reached. It may be: “all”, “each”, “exact”;
For [goal_type] = exact it is mandatory to specified [goals][] = your_goal_value_here parameter with a specific goal value.
- caps[0][affiliate_type] - an affiliate, the cap is chosen for. It may be: “all”, “each”, “exact”;
For [affiliate_type] = exact it is mandatory to specified [affiliates][] = affiliate's_id_here parameter with a specific Affiliate's ID.
- caps[0][country_type] - specific country which cap settings should be applied to. It may be: “all” , “each”, “exact”;
For [country_type] = exact it is mandatory to specified [country][] = country_code_here parameter with a specific country code. To Get countries list you may use GET /3.1/countries method.
- caps_status[0] - conversion status for cap count;
- is_redirect_overcap - allow overcap. Possible values: 0 - logical "no", 1- logical "yes".
cURL Request
The expample of offer creation with caps via cURL request:
curl --location --request POST 'https://api-rocketcompany.affise.com/3.0/admin/offer' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: bf09c801ff9b95b14ac8e17d6e4904b6' \
--data-urlencode 'title=OFFER WITH Caps' \
--data-urlencode 'advertiser=5e39279bac611cda7e5765ab' \
--data-urlencode 'url=https://track.gjane.com/hc/click?afclick={clickid}&afpid={pid}&afoffer={offer_id}' \
--data-urlencode 'caps[0][period]=day' \
--data-urlencode 'caps[0][type]=conversions' \
--data-urlencode 'caps[0][value]=150' \
--data-urlencode 'caps[0][goal_type]=all' \
--data-urlencode 'caps[0][affiliate_type]=all' \
--data-urlencode 'caps[0][country][]=DE' \
--data-urlencode 'caps[0][country_type]=exact' \
--data-urlencode 'caps_status[0]=confirmed' \
--data-urlencode 'caps_status[1]=pending' \
--data-urlencode 'caps_status[2]=hold' \
--data-urlencode 'is_redirect_overcap=1'
You may also find the following articles helpful:
- Getting started
- Setting API Integration with Affiliate
- How to create an offer via API?
- How to create an offer with Targeting Groups?
If you have more questions on how to create an offer with Caps via API, feel free to contact the Affise Support Team via support@affise.com or your Dedicated Account Manager.
Written by Anastasia Deryugina
1 Comments