$ curl https://api.geoloqi.com/1/group/message/d6Qwh1eSy \
-H "Authorization: OAuth 152a5-2c91e9335da92345ef48f7bc45c17272a40abf52" \
-H "Content-type: application/json" \
-d '{"push": true, "text": "Hello everyone!"}'
I'm attempting to translate this for use with the iOS SDK, and there aren't any examples of how to add the access token in the documentation. The closest I've gotten so far (thanks to some code in DinoDeals) is this:
// send a message to all the users in the group NSMutableDictionary *params = [[NSMutableDictionary alloc] init]; [params setObject:[NSNumber numberWithBool:true] forKey:@"push"]; [params setObject:@"Hello everyone!" forKey:@"text"];
NSMutableURLRequest *request = [[[LQSession savedSession] requestWithMethod:@"POST" path:@"/group/message/d6QwhleSy" payload:params] mutableCopy]; [request setValue:[NSString stringWithFormat:@"OAuth %@", [LQSession savedSession].accessToken] forHTTPHeaderField:@"Authorization"]; [[LQSession savedSession] runAPIRequest:request completion:^(NSHTTPURLResponse *response, NSDictionary *responseDictionary, NSError *error) {
NSLog(@"Response to sending a message to the group: %@ error:%@", responseDictionary, error); }];
-----------
Is this a proper way to format this call? It seems right, but I'm getting a "You are not authorized..." response, so it's hard to tell.
thanks
It looks like you're new here. If you want to get involved, click one of these buttons!