Retrieve Ads
From wiki.taptica.com
				
								
				
				
																
				
				
								
				| Contents | 
Communications
The communication will be done using the HTTP protocol.
End Point
Service end point:
POST:
Request
• The request is sent via an HTTP POST to the following URL: http://ad.taptica.com/aff_ad
• The content type of the request is application/x-www-form-urlencoded.
• The body of the POST contains URL encoded key/value pairs separated by "&".
Request parameters
| Parameter | Name In Request | Description | Example | Required? | 
| User agent | u | The browser user agent of the device making the request | u= Mozilla/5.0 (Linux;U; Android 2.1-update1;iw-il; HTC LegendBuild/ERE27) | No | 
| Application id | a | The id of the applications, as registered in Taptica's AdCore servers. | a=C20DC50B-65B9-4B11-8F62-79F9286896B7 | Yes | 
| Device id | uid | The id of the device | uid=9774d56d682e549 | Yes | 
| IP Address | i | Client IP Address | i=84.103.57.1 | Yes | 
| Localization | loc | The localization (Language & Country) that is currently chosen for the device ,following the standards of ISO 639-1,ISO 3166-1. | loc=en_GB | No | 
| Network type | nt | The type of network the device is currently connected to ("wifi" or "carrier") | nt=carrier | No, | 
| Marital status | marital | Marital status of the user. options are: "single", "divorced", "engaged", "relationship", or "swinger" | marital=single | No | 
| Income | income | Annual income (in USD) , e.g. 10000. | income=10000 | No | 
| Interests | interests | a comma separated list of keywords denoting user's area of interests. | interests=cars,sports,F1,stocks | No | 
| Education | edu | Education level of the user ("UG" or "PG") | edu=UG | No | 
| Resolution | r | Resolution of the ad request | r=320x50 | No | 
| Ad Type | t | Ad type - Text (1), Banner (2), Html (3), All (0) | t=2 | No | 
| Gender | gender | Gender, Male, Female, All | gender=male | No | 
| Age | age | Age of the user | age=27 | No | 
| Date Of Birth | dob | User's Date of birth(Format: yyyyMMdd) | dob=19820211 | No | 
Response
The data is returned in a JSON format.
• The JSON returned by Taptica AdCore servers is a single object, composed of simple fields of JSON Type String, described in the section below.
Example:
{"adyxAdRequestGuid":"c1059ef9-424c-4785-8350-cd86a8b71d1e",
 "adType":"banner",
 "imageUrl":"http://media.go2speed.org/brand/files/taptica/516/SUMO_Banner_320x50.png",
 "imageAltText":null,
 "adUrl":"http://tracking.taptica.com/aff_ic?tt_cid=c1059ef9424c47858350cd86a8b71d1e&el=GbtixRMFpArEVHfprXTgVAQ3WW...",
 "urlType":"web",
 "beacon":null,
 "adInterval":"10"}
* Note: Not in use for API (urlType, beacon, adInterval)
• The response type can be either: Textual ad, Graphical Ad or an Error Message.
The JSON of each response type is described below.
Textual Ads
| Parameter | Description | Example | 
| adyxAdRequestGuid | Unique identifier of an ad request | "{21EC2020-3AEA-1069-A2DD-08002B30309D}" | 
| adType | The type of an ad. Must have the value "text" | "text" | 
| adText | The text to be displayed on the ad | "Click here! The best offer you can ever get" | 
| adUrl | A URL to which the user should be redirected upon clicking on the ad | "http://www.taptica.com" | 
Graphical Ads
| Parameter | Description | Example | 
| adyxAdRequestGuid | Unique identifier of an ad request | "{21EC2020-3AEA-1069-A2DD-08002B30309D}" | 
| adType | The type of an ad. Must have the value "banner" | "banner" | 
| imageURL | A URL from which the graphical ad image should be retrieved | "http://www.taptica.com/images/file1.jpg" | 
| adUrl | A URL to which the user should be redirected upon clicking on the ad | "http://www.taptica.com" | 
Html Ads
| Parameter | Description | Example | 
| AdRequestGuid | Unique identifier of an ad request | "{21EC2020-3AEA-1069-A2DD-08002B30309D}" | 
| adType | The type of an ad. Must have the value "html" | "html" | 
| adUrl | A URL to which the user should be redirected to (usually Html Page) | "http://www.taptica.com" | 
Error Message
| Parameter | Description | Example | 
| errorId | The identifier of the error that occurred. If needed, extra text describing the error will be written into the errorText. | "5" | 
| errorText | Contains additional information regarding the retrieved error. | "The error had happened due to the following unexpected reason: unsupported client" | 
List of errors
| errorID | Description | 
| -1 | Unknown error. In this case, the errorText parameter will include the information that describes the error. | 
| 0 | Server overload | 
| 1 | Server could not find an appropriate ad (because of age restriction , for example) | 
| 2 | Application id is missing | 
| 3 | Application id wasn't found on database | 
| 4 | User agent is missing | 
| 5 | User agent is not supported | 
| 6 | Test mode value is not supported | 
| 7 | Resolution size and/or density are not supported | 
| 8 | Resolution size and/or density are in the wrong format | 
| 9 | Postal code is in wrong format | 
| 10 | Area code is in wrong format | 
| 11 | Location is in wrong format | 
| 12 | Birth date is in wrong format or is invalid | 
| 13 | Gender is in wrong format | 
| 14 | Unique Identifier is missing | 
| 15 | Unique Identifier value is in wrong format or is invalid | 
| 16 | Localization is missing | 
| 17 | Localization value is in wrong format or is invalid | 
| 18 | Net type value is in wrong format or is invalid | 
| 19 | Marital status value is not supported | 
| 20 | Income value is in wrong format or is invalid | 
