DarkLeafyGreen
DarkLeafyGreen

Reputation: 70416

Restkit, put parameters in path

I want to consume this api endpoint

.../country/search/{query}

another way would be

.../country/search?query={query}

however the api does not support that. How can I support the first style with restkit and not violate the path pattern?

pathPattern:@"/country/search/"

is not recognized by

getObjectsAtPath:[NSString stringWithFormat:@"country/search/%@", query]

so restkit fails to load the correct mapping.

Upvotes: 3

Views: 493

Answers (1)

Wain
Wain

Reputation: 119031

Set your path pattern to:

pathPattern:@"country/search/:query"

See sockit for a description of hoe the path pattern matching works.

Also, ensure that your leading slashes match.

Upvotes: 5

Related Questions