Passing parameters via platform.api.get

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?

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

Try this:

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

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);
1 Like