Group API calls from the iOS SDK? Token?
  • After successfully implementing the Geoloqi SDK location tracking in my current dev app, I'm experimenting with a few different communication mechanisms between users for the next phase of development. The latest thing I'm trying is push messages to a group but I'm confused by the use of the token. 

    My first experiment was to send myself a push message using /message/send, so I registered everything with Apple dev and Geoloqi and then put the app on my test device. It worked great. 

    I then created a group using this code run in the iOS Simulator [description changed]: 

    NSMutableDictionary *params = [[NSMutableDictionary alloc] init];


        [params setObject:@"My Special Group for Testing" forKey:@"description"];


        [params setObject:@"open" forKey:@"visibility"];


        [params setObject:@"open" forKey:@"publish_access"]; 


         


         NSURLRequest *r = [[LQSession savedSession] requestWithMethod:@"POST" path:@"/group/create" payload:params];


         [[LQSession savedSession] runAPIRequest:r completion:^(NSHTTPURLResponse *response, NSDictionary *responseDictionary, NSError *error) {


         NSLog(@"Response for creating My Special Group for Testing: %@ error:%@", responseDictionary, error);


         }];




    This returned the response [token changed]: 

    Response for creating My Special Group for Testing: {


        "group_token" = ab4NEKC0p;


    } error:(null)
     
    It worked! So far so good, right? But I'm stuck on how to get info, join, and eventually send messages using the token. I tried just getting info by hardcoding the token returned in the response like this:

    // now get info about the group 


        NSString* path = [NSString stringWithFormat:@"/group/info/:ab4NEKC0p"];


        NSURLRequest *r = [[LQSession savedSession] requestWithMethod:@"GET" path:path payload:nil];


        [[LQSession savedSession] runAPIRequest:r completion:^(NSHTTPURLResponse *response, NSDictionary *responseDictionary, NSError *error) {


            TFLog(@"Response for info about group My Special Group for Testing: %@ error:%@", responseDictionary, error);


        }];


    But I get a 404 in the response. 

    thx much. Still trying to get a hang of this part of the API
  • 3 Comments sorted by
  • Looks like you have an extra ":" in the URL. Try this instead: @"/group/info/ab4NEKC0p"
  • You're kidding. Hah, thank you. I guess I misunderstood the call syntax in the documentation. So that colon isn't actually included in the call, it's just to indicate the token value variable. Thanks, that explains a lot.

  • Yep, sorry about the confusion!

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion