Trouble executing report with parameters via REST

Options
Belmont
edited February 11, 2022 in Analytics #1
<p>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:</p>
<p> </p>
<p>{"ParameterValue":[{"Name":"beginDate","Value":"2017/06/29"},{"Name":"endDate","Value":"2017/06/30"}]}</p>
<p> </p>
<p>But, if I pass this in as a part of my own URI, it doesn't work. I've tried the following:</p>
<p> </p>
<p>&paramValues={\"ParameterValue\":[{\"Name\":\"beginDate\",\"Value\":\"2017/06/29\"},{\"Name\":\"endDate\",\"Value\":\"2017/06/30\"}]}</p>
<p> </p>
<p>And </p>
<p> </p>
<p>&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 </p>
<p> </p>
<p>And I've also tried doing this:</p>
<p> </p>
<p>var str = "{\"ParameterValue\":[{\"Name\":\"beginDate\",\"Value\":\"2017/06/29\"},{\"Name\":\"endDate\",\"Value\":\"2017/06/30\"}]}";</p>
<p> </p>
<p>var validStr = encodeURIComponent(str);</p>
<p>Then having my URI be:</p>
<p>uriVisuals + '/' + runAndSaveReportId + '/execute' + '?authId=' + authId + '&paramValues=' + validStr</p>
<p> </p>
<p>And that didn't work either.</p>
<p> </p>
<p>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.</p>