Reputation: 715
I´m trying to access a web service from my iOS application. In the documentation it says that I should use a query string to pass the parameters but I´m not sure on how to use this.
I using the AFNetworking framework. Made a POST request earlier and it worked just fine, but not sure on how to write and pass a query string.
Upvotes: 2
Views: 2290
Reputation: 70155
The 'query string' is produced by AFNetworking. Just use the getPath:parameter:... method and provide the parameter dictionary. Make sure the dictionary has a key for each of the query names required by the web service.
For example:
[client getPath: @"transactions"
parameters: @{ @"api_key" : ksomeAPIKey,
@"user_id" : user_id }
...]
will be converted, by AFNetworking, to:
GET <baseURL>/transactions?api_key=...&user_id=...
Upvotes: 7