Create a Rest API with Parent Fields to associate

Hi, I want to post this json object { “customer_id” = Parent customer id “customerLocation_id” =  Customer Location ID “customerLocation_Name” = Customer location name }   When i generate a REST Api it only provides me the field of the table itself and i do not get an attributed to pass the primary key or other reference id’s to it. I am looking for this in the forums and help but i am kind of lost so far if any one can help me will be great.
1 answers

I would suggest you’d first create your domain model in Mendix. Then you can easily create a REST api for it.

For example, by clicking the entity, and select ‘Expose as REST service’. Mendix will now create all the neccesary microflows, mappings, message definitions etc.

You can then extend the JSON, by extending the Message Definition

And then, you can extend the ImportMapping (via Selec elements), to also include the parent and Location


If you then run your app locally, and go to localhost:8080/rest-doc/ you can see the Swagger documentation. There, you can see what your JSON should look like for this REST service