Step 3: Implementing the REST API

http://api.fyber.com/feed/v1/offers.json
  • Example of API Request
http://api.fyber.com/feed/v1/offers.json?appid=[APP_ID]&uid=[USER_ID]&ip=[IP_ADDRESS]&locale=[LOCALE]&device_id=[DEVICE_ID]&pub0=[CUSTOM]&timestamp=[UNIX_TIMESTAMP]&offer_types=[OFFER_TYPES]&phone_version=[phone_version]&apple_idfa=[IDFA]&apple_idfa_tracking_enabled=[IDFA ENABLED]&google_ad_id=[GA ID]&google_ad_id_limited_tracking_enabled=[GA ID ENABLED]&hashkey=[HASHKEY]
  
 200 OK (JSON) 200 OK (XML) 200 NO_CONTENT
{
 "code": " OK" ,
 "message": "OK",
 "count": 1,
 "pages": 1,
 "information" : {
  "app_name": "SP Test App" ,
  "appid": 157,
  "virtual_currency": "Coins",
  "country": " US" ,
  "language": " EN" ,
  "support_url": "http://iframe.fyber.com/mobile/DE/157/my_offers"
 },
 "offers": [
  {
    "title": "Tap  Fish",
    "offer_id": 13554,
    "teaser": "Download and START" ,
    "required_actions": "Download and START",
    "link": "http://iframe.fyber.com/mbrowser?appid=157&lpid=11387&uid=player1",
    "offer_types" : [
     {
      "offer_type_id": 101,
      "readable": "Download"
     },
     {
      "offer_type_id": 112,
      "readable": "Free"
     }
    ] ,
    "thumbnail" : {
     "lowres": "http://cdn.fyber.com/assets/1808/icon175x175-2_square_60.png",
     "hires": "http://cdn.fyber.com/assets/1808/icon175x175-2_square_175.png"
    },
    "payout": 90,
    "time_to_payout" : {
     "amount": 1800 ,
     "readable": "30 minutes"
    }
  }
 ]
}

QUERY PARAMS

 
format
string
REQUIRED

This parameter defines the format of the response that you will get. Currently, you can choose either json or xml. This parameter is set by the extension after ‘offers’ in the URL, e.g. .../offers.json?....

 
appid
string
REQUIRED

This parameter represents the Fyber Application ID of your application. You can find it in the Dashboard

 
uid
string
REQUIRED

This parameter represents the unique User ID as used internally in your application. This identifies the user so that virtual currency can later be attributed to their account via the callback request. Please note that the user ID has to remain constant so that users are prevented from completing an offer more than once.

 
locale
string
REQUIRED

This parameter represents the language which will be used to describe the offers (e.g. the required actions). Both iOS and Android offer ways to retrieve the preferred language of the user. Note: Do not put country codes here, rather use the language codes, e.g. don’t use US, use EN instead.

 
os_version
string
REQUIRED

Current version of the user's Operating System. Implementation hint:
[[UIDevice currentDevice] systemVersion]

 
timestamp
string
REQUIRED

This parameter represents the time the request is being sent by the device, using the Unix Timestamp format. It is a security parameter to make sure the request is valid and wasn't processed before. Implementation hint:
[NSString stringWithFormat:@"%lu", (long)[[NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]] integerValue]

 
hashkey
string
REQUIRED

This parameter represents the Security Hash Key, which signs the entire request. It is a security parameter to make sure the request is valid and no data was tampered with. This parameter is mandatory. See dedicated part below for the steps to generate this hash-key.

 
apple_idfa
string
REQUIRED

Apple ID for Advertising. Implementation hint:
[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString] forKey:@"apple_idfa"]; More info here.

 
apple_idfa_tracking_enabled
string
REQUIRED

Is user tracking via Apple ID for Advertising enabled by the user?. Implementation hint:
[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]]

 
google_ad_id
string
REQUIRED

Google Advertising ID. Implementation hint: AdvertisingIdClient.getAdvertisingIdInfo(context).getId()

 
google_ad_id_limited_tracking_enabled
string
REQUIRED

Is user tracking via Google Advertising ID enabled by the user? Implementation hint: AdvertisingIdClient.getAdvertisingIdInfo(context).isLimitAdTrackingEnabled()

 
device
string

The type of device. Can be tablet for iOS or Android tablets or phone. If set, this will result in special tablet/phone offers being shown. For iPods, please send phone. Implementation hint:
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? @"tablet" : @"phone" forKey:@"device_id"

 
ip
string

This parameter represents the IP address of the device of your user. Fyber uses it to filter the offers available to and targeted at your user. If the parameter is not given, the IP address of the request will be used. Note: During integration, please also use valid ‘external’ IP addresses for testing, as responses to requests from reserved IP addresses (e.g. 127.0.0.1, 10.0.0.1, etc.) won’t contain any offers.

 
offer_types
string

Filter the results based on type of offer. See more details in the Request Section

 
page
string

Fyber limits the amount of offers that are returned for a request. If there is more than one page of offers available for your user, an additional parameter will be returned within the response to your first offer request (see below). You can then use this parameter to define which page of the response set you are requesting. By default, page is 1.

 
pub0
string

By using these, you can pass along custom parameters (e.g. pub0, pub1, …) with each request to your callback URL by attaching these parameters to the API request URL

 
pub1
string

By using these, you can pass along custom parameters (e.g. pub0, pub1, …) with each request to your callback URL by attaching these parameters to the API request URL

 
phone_version
string
REQUIRED

This parameter represents the user's phone model. Fyber uses it to filter the offers available. If the parameter is not provided Fyber considers it as an 'unknown' parameter, and filters the request. Please see below for a full list of values.

 
gdpr_privacy_consent
string

When passed: 1: yes, user gave consent 2: no, user did NOT give consent

 
placement_id
string

Placement Identifier. By default is blank, and blank is the same as default . Has to match value defined in the Dashboard, otherwise Offer API won’t return any ads.

 

Phone Version Values

Value
Types

iPhone

"iPhone3,1",
"iPhone3,2", "iPhone3,3",
"iPhone4,1", "iPhone4,2", "iPhone4,3",
"iPhone5,1", "iPhone5,2",
"iPhone5,3", "iPhone5,4",
"iPhone6,1", "iPhone6,2",
"iPhone7,2", "iPhone7,1",
"iPhone8,1", "iPhone8,2", "iPhone8,4",
"iPhone9,1", "iPhone9,2", "iPhone9,3", "iPhone9,4"
"iPhone 10,1", "iPhone 10,2", "iPhone 10,3", "iPhone 10,4", "iPhone 10,5", "iPhone 10,6", "iPhone 11,2", "iPhone 11,4", "iPhone 11,6", "iPhone 11,8",
"iPhone 12,1", "iPhone 12,3", "iPhone 12,5"

iPad

"iPad1,1",
"iPad2,1", "iPad2,2", "iPad2,3", "iPad2,4", "iPad2,5", "iPad2,6", "iPad2,7",
"iPad3,1", "iPad3,2", "iPad3,3",
"iPad3,4", "iPad3,5", "iPad3,6",
"iPad4,1", "iPad4,2", "iPad4,3", "iPad4,4", "iPad4,5", "iPad4,6", "iPad4,7", "iPad4,8", "iPad4,9",
"iPad5,1", "iPad5,2","iPad5,3", "iPad5,4",
"iPad6,3", "iPad6,4", "iPad6,7", "iPad6,8"
"iPad6,11", "iPad6,12",
"iPad7,1", "iPad7,2", "iPad7,3", 'iPad7,4",
"iPad8,1", "iPad8,2", "iPad8,3", "iPad8,4", "iPad8,5", "iPad8,6", "iPad8,7", "iPad8,8"

iPod

"iPod1,1",
"iPod2,1",
"iPod3,1",
"iPod4,1",
"iPod5,1",
"iPod7,1"

Unknown

blank

To handle the response and request is important that you follow the following two steps.

Let's start by the Request: Step 3A: Preparing the Request. Pay special attention to the Hash Key Calculation.

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