Exposing a list of object through the RESTfull API
2
I'm trying to expose a list of categories that belong to a book over the RESTful module. The case is as follows. There's a BookView entity that has a many to many relationship to a CategoryView entity (https://www.dropbox.com/s/s5smv3hyo4ydtj2/domain.PNG?dl=0). The CategoryView entity has two attributes IdCategory and Name. In the API I'm trying to expose the bookView with a list of the categories that belong to the book. We're using the DataServiceDefinition to expose the BookView entity and are using the following microflow to create BookView objects for the index. (https://www.dropbox.com/s/dm7ziym3byg61pg/microflow.PNG?dl=0) For some books it's working and I'm getting the following response: { "Status": true, "Subtitle": "Is a nice book", "BookView_CategoryView": [ { "IdCategory": 1, "Name": "Thriller" }, { "IdCategory": 2, "Name": "Comedy" } ], "ISBN": 2345678, "Summery": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incidi", "IdBook": 2, "Author": "Farah Lourens", "Title": "Killerbody", "Publisher": "Lijster uitgevers", "CoverImagePath": null } For some books the category doesn't get filled up properly. The problem why it doesn't get filled up is because the non persistable categoryView object does not seem to exist when the index tries to save it. (https://www.dropbox.com/s/8bihozgkmtsj8t0/error.PNG?dl=0). Code reference, https://github.com/mendix/RestServices/blob/master/javasource/restservices/util/JsonSerializer.java#L77. The error is triggered after the 'end event' in the microflow. We have tried many aproaches but feel that this should work. Are we missing something?