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