Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am developing a new REST webservice for our application.
My goal is to pass instead of the fixed date, a date that I retrieve from a database ,
but as I report in the images below the parameter does not work correctly.
While if I pass the date as per the field below the job works correctly.
Would you know how to help me. Thank you
" {
"tokenKey": "ofsodfdsnsd frrfmoic",
"dbKey": "dd_ab",
"customerKey": "lp_ProdG100",
"from":"2022-11-01",
"period": "DAY",
"profile": 1
}
"
You appear to have a space between your globalMap containing the date and your opening double quote ("). You have...
\"from\":\" "+((String)globalMap.get("oggi"))+"\",
....and I think you need....
\"from\":\""+((String)globalMap.get("oggi"))+"\",
A tiny change, but it would end up producing your date like this....
" 2020-11-01"
...instead of this....
"2020-11-01"
Hello @Davide Scolari ,
Regarding to your job snapshot, you can get the date value by globalMap.get("row93.oggi")
please reset it in the HTTP Body of tREST component to re-try?
Best regards
Aiming
Sorry, but I didn't quite understand.
I tried to rewrite the code in the following way:
\"from\":\" "+((Date)globalMap.get("row93.oggi"))+"\",
is correct, but no data is returned.
Another way is to setup a Customize key for the tFlowToIterate component in the job like the below
then rewrite the code in tREST body like
\"from\":\" "+globalMap.get("oggi")+"\",
Thank you, I think I have identified the error.
Instead of just returning me '2022-11-02' it gives me '2022-11-02 00:00:00' consequently it goes into error. I don't know how to force it
@Davide Scolari , in the tDBInput_2 component schema settings, please reset the column oggi Date Pattern to 'yyyy-MM-dd' like the below, then re-try the job?
Thank you, but I had already tried but it doesn't work
@Davide Scolari , you can substring the oggi value, in the tREST body , try the below
\"from\":\" "+globalMap.get("oggi").toString().substring(0, 10)+"\",
Thank you, but you expect a Date the Trest . I discovered this by running the job in Trace Debug
A date passed via a web service will either be passed as a String or a number. A Date in Java is essentially a number that when it is shown to users as a String, can be formatted in a number of different ways. If the error is caused by not receiving "2022-11-02", then your date is arguably expecting a String.