Reputation: 562
I have the following code:
NSString *url = @"http://mysite.com"
RKURL *baseURL = [RKURL URLWithBaseURLString:url];
objectManager = [RKObjectManager objectManagerWithBaseURL:baseURL];
objectManager.client.baseURL = baseURL;
objectManager.serializationMIMEType = RKMIMETypeJSON;
NSString *token = @"Token is getting from rest API"
[[objectManager client] setValue:token forHTTPHeaderField:@"token"];
RKClient *client= [objectManager client];
RKRequest * therequest = [client requestWithResourcePath:@"/create"];
[therequest setHTTPBodyString:@"{user:user}"]; //Here receive a JSON value
[therequest setMethod:RKRequestMethodPOST];
[therequest setDelegate:self];
[therequest send];
This code works fine... but I have a problem, I need to send to Rest API a JSON object (like String) and I have a RKObjectMapping with the values that should be sending to Rest Api.
It is possible convert a RKObjectMapping to JSON?
Upvotes: 0
Views: 192