Hi
I have set of Estimote beacons and I want to list them using Estimote clound APIs.I am using
curl -u API_USERNAME:API_PASSWORD “https://cloud.estimote.com/v2/analytics/visits/total?group_by=location”
It works well in the terminal.
However, in the ios app, it is returning ----“Payment Required”.
The code is following:
#define API_USERNAME @"xxxxxxx"
#define API_PASSWORD @"xxxxxxx"
NSURL *url = [NSURL URLWithString: [NSString stringWithFormat:@"http://%@:%@@cloud.estimote.com/v2/analytics/visits/total?group_by=location", API_USERNAME, API_PASSWORD]];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setURL:url];
[request setHTTPMethod:@"GET"];
[request setValue:@"Accept: application/json" forHTTPHeaderField:@"Content-Type"];
NSError *error;
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
NSString *ret = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"ret=%@", ret);
Thanks for helping.
Cheers,
Larina