Pass complex parameters to a Mendix REST service

0
Hi all, I've configured a published REST service in my project that accepts data from the consumer using POST and writes to the database. So far, I am able to accept primitive parameters by means of a transient object with corresponding attributes. However, I wish to pass an object (such as JSON payload) as a parameter to the service. I'd like to know two things, if possible: How do I setup my data model to receive both kinds of parameters? Is it as simple as creating a separate entity with attributes matching the complex parameter and associating it with the entity that has the primitive ones? On the consumer end, how might I pass both primitive and complex parameters to the REST service from JS? The service is being invoked via URL, but how do I place the complex parameter on the URL? I'm aware of the AJAX jquery function's 'data' attribute that can be used to pass values to the service. But this ultimately still results in the values being passed as URL parameters. Any help I can get on this would be greatly appreciated guys!!
asked
1 answers
1

Sounds like you've got part 1 covered based on this post.

For part 2, calling a REST service from JS: you need to make a POST request from JS, something like this question from StackOverflow. That answer uses pure JavaScript. If you're using a JS library like jQuery, I'd recommend simply googling for "REST post" and your library. The code is typically less complicated when using a library.

answered