Question

I've set up a response descriptor like this:

RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:exhibitMapping method:RKRequestMethodAny pathPattern:@"?json=exhibits/get_exhibits" keyPath:@"d.exhibits" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

And made the request like so:

[[RKObjectManager sharedManager] getObjectsAtPath:@"?json=exhibits/get_exhibits" parameters:nil success:

But I get this error:

2014-03-17 11:14:39.856 MuseumMap[6135:60b] E app:ExhibitTableViewController.m:49 Load failed with error: Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." UserInfo=0x8fb69f0 {NSErrorFailingURLStringKey=http://exhibits.wpengine.com/?json=exhibits/get_exhibits, NSLocalizedFailureReason=A 200 response was loaded from the URL 'http://exhibits.wpengine.com/?json=exhibits/get_exhibits', which failed to match all (1) response descriptors:
  <RKResponseDescriptor: 0x9480270 baseURL=http://exhibits.wpengine.com/ pathPattern=?json=exhibits/get_exhibits statusCodes=200-299> failed to match: response path '?json=exhibits/get_exhibits' did not match the path pattern '?json=exhibits/get_exhibits'., NSLocalizedDescription=No response descriptors match the response loaded., keyPath=null, NSErrorFailingURLKey=http://exhibits.wpengine.com/?json=exhibits/get_exhibits, NSUnderlyingError=0x8fb6990 "No mappable object representations were found at the key paths searched."}

My thought is that there is a problem matching because of either the ? or the = in the pathPattern but I've tried escaping those and it doesn't seem to make a difference. Anyone have any ideas why this wouldn't match? The error message being response path '?json=exhibits/get_exhibits' did not match the path pattern '?json=exhibits/get_exhibits'. seems a bit off.

Was it helpful?

Solution

The problem was with the way the URL was formed. I changed my site to use permalinks instead of the ?json query parameters and that seemed to work. The path matching eliminates the query parameters before it matches so those cannot be used to match in restkit.

http://wordpress.org/plugins/json-api/other_notes/#1.1.-Requests

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top