I want to be able to receive a json response that consists of an array of data instead of a single object so I'm trying to use the getCollection function. The getCollection function is set up with parameters collectionUrl (type: String), resultList (type: List of RestServices.AnyObject), and firstResult (type: RestServices.AnyObject). The RestServices documentation that's available on github states "The resultList parameter should be a completely empty list, but of the same type as firstResult. The firstResult object will be used to story the first result in and should be a new, empty, transient object." I'm unsure as to how to set up an entity for this "new, empty, transient object." So for example, if I try setting up a non-persistable entity called TestData with attributes TestDataName and TestDataDescription so that this entity can be used to map an array of TestData, I'm still not able to use this as a parameter because it should be of type RestServices.AnyObject where let's say TestData is within a module called TestAPI so the type is TestAPI.TestData. The type RestServices.AnyObject technically is not any object and it seems it's not possible to have a parameter set up as a list of any objects within Mendix so changing the parameter settings hasn't helped either. If I try setting up an association between RestServices.AnyObject and this TestAPI.TestData, the array of data still doesn't seem to map correctly since RestServices,AnyObject doesn't even consist of the same attributes TestDataName and TestDataDescription that is to be saved within a TestData object. Am I calling the right function or is there a certain way of setting up an association between RestServices.AnyObject and TestAPI.TestData? If so, how should it be done so that the array of data is correctly mapped as a collection of the TestData?
Hi Vivian, you should select AnyObject as the generalization for TestData. You can do this by opening the TestData entity via your domain model and setting the generalization entity.
Willem van Zantvoort
Hi Vivian. Not trying to promote my blog since it is really there for me to remember what I do :), but I have a blog post about setting up a JSON request in Mendix. In particular, you'll want to use the 'DeserializeJSONtoObject' in the Community Commons after the GET (don't think you need the getCollection. You can see the write up at www dot nolanramsey dot com /blog/2015/2/23/how-to-create-an-api-call-using-rest-in-mendix