문제

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.

도움이 되었습니까?

해결책

'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...).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top