Follow

How to create an offer?

Time to read: 3 min

topic.pngThe 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':

Screenshot_36.png

 import.png 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:

Markup_2020-06-16_at_17.55.35.png

click__1_.pngFind 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, and content-type - multipart/form-data is used for uploading files (logo, creative files). 

[POST] Add offer

To create a new offer via API, you need to navigate to the 'Offers' section in the API Doc and choose the 'Add offer' method (follow the link):

chrome-capture__15_.gif

Here you may see a lot of parameters that can be used to create a new offer.

  • title - Offer title
  • advertiser - Advertiser ID
  • url - Tracking URL

Example on how to add new offer (with Caps, Payouts, Targeting, Creatives, and Landings) via API:

1) First of all, make sure that headers are entered correctly: 

Screenshot_62.png

 import.png If you create an offer manually via API and want to add a logo or creative files, make sure that header content-type - multipart/form-data is used. 

2) Enter required and all needed parameters in body section: 

Screenshot_63.png

Screenshot_64.pngScreenshot_76.png

import.png As you can see, the offer consists of two target groups General and Personal. 

General target groups whitelist on Allowed sub-accounts, personal target group have blacklist on Allowed sub-accounts. To block or allow sub-accounts you need to add to request these parameters:

  • whitelist: targeting[0][sub][allow][1][]=your_value_for_whitelist
  • blacklist: targeting[1][sub][deny][2][]=your_value_for_blacklist

Where, 

  • targeting[0] - first place of the target group in the offer, [sub][allow][1][] -  you allow sub1 account
  • targeting[1] - second place of the target group in the offer, [sub][deny][2][] -  you block sub2 account

import.png Make sure that the Whitelist/Blacklist structure is correct; otherwise, you will receive the response "status:2: 400 Bad Request", and the offer will not be saved.

cURL Request

The example of offer creation 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 'Content-Type: multipart/form-data' \
--header 'api-key: bf09c801ff9b95b14ac8e17d6e4904b6' \
--header ': ' \
--data-urlencode 'title=NEW BIG OFFER' \
--data-urlencode 'advertiser=5e39279bac611cda7e5765ab' \
--data-urlencode 'url=https://track.gjane.com/hc/click?afclick={clickid}&afpid={pid}&afoffer={offer_id}' \
--data-urlencode 'cross_postback_url=https://cpa.gjane.com/hc/click?afclick={clickid}&afpid={pid}&afoffer={offer_id}' \
--data-urlencode 'macro_url=&sub1={IP}' \
--data-urlencode 'url_preview=https://giane.com' \
--data-urlencode 'trafficback_url=https://rocketcompant.g2afse.com/click?pid={pid}&offer_id=132009&sub1={offer_id}' \
--data-urlencode 'description_lang[en]=English description' \
--data-urlencode 'creativeFiles[0]=' \
--data-urlencode 'creativeUrls[1]=https://google.drive' \
--data-urlencode 'status=active' \
--data-urlencode 'privacy=protected' \
--data-urlencode 'is_top=0' \
--data-urlencode 'is_cpi=1' \
--data-urlencode 'payments[0][countries][]=RU' \
--data-urlencode 'payments[0][devices][]=desktop' \
--data-urlencode 'payments[0][goal]=28' \
--data-urlencode 'payments[0][total]=100' \
--data-urlencode 'payments[0][revenue]=30' \
--data-urlencode 'payments[0][currency] =USD' \
--data-urlencode 'payments[0][type]=fixed' \
--data-urlencode 'payments[0][sub1]=abc' \
--data-urlencode 'partner_payments[1][partners][]=2' \
--data-urlencode 'partner_payments[1][countries][]=RU' \
--data-urlencode 'partner_payments[1][goal]=14' \
--data-urlencode 'partner_payments[1][total]=80' \
--data-urlencode 'partner_payments[1][type]=fixed' \
--data-urlencode 'partner_payments[1][currency]=USD' \
--data-urlencode 'partner_payments[1][revenue]=20' \
--data-urlencode 'landings[0][title]=landing' \
--data-urlencode 'landings[0][url]=https://giane.com' \
--data-urlencode 'landings[0][url_preview]=https://giane.com' \
--data-urlencode 'landings[0][type]=transit' \
--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_status[0]=confirmed' \
--data-urlencode 'caps_status[1]=pending' \
--data-urlencode 'caps_status[2]=hold' \
--data-urlencode 'caps[0][type]=conversions' \
--data-urlencode 'redirect_type=http302' \
--data-urlencode 'start_at=2020-03-10' \
--data-urlencode 'is_redirect_overcap=0' \
--data-urlencode 'caps_status[1]=pending' \
--data-urlencode 'caps_status[2]=hold' \
--data-urlencode 'redirect_type=http302' \
--data-urlencode 'start_at=2020-03-10' \
--data-urlencode 'is_redirect_overcap=0' \
--data-urlencode 'click_session=1y2m' \
--data-urlencode 'minimal_click_session=5h7i' \
--data-urlencode 'smartlink_categories[0]=5a8d24b7948641003d282ec2' \
--data-urlencode 'targeting[0][country][allow][]=RU' \
--data-urlencode 'targeting[0][device_type][]=mobile' \
--data-urlencode 'targeting[0][connection][]=cellular' \
--data-urlencode 'targeting[0][sub][allow][1][]=qwerty' \
--data-urlencode 'targeting[1][country][allow][]=US' \
--data-urlencode 'targeting[1][device_type][]=desktop' \
--data-urlencode 'targeting[1][connection][]=wi-fi' \
--data-urlencode 'targeting[1][affiliate_id][]=2' \
--data-urlencode 'targeting[1][sub][deny][2][]=qwerty213'

article.pngYou may also find the following articles helpful:

 If you have more questions on how to create an offer via API, feel free to contact the Affise Support Team via support@affise.com or your Dedicated Account Manager.

 Written by Anastasia Deryugina 

 

Was this article helpful?
3 out of 3 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.