KnowageLabs/Knowage-Server

parameterized REST request is not working

JeffJochems opened this issue · 3 comments

Issue
When contructing a REST dataset, I would like to use a paramter in my request body.
According to the documentation, this is possible with the standard syntax $P{parameter_name}. When doing so however, knowage does not respond as expected.
It either produces an error when the (number) parameter is passed literaly in this way e.g. {"year":$P{year}}: 400 Bad request
Or, when the parameter is passed as a string, it results in knowage sending a request with $P{parameter_name} directly to the API. E.g. when sending {"year":"$P{year}"}, my API recieves {"year":"$P{year}"}.

How to reproduce
To reproduce this, let's use the publicly available API: dummy.restapiexample.com

  1. Create a knowage dataset with a non paramterized request body for the example API [screenshots 1,2]
  2. The preview results in the correct API response [screenshot 3]
  3. Set the paramter in Knowage and parameterize the request body with "$P{paramter_name}" [screenshot 4,5]
  4. See the hardcoded string sent to the API with preview [screenshot 6]

Expected behavior
When using a parameter in the request body it should result in the same response as when these parameters are specified explicitly. (Screenshot 6 should be the same as screenshot 3)

Screenshots
Screenshot 1 and 2:
ex_1
ex_2

Screenshot 3:
ex_3

Screenshot 4 and 5:
ex_4
ex_5

Screenshot 6:
ex_6

The error i recieve when trying to post a numerical parameter is:
ex_7

Hi @JeffJochems, it's a known problem and I have an assigned issue about it in our internal tracker. Actually, i don't know when I will have time to schedule the fix, I hope to work on it before September.

This issue is stale because it is related to an old version or it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

This issue was closed because it has been stalled for 5 days with no activity.