Passing parameters via platform.api.get


#1

Title just about sums it up. How can I pass GET data in a url through the platform.api.get call?

For example, running the getRecordsByFilter function through swagger on one of my tables will send the data to the correct table and include a “filter” member to the event request. I can also accomplish this by running a GET query using postman and using the /db/Sites?filter=FILTERSTR format.

What I cannot do is seem to do this with the platform.api.get call.
I’ve tried doing platform.api.get(‘db/Sites?filter=FILTERSTR’) which confuses the system into thinking that whole thing is my table name.

I’ve tried using platform.api.get(‘RDSdb/Sites’, JSON.stringify(params)) as well and that usually ends up with DSP trying to use my object as an id, which is obviously wrong.

What can I do to get this working?


#2

This appears to be a bug. We are looking into it.


#3

Try this:

platform.api.get(‘db/Sites’, {‘filter’:FILTERSTR})


#4

Here’s an example of a query I’ve built for server side scripting which works and might help with the syntax:

var queryString = 'foo';
var filter_data = {"fields": "myField" , "filter": "anotherField='" +queryString+ "'"};
var request = platform.api.get("sql/data_table",filter_data);