ios - Map url parameters to objects using RESTKit -
is there way map parameters in url results?
i got rest service user can search id. path search/:id
results contains name , other properties not id.
i this:
nsarray *array = mappingresult.array; (item *item in array) { [item setid:itemid]; }
but hope there nicer way...
thanks hints
xean
you want use path pattern specify in response descriptor. want use routing (rkroute
) , metadata during mapping. metadata includes routing section gives access parameters extracted url path.
some info on metadata here (the docs little lacking).
in mapping want use:
@metadata.routing.parameters.id
as mapping source key path.
to make routing work need add route object manager:
[manager.router.routeset addroute:...
and need make request in way means route used, getobjectsatpathforroutenamed:object:parameters:success:failure:
.
Comments
Post a Comment