Trouble executing report with parameters via REST

I'm having some issues setting up the URI for calling a report design via REST. When using the Interactive REST API on port 5000, and calling POST /visuals/{visualId}/execute, I can pass in this as a paramValues parameter and it will work:


 


{"ParameterValue":[{"Name":"beginDate","Value":"2017/06/29"},{"Name":"endDate","Value":"2017/06/30"}]}


 


But, if I pass this in as a part of my own URI, it doesn't work. I've tried the following:


 


&paramValues={\"ParameterValue\":[{\"Name\":\"beginDate\",\"Value\":\"2017/06/29\"},{\"Name\":\"endDate\",\"Value\":\"2017/06/30\"}]}


 


And 


 


&paramValues=%7B%22ParameterValue%22%3A%5B%7B%22Name%22%3A%22beginDate%22%2C%22Value%22%3A%222017%2F06%2F29%22%7D%2C%7B%22Name%22%3A%22endDate%22%2C%22Value%22%3A%222017%2F06%2F30%22%7D%5D%7D 


 


And I've also tried doing this:


 


var str = "{\"ParameterValue\":[{\"Name\":\"beginDate\",\"Value\":\"2017/06/29\"},{\"Name\":\"endDate\",\"Value\":\"2017/06/30\"}]}";


 


var validStr = encodeURIComponent(str);


Then having my URI be:


uriVisuals + '/' + runAndSaveReportId + '/execute' + '?authId=' + authId + '&paramValues=' + validStr


 


And that didn't work either.


 


I would get an error that would basically tell me that my endDate isn't being set, which I assume that also means it can't read the beginDate either. Could anyone clarify what it is I could be doing wrong? I just find it odd that it works just fine when calling it from the interactive documentation, but not from the ajax call I set up. The call that I have set up works just fine when I call a report design that doesn't have any parameters at all, it's only when I have parameters that this issue occurs.


Sign In or Register to comment.