You can translate the question and the replies:

HTTP Client given date in request

Hi! I need to query HTTP/JSON datasource with parameters like this: `/values?Name=Foobar&Start=2024-01-16&End=2024-01-17 (the previous and the current days)` so I create a Base view with relative URL like this: `/values?Name=Foobar&Start=@start&End=@end` and then I try to use functions for START and END variables, e.g: START: `FORMATDATE('yyyy-MM-dd', ADDDAY(now(), -1))` (Is this correct for yesturday??) END: `FORMATDATE('yyyy-MM-dd', now())` but denodo uses formulas as a plaintext: ``` Unable to obtain the data structure: com.denodo.util.exceptions.InternalErrorException: Error retrieving data from '.../values?Name=Foobar&End=FORMATDATE('yyyy-MM-dd',%20now())'. HTTP error code: 404. ``` What is the correct way to do this? (this is a clone of https://stackoverflow.com/questions/77833348/denodo-http-client-given-date-in-request question)
user
18-01-2024 03:52:00 -0500
code

1 Answer

Hi, Generally the values in interpolation variables are passed as strings. If I need to pass dynamic values in the interpolation variables, I would follow the below steps: * I would create a new HTTP/JSON datasource named ‘ds_sample’ with the base URL as mentioned below: > <BASE_URL>/values?Start=@start&End=@end * After saving the data source , I would create a base view, **‘bv_sample’** over the **‘ds_sample’** source. * Then, I would create a new view named **‘dates’** with two fields **‘Start’** and **‘End’** with the field expression formatdate('yyyy-MM-dd', addday(now(), -1)) for Start and formatdate('yyyy-MM-dd', now()) for End fields. * I would create a [Join view](https://community.denodo.com/docs/html/browse/8.0/en/vdp/administration/creating_derived_views/creating_join_views/creating_join_views) for the two base views ‘dates’ and ‘bv_sample’ and I would join the fields **dates.start,dates.end and bv_sample.start, bv_sample.end** respectively. * Finally, on executing the join view the results of the query matching the given conditions will be retrieved. Hope this helps!
Denodo Team
22-01-2024 03:32:53 -0500
code
You must sign in to add an answer. If you do not have an account, you can register here