Question

Is it possible to map the different objects to the same url and use different post params to differentiate between the return types?

My API isn't really rest. Everything flows through the same URL but has a parameter "Type" that differentiates the result that should be returned.

Était-ce utile?

La solution

'Probably' - it would be nice it you added a few examples to the question (requests and associated responses).

Sending the requests is fine, though you will need to explicitly specify the path / route name to use.

For the response, you will most likely need to use an RKDynamicMapping which will inspect the incoming data and return the appropriate mapping to use.

If you can't tell the 'type' from the response data (instead, you can only tell because of the URL that was requested) then you may need to try mapping into all types and rejecting invalid content using KVC validation, or you might want to change your data model (not enough information in the question to determine which...).

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top