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:

static NSString* const publisher_Id = @"32740";
static NSString* const adwall_Id = @"2074";
static NSString* const subId_1 = @"demo_subid1"; 

// 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)
     
[AdscendMediaWrapper getOfferList:publisher_Id adWallId:adwall_Id subId1:subId_1 offset:0 success:^(NSArray *offerList, BOOL moreAvailable) {
         
         for(NSDictionary *offerDict in offerList)
         {
             // Do the processing for each offer
         }
     
     } failure:^(NSString *error) {
         // Failure
     }];

The offerList array will have the list of offers. It is a list of dictionaries with each dictionary having following format:

{
    "category_id" =     (
        17,
        18,
        19
    );
    "click_url" = "https://stage.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";
}

Getting Market Research Surveys

Following is the sample code for getting market surveys from the AdscendMedia server:

Following is the sample code for getting market surveys from the AdscendMedia server:

static NSString* const publisher_Id = @"32740";
static NSString* const adwall_Id = @"2074";
static NSString* const subId_1 = @"demo_subid1";

//productId - @"4" or @"10";
// @"4" is for surveys on offer wall profile
// @"10" is for surveys on mr profile
     
[AdscendMediaWrapper getSurveyListForPubId:publisher_Id profileId:adwall_Id subId1:subId_1 productId:@"4" success:^(NSArray *surveyList) {
         
         for(NSDictionary *surveyDict in surveyList)
         {
             // Do the processing for each survey
         }
     
     } notFound:^{
         // Not found
     } failure:^{
         // Failure
     }];

The surveyList array will have the list of market surveys. It is a list of dictionaries with each dictionary having following format:

{
    campId = 45003;
    "click_url" = "https://stage.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";
}

Getting Transaction History

Following is the sample code for getting transactions from the AdscendMedia server:

[AdscendMediaWrapper getTransactionListForPubId:publisher_Id adWallId:adwall_Id subId1:subId_1 success:^(NSArray *transactionList) {
     
         for(NSDictionary *transactionDict in transactionList)
         {
             // Do the processing for each transaction
         }
         
     } failure:^{
         // Failure
     }];

The transactionList array will have the list 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;
}