Unity SDK
API Wrapper Functions
The SDK provides wrapper functions for the following API calls for your convenience: get offers, get surveys and get transactions.
Getting Offers
Following is the sample code for getting offers from the AdscendMedia server:
string publisherId = "32740"; string adwallId = "2074"; string subId1 = "demo_subid1"; //offset = 0 // offset - offset index from which offers are to be retrieved (e.g. offset = 0 will return all offers starting from index 0 and offset = 20 will return offers starting from index 20) //you cannot pass anything but the internal property 'name' as first parameter otherwise callbacks won't work AdscendMedia.getOffers (name, publisherId, adwallId, subId1, 0);
Callbacks
To get the callbacks you need to implement the interface methods:
public void getOffersResponseSuccess (string result) { Debug.Log ("getOffersResponseSuccess => " + result); }
The result will be json string of offers. It is a list of dictionaries with each dictionary having following format:
{ "category_id" = ( 17, 18, 19 ); "click_url" = "https://adscendmedia.asmclk.com/click.php?aff=102784&camp=116728&from=4346&prod=4&sub1=23&prod_channel=3&device=F31FC43C-A9D6-49B0-94F9-EA73A8BE1005&xt=dyiBHvSsikEs0MCY4lwnAKru9AQKdIFmPaOGHno83R%2FGkDHi%2F0eygNaUQmAJt%2FFVe1cDEX54tEm%2FPaIn8e5KBw%3D%3D%3AVIaTlx4%2F1LX5gmlcEI4NMg%3D%3D"; "conversion_rate" = ""; "creative_filename" = ""; "creative_id" = ""; "creative_url" = ""; "credit_delay" = 0; "currency_count" = 100; description = "Rewarded video offer"; epc = ""; "featured_global" = 1; "featured_profile" = 0; "image_url" = ""; "matches_target_system_detected" = 1; "mobile_app" = { platform = 1; "store_id" = "com.bsb.hike"; }; name = "Rewarded video offer"; "offer_id" = 116728; payout = "0.1"; "payout_custom" = 0; "rating_count" = 1859803; requirements = ""; "stats_pending_ce" = 1; "target_system" = 0; "testing_status" = 0; "testing_time" = "0000-00-00 00:00:00"; }
public void getOffersResponseFailure (string failureMsg) { Debug.Log ("getOffersResponseFailure => " + failureMsg); }
Getting Market Research Surveys
Following is the sample code for getting market surveys from the AdscendMedia server:
string publisherId = "32740"; string adwallId = "2074"; string subId1 = "demo_subid1"; //you cannot pass anything but the internal property 'name' as first parameter otherwise callbacks won't work //ProductId = "4". // "4" is for surveys on offer wall profile // "10" is for surveys on mr profile AdscendMedia.getSurveys (name, publisherId, profileId, subId1, "4");
Callbacks
To get the callbacks you need to implement the interface methods:
public void getSurveysResponseSuccess (string result) { Debug.Log ("getSurveysResponseSuccess =>" + result); }
The result will be json string of market surveys. It is a list of dictionaries with each dictionary having following format:
{ campId = 45003; "click_url" = "https://adscendmedia.asmclk.com/click.php?aff=102784&camp=45003&from=4346&prod=4&sub1=23&prod_channel=3&device=92D64400-4BC3-42C4-B376-DE4CB3876E32&xt=iWNGlbuv2u5TsVFpUXUyypsrSHsdlqumcBZs2JcCMg3Dody6OnfHUCmJ72BSW9eTCeArkyOPU2Vfo2oUzX495VQPFplfzPeUhTzuTAIvJE%2BSdI7c%2F7FvxL1FiTyX90p3PTp4zvHXdwx0lq21cbi%2B3PgZrduiyE4BGmpdS0H89dMEHDvGPh4YnqSzoPlEtfzjHgVYntAvdAtEejUEp59WM3AKZxKEGB6gMQD5M%2F3vAfph%2FBGcXSah1Ov2zcFta1u6WNU9t1FimC0Pt2QSnGSwgVmrVzutNIOTPEBgxzC63TReM0rhCVHDP5H4%2FgAd6G4QT6yCruaAXhx2y7JSAVKuhZzjTq7qLscFNYMzUrOTTlQsK9azl2xyFmmQbfP2w9M7%3Ad%2B0EHVWa1CtA72%2B2hNQC3g%3D%3D"; "currency_count" = "1687.5"; minutes = 10; name = "High Paying Survey"; payout = "1.6875"; }
public void getSurveysResponseNotFound () { Debug.Log ("getSurveysResponseNotFound"); }
public void getSurveysResponseFailure (string failureMsg) { Debug.Log ("getSurveysResponseFailure =>” + failureMsg); }
Getting Transaction History
Following is the sample code for getting transactions from the AdscendMedia server:
string publisherId = "32740"; string adwallId = "2074"; string subId1 = "demo_subid1"; //you cannot pass anything but the internal property 'name' as first parameter otherwise callbacks won't work AdscendMedia.getTransactions (name, publisherId, adwallId, subId1);
Callbacks
To get the callbacks you need to implement the interface methods:
public void getTransactionsResponseSuccess (string result) { Debug.Log ("getTransactionsResponseSuccess =>" + result); }
The result will be json string of transactions. It is a list of dictionaries with each dictionary having following format:
{ "currency_adjustment" = 20; description = ""; "offer_id" = 116868; "offer_name" = "RV test offer #5000"; timestamp = "2016-08-23T05:01:54-0500"; "transaction_id" = 2786662; }
public void getTransactionsResponseFailure (string failureMsg) { Debug.Log ("getTransactionsResponseFailure =>" + failureMsg); }