ADDEDIT GeoTargets API Version 3

Updated on 2016-05-12
Current Version: Version 3
Deprecated Version: 1,2
Requests Allowed: GET&SOAP

 

Summary:

Returns "Countries Added", "Countries Replaced", or "Countries Removed"

 

Resource/WSDL Page:

http://<your_domain_here>/api/3/addedit.asmx?op=GeoTargets 

 

Parameters

api_key
Required
Type: STRING
Length (Max): 50

Must be a valid API key

Example Values: Fo35NRAqvFLXoZxqB4aVMhh

offer_contract_id
Required
Type: INT

Obtained via EXPORT Offers API

Example Values: 6366

set_targeting_to_geo
Required
Type: BOOL

Apply geo targeting method to offer contract?

Example Values: True, False

add_edit_option
Required
Type: ENUM

Denotes whether you are adding, removing, or replacing current geo targeting configuration. 

Example Values: add, replace. remove

countries
Required
Type: STRING
Length (Max): NA

Comma separated list of two-letter country codes to add, remove, or replace. 

Example Value: US,MX

allow_countries
Required
Type: BOOL

Is traffic from the above countries allowed on the offer?

**If the offer contract is new or has never been configured for Geo targeting previously, your first API call must specify which countries are allowed (allow_countries=true). A subsequent call can be made to specify a redirect contract(s) for non-allowed geos. This field can be passed as either true or false if add_edit_option=remove

Example Values: True, False

redirect_site_offer_contract_ids
Required
Type: STRING
Length (Max): NA

You must pass as many IDs as countries. You can pass 0 for each country that doesn't have a specific redirect. If you wish to send traffic from a certain geo to another contract within the same offer (internal redirect), you will pass allow_countries=true and then the corresponding contract id(s) in this field. 

Example Values: 3175,6362

default_redirect_site_offer_contract_id
Required
Type: INT
Set the default redirect for all non-allowed geos
Example Values: 3175

**Note all optional parameters still need to be passed through in the actual call. These parameters do not need a value (therefore you can use a null value). 

 

Example GET Requests


3 countries allowed, no internal redirects, set default redirect for non-allowed geos
http://demo.cakemarketing.com//api/3/addedit.asmx/GeoTargets?api_key=YM6FNThM7EnEDC7AAGpp3K2oRjJdGFP
&offer_contract_id=6366
&set_targeting_to_geo=true
&add_edit_option=replace
&countries=US,MX,GB
&allow_countries=true
&redirect_site_offer_contract_ids=0,0,0
&default_redirect_site_offer_contract_id=3175


Set specific redirects for two geos that are currently not allowed.
http://demo.cakemarketing.com//api/3/addedit.asmx/GeoTargets?api_key=YM6FNThM7EnEDC7AAGpp3K2oRjJdGFP
&offer_contract_id=6366
&set_targeting_to_geo=true
&add_edit_option=add
&countries=SE,CA
&allow_countries=false
&redirect_site_offer_contract_ids=3175,6365
&default_redirect_site_offer_contract_id=0


Remove two countries that are currently allowed, no specific redirects for either, not changing default redirect offer
http://demo.cakemarketing.com//api/3/addedit.asmx/GeoTargets?api_key=YM6FNThM7EnEDC7AAGpp3K2oRjJdGFP
&offer_contract_id=6366
&set_targeting_to_geo=true
&add_edit_option=remove
&countries=MX,GB
&allow_countries=false
&redirect_site_offer_contract_ids=0,0
&default_redirect_site_offer_contract_id=0


Sample XML Responses:

   

<geo_targets_addedit_response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cakemarketing.com/api/3/">
<success>true</success>
<message>Geotarget(s) Replaced</message>
<row_count>3</row_count>
</geo_targets_addedit_response>

  

<geo_targets_addedit_response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cakemarketing.com/api/3/">
<success>true</success>
<message>Geotarget(s) Added</message>
<row_count>2</row_count>
</geo_targets_addedit_response>

  

<geo_targets_addedit_response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://cakemarketing.com/api/3/">
<success>true</success>
<message>Geotarget(s) Removed</message>
<row_count>1</row_count>
</geo_targets_addedit_response>

 

 

Example Error Messages: 

Error Message

Likely Cause

Invalid API Key

API Key does not exist or is expired

Invalid Offer Contract ID

offer_contract_id does not correspond to an offer contract in your instance

Please Provide Valid Country Code(s)

one or more of the country codes provided is not valid

Invalid Redirect Offer Contract ID(s)  redirect_offer_contract_id(s) do not exist in your system OR
  • if allow_countries=true, any redirect_site_offer_contract id(s) must be contracts from the same offer
  • if allow_countries=fasle, any redirect_site_offer_contract id(s) must be contracts from a different offer
Invalid Default Geo-Redirect Offer ID
default_redirect_site_offer_contract id does not exist in the system