Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 80922

Pass an array of strings to Mendix REST service via JQuery

$
0
0

Hi all,

I've been trying to pass to my Mendix rest service a list of string values. I did some research and saw that [t]o be able to map a list of String-/Float-/Boolean values, you need to set a many to many association to the Primitive entity in your RestServices module, or a subclass of the Primitive entity. However, after I've done that, the values don't seem to register. I'm not getting any errors, but the values just aren't accessible in my microflow when I make the request to the REST service.

Here's how I've setup my entities to match the REST request:

Here's my jQuery code that makes the request to the REST service on localhost:

$.ajax({   url: 'http://localhost:8080/rest/getproducts/',   method: 'GET',   data: {      q: 'Test',      productsGUIDs: ['58828270132528344','58828270132528345'],   },
}).then(function(data) {   console.log(data);
});

I've already tried changing the content-type attribute of the .ajax jquery call to JSON, but to no avail. I've also tried using JSON.stringify on the object before passing it through the data attribute.

 

The microflow exposed as 'getproducts' simply serializes the input object to JSON and returns the resulting string. This is done just so I can see if the values are being registered on the Mendix end. But I keep getting back the following string, which tells me that the values aren't being interpreted for some reason:

{  "q": "Test",  "productsGUIDs": [],
}

Here's a snapshot of the exposed microflow:

 

Can anybody help me understand what I might be doing wrong? I need this functionality for an important app update.


Viewing all articles
Browse latest Browse all 80922

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>