0
votes

I want to use RestKit to consume a web service.

My collections end point returns something like this.

{
    "meta": {
        "limit": 20, 
        "next": "...", 
        "offset": 0, 
        "previous": null, 
        "total_count": 23
    }, 
    "objects": [
        "..."
    ], 
    "requested_time": 1396875600.810225
}

The key "objects" can return an array of one of many types of elements. But always the same for a given collection.

How can I map this response with the ObjectManager?

1
How do you know the type? The request path? The response content? - Wain
The type is by the request path. Example, if I request /users/ then objects contains only users, if I request /resources/ I get only resources - Tiago Veloso

1 Answers

0
votes

The complete your object manager configuration you create a number of response descriptors. These descriptors match against path patterns of the response URL and include the mapping to be used to process the response content.

In this way you will have a different response descriptor for each path pattern which returns different content and the linked mapping will instruct RestKit on what type of object to create and how top populate it.