AlejoVinueza AlejoVinueza - 1 year ago 137
iOS Question

Restkit url mapping in POST

I want to POST this URL documents/:ID/resend
and body request

"email": ""

and response

"code": "123",
"message": "foo"

I did my request and respond descriptors and this route:

RKRoute *documentResendRoute = [RKRoute routeWithClass:[LDocument class]

and when I'm posting the document object

[[RKObjectManager sharedManager] postObject:self
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
//success code
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
//failure code

Restkit doesn't map the :ID in the URL. It should result something like this "documents/880/resend" but at logs I can see "documents/:ID/resend" and the call fail.

LDocument has the ID property.

What did I miss? or How should I do this?

Thanks, Alejandro

Answer Source

When you call postObject you shouldn't be specifying the path, if you do this the router won't be used and the parameter not injected. Just set the path to nil.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download