Consume REST Service Questions

1
I have a couple of newbie questions about consuming a REST service. I receive the following JSON in Mendix in response to a GET request: My questions are: For the JSON outlined in red, this is modeled in my domain model as a 1 to many association, However, no properties objects are created when I retrieve this. Looking at the JSON, it is a Name/Value pair format, different than say the identities information further down in the JSON. Any pointers on how to successfully model and import this into Mendix? For the property highlighted in yellow, I have an entity in my domain model called Contact and one called IdentityProfile. The association between these is called identity_profiles, since I cannot use a - (dash) in the association name. However, I received an error when trying to import that. There is a good description in the REST module documentation regarding how to import attributes with reserved or illegal names, but I didn't see similar documentation regarding association names. Am I missing something? Thanks in advance, Mike
asked
1 answers
0

Mike,

For the associations the working of the module is the same as for the attributes, In one project I have a reference that starts with a $-sign. In this case I created the association as name and then use the _namejsonkey construction.

The part in red seems more difficult. What I did for one project is to get the json as string and then do some manipulation of the json string and then perform the deserialization. Then you could turn the properties part into something that can be imported as a name value pair or an object with 4 attributes in the case you posted. Hope this gets you further in solving this.

answered