1

Is there a model API I can watch/try, that has the easiest integration with RestKit (using the most defaults)? I'm talking about the JSON format (having a root or not, nested objects, etc) and the expected answer after a POST for example...

Agustin
  • 433
  • 5
  • 14

1 Answers1

1

The best resource I could find is this writeup here that teaches by example:

https://github.com/RestKit/RestKit/blob/master/Docs/Object%20Mapping.md

It would seem the basic format to represent a record from your model is something like:

{
    "recordType": {
        "attribute1": "value1",
        "attribute2": "value2",
        "attribute3": "value3"
    }
}

and if you have a collection of records, use Javascript array, like this: [ {...}, {...} ]

The writeup also suggests this form, which is:

{
    "recordType": [
        {
            "attribute1": "value1",
            "attribute2": "value2",
            "attribute3": "value3"
        },
        {
            "attribute1": "value1",
            "attribute2": "value2",
            "attribute3": "value3"
        }
    ]
}

I guess you can map both ways.

This question may be helpful: JSON format inconsistency

Community
  • 1
  • 1