Step 3B: Parsing the Response

Basic Response Body Structure

If your request did not succeed, please check HTTP status and error:

HTTP code
Code
Description

400

ERROR_INVALID_PAGE

A non-existing page was requested with the parameter page.

400

ERROR_INVALID_APPID

An invalid or missing application id (appid) was given as a parameter in the request.

400

ERROR_INVALID_UID

An invalid or missing user id (uid) was given as a parameter in the request.

400

ERROR_INVALID_DEVICE_ID

An invalid or missing unique device identifier (device_id) was given as a parameter in the request.

400

ERROR_INVALID_IP

An invalid IP address (ip) was given as a parameter in the request.

400

ERROR_INVALID_TIMESTAMP

An invalid, expired or missing timestamp was given as a parameter in the request.

400

ERROR_INVALID_LOCALE

An invalid or missing language (locale) was given as a parameter in the request.

400

ERROR_INVALID_CATEGORY

An invalid or non-existing category (offer/mobile_types) was given as a parameter in the request.

400

ERROR_INVALID_ITEMID

An invalid or missing itemid was given in the request.

401

ERROR_INVALID_HASHKEY

An invalid or missing has hashkey for this appid was given as a parameter in the request.

500

ERROR_INTERNAL_SERVER_ERROR

An unknown error happened on the Fyber server.

After successful request HTTP 200 OK, the response body will contain the offers in the format you chose upon requesting.

Fyber will either respond with JSON or XML for a successful response depending on the format. Both formats follow the same structure, detailed in the following, with examples for both formats.

Response Elements
Explanation

response

The complete response will be wrapped inside this element.

code

The code represents the general outcome of your request. See the table below for more details about all possible response codes. This code will be especially helpful during integration and for debugging.

message

This element contains a more humanly readable explanation of the general outcome of your request, helping you to quickly identify possible problems.

Note: Don’t use this element message to evaluate the response of your request, as we may change the texts over time. Only use the above mentioned element code for this.

count

This element contains the total number of offers available, depending on the parameters of your request.

pages

If there are more offers available than the amount that Fyber is responding with to a single request, this parameter will indicate how many more pages of results are available. You can then issue additional requests using the optional parameter page to request all the remaining offers.

information

This element contains basic information about the application and offers that are being returned, see below.

app_name

The title of the application as entered in the Fyber Publisher Control Panel.

appid

The application id used by Fyber to identify your specific application. You can find your ID in the Fyber Publisher Control Panel in the ‘Integration’ section of your application. This element should match the parameter appid of your request.

virtual_currency

The name of your currency as entered in the Fyber Publisher Control Panel. This element represents the country of the user, which Fyber derives from the IP given in the request (via parameter ip). The offers returned are all targeted to users from this country.

language

This element represents the language used to describe the offers (e.g. the required actions) and should match the locale parameter of your request.

support_url

This element represents the customer support URL specific to your app.

offers[]

This element contains an array of offers returned. Each offer contains more detailed information, as seen below.

link

This element represents the URL that the user should be sent to upon selecting this offer.

Note: Please open the link in the system browser instead of a web view, as some offers don’t work within the context of a web view.

offer_id

An identifier of the offer in case you need to identify returned offers across requests.

titleteaser and required_actions

These elements describe the offer as well as giving a description of the steps needed to complete the offer. If there is no offer specific description available, the element teaser will contain the same content as the element required_actions.

thumbnail

This element contains URLs to the image used for the offer. Both a high resolution (hires) and a low resolution (lowres) version of the image are included.

offer_types[]

This element contains a list of one or more offer_types attributed to this offer, both as offer_type_id as well in a human readable format (using the language requested via the locale parameter). A list of all offer_types can be found below.

payout

This element contains the amount of virtual currency paid out to the user upon completion of the offer. It is calculated using the money payout and the exchange rate setup for your application in the Fyber Publisher Control Panel.

time_to_payout

This element contains the amount of seconds a user normally has to wait until the payout is finished after completing an offer, both in the numerical representation as well as in a human readable format (using the language requested via the locale parameter). If the time to payout is unknown, the element will contain “N/A” as a string.

Signed Response

To ensure the integrity and validity of the response, Fyber adds a special security parameter to the HTTP response header. It is called X-Sponsorpay-Response-Signature,and is created by using rules similar to those for the request signature. 

Rules

  1. Concatenate the full response body with your API key.
  2. Hash the whole resulting string using SHA1.
 

Example Header

X-Sponsorpay-Response-Signature: 96cf9acc1c1d1800ba8aa1e095e3a032ec49bca3

Warning!

The use of this parameter is optional but we strongly recommend that you evaluate it on your side to prevent anyone from tampering with any responses sent to you.

Time to handle the rewarding aspect.

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