Reputation: 15094
I am trying to send a POST request using ios Restkit. I can perform a GET, but cannot find how to send a POST.
My current code looks like the following:
RKURL *URL = [RKURL URLWithBaseURL:[objectManager baseURL] resourcePath:@"/users/sign_in.json" queryParameters:params];
[objectManager loadObjectsAtResourcePath:[NSString stringWithFormat:@"%@?%@", [URL resourcePath], [URL query]] delegate:self];
Apparently, this performs a GET. Any idea what I should add to make it a POST?
Thanks!
Upvotes: 1
Views: 767
Reputation: 6692
You can configure your RKRequest with:
[request setMethod:RKRequestMethodPOST];
Upvotes: 1
Reputation: 10633
To answer your question (regardless of the above discussion) you can do the following:
[objectManager loadObjectsAtResourcePath: @"path" usingBlock: ^(RKObjectLoader *loader) {
loader.HTTPMethod = RKRequestMethodPOST;
}];
Upvotes: 0