I’m working with an API that only has POST calls. Create, edit, and delete. This is causing some problems with RestKit for editing and deleting.
Create works as expected. However, when I make an edit to an object it’s not saved to my device until I call a GET request again (that’s working as well). I’m assuming it’s because I’m not calling patchObject and deleteObject (instead I have to use postObject) and there is some Core Data magic happening in the background.
They API will be updated in the near future, but in the man time is there a way to trick the object manager to handle my POST requests differently?
This won’t be fun for you since RestKit adhere 100% to the REST concept. take a look at the code of RKObjectManager (here is the implementation). RKObjectManager is made to be subclassed, but I know Blake, the creator of RestKit, do a lot of conditioning depending of the type of the request sent, so tricking them to all POST looks dangerous to me.
What you could do is still using all the
postObject:,deleteObject:,patchObject:, etc. from RestKit but trick the call RK do toAFNetworking(the HTTPClient underlayer) to all POST.Take a look at
- (NSMutableURLRequest *)requestWithMethod:path:parameters:in RKObjectManager.Hope this help somehow!