Bluedot Tempo,
Android SDK version 15.3.0,
iOS SDK version 15.4.0 &
Canvas & Config API
released.
Details here.
Public API – iOS DELETE Fence
The following code demonstrates the deletion of a fence.
For the code below, the Customer API Key is stored within a singleton Configuration
object.
/* * Send the URL request with the required method for processing. * The Customer API Key is stored in a shared singleton object. */ + (void)sendDeleteFence: (NSString *)fenceId inZone: (NSString *)zoneId { // Retrieve all existing zones for this app id NSString *apiDeleteFence = [ NSString stringWithFormat: @"https://api.bluedotinnovation.com/1/fences?customerApiKey=%@&zoneId=%@&fenceId=%@", Configuration.instance.customerApiKey, zoneId, fenceId ]; NSURLSession *session = [ NSURLSession sharedSession ]; // Ensure that the command string is escaped properly for use in HTTP NSString *escapedQuery = [ apiDeleteFence stringByAddingPercentEncodingWithAllowedCharacters: [ NSCharacterSet URLQueryAllowedCharacterSet ] ]; NSMutableURLRequest *request = [ NSMutableURLRequest requestWithURL: [ NSURL URLWithString: escapedQuery ] ]; [ request setHTTPMethod: @"DELETE" ]; // Create an asynchronous connection; this will utilise App Transport Security (ATS) to an https connection is required NSURLSessionDataTask *task = [ session dataTaskWithRequest: request completionHandler: ^( NSData *data, NSURLResponse *response, NSError *error ) { if ( error == nil ) { if ( [ data length ] > 0 ) { // Retrieve the response as a dictionary containing the JSON NSDictionary *jsonResponse = [ NSJSONSerialization JSONObjectWithData: data options: 0 error: nil ]; // Ensure that the response code from the Public API is for a successful transaction if ( ( ( NSString *)jsonResponse[ @"messageCode" ] ).intValue != 200 ) { NSLog( @"Delete fence error:\n%@", jsonResponse ); } } } else { NSLog( @"Delete fence error: %@", error ); } } ]; // Start the URL session task [ task resume ]; }
Created by Bluedot DevOps on March 5, 2018
Start the discussion