Note that there are some explanatory texts on larger screens.

plurals
  1. POposting array of dictionaries with Restkit 0.20
    primarykey
    data
    text
    <p>Im having issues getting this to function correctly.</p> <p>I have mapped the key value pairs of my JSON payload that I would like to inject into the request but I end up with a failure on each post.</p> <p>The following lines show me creating the reqeust:</p> <pre><code>RKObjectMapping *requestMapping = [WDMappingProvider createRegInitRequestTicketMapping]; RKRequestDescriptor *requestDescriptor = [RKRequestDescriptor requestDescriptorWithMapping:[requestMapping inverseMapping] objectClass:[WDTicketsModel class] rootKeyPath:nil]; [registrationManager addRequestDescriptor:requestDescriptor]; </code></pre> <p>I then create my path to post to and put in the data to my post request:</p> <pre><code>//Make object from params WDRegistrationInitializeRequestModel *requestModel = [[WDRegistrationInitializeRequestModel alloc] init]; requestModel.eventID = [params objectForKey:@"eventID"]; requestModel.arrayOfTicketDictionaries = [params objectForKey:@"arrayOfTicketDictionaries"]; NSString *postPath = [NSString stringWithFormat:@"api/v1/registrations/initialize?eventid=%@", requestModel.eventID]; //Post the object (aka the interest json payload) [registrationManager postObject:requestModel.arrayOfTicketDictionaries path:postPath parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *result){ ... </code></pre> <p>At this point I always end up in the Failure block of the postObject method.</p> <p>My mapping that is made by the [WDMappingProvider createRegInitRequestTicketMapping] looks like this:</p> <pre><code>+(RKObjectMapping *)createRegInitRequestTicketMapping { RKObjectMapping *regInitRequestMapping = [RKObjectMapping mappingForClass:[WDTicketsModel class]]; [regInitRequestMapping addAttributeMappingsFromDictionary: @{ @"Quantity" : @"quantity", @"TicketID":@"mainID" }]; return regInitRequestMapping; } </code></pre> <p>The arrayOfTicketDictionaries looks like this:</p> <pre><code>[{"Quantity":1,"TicketID":1604},{"Quantity":1,"TicketID":1605},{"Quantity":1,"TicketID":1606}] </code></pre> <p>Any thoughts?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload