I’m using OAuthConsumer framework/helper classes to comunicate to RESTful webservices. I have the OAuth dance solved 🙂 but I have some functions that requires array parameters.
I’m setting parameters so
OARequestParameter *p0 = [[OARequestParameter alloc] initWithName:@"key"
value:@"value"];
NSArray *params = [NSArray arrayWithObjects:p0, nil];
OAMutableURLRequest *request = [[OAMutableURLRequest alloc] initWithURL:url
consumer: [MyOAUthAppDelegate sharedAppDelegate].consumer
token:[MyOAUthAppDelegate sharedAppDelegate].accessToken // we don't have a Token yet
realm:nil // our service provider doesn't specify a realm
signatureProvider:[[OAHMAC_SHA1SignatureProvider alloc] init]]; // use the default method, HMAC-SHA1
[request setHTTPMethod:@"POST"];
OADataFetcher *fetcher = [[OADataFetcher alloc] init]; //
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(requestTokenTicket:didFinishRESTWithData:)
didFailSelector:@selector(requestTokenTicket:didFailTESTWithError:)];
But the WS is returning “Only arrays accepted”.
My specifications says something like:
REST (POST parameters)
params[xxx]= int
params[yyy]= int
I think that this would be quite easy in PHP or Javascript, but I don’t know how to send an Array parameter from an iPhone request, specifically using OAuthConsumer objects :S
I got it adding parameters like these: