publish rest api - difference between generated microflows and recommended?
Hi, I have been looking through https://docs.mendix.com/howto/integration/publish-rest-service and that has an example of get by id which has a microflow which builds the httpResponse by exporting the db read to json, creating a httpheader. But the auto generated microflows (expose entity as rest in domain model) reads the db and just returns the list. No httpResponse. So are the auto generated operations a starting point? They work but are very different to the example in the docs. Can they be used “as is” or would that be dangerous. Also, I notice that some of the operations for a resource have a return of “nothing” but there appears to be no way of changing that ie it is not a drop down list. What triggers that set up in the screen?
The autogenerated microflows are working skeletons that can be enhanced with custom logic if required.
Using the export mapper to generate xml or json as shown on the documentation page is not needed, it’s better to just return the list. The platform will then ensure xml or json is generated based on the format requested by the client (content negotiation using the Accept http header). Also removes the need to handle this with the response headers.