-
|
Hello there, I'm trying to make my first custom-api widget and I need to pass the date of tomorrow in the URL parameters, documentation is short on that and I couldn't find anything related in discussions, what I have done is this, but it does not give me any results, if I replace with current date "2025-11-07" everything works perfectly, what am I missing here : type: custom-api
title: waste collection
parameters:
fromDate: |
{{ offsetNow "24h" | formatTime "2006-01-02" }}
untilDate: |
{{ offsetNow "24h" | formatTime "2006-01-02" }}
size: "10"
url: https://api.fostplus.be/recyclecms/public/v1/collections
headers:
...Thanks for your help 👍 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Found it in a community widget example, but it's also in the doc, my bad, apparently a dynamic request needs this approach, too bad we can't have dynamic parameters with original approach, it looks way cleaner that way : {{ $tomorrow := offsetNow "24h" | formatTime "2006-01-02" }}
{{ $response := newRequest "https://api.fostplus.be/recyclecms/public/v1/collections"
| withHeader "x-consumer" "XXXXXXXX"
| withParameter "zipcodeId" "XXXXXXXX"
| withParameter "streetId" "XXXXXXXX"
| withParameter "houseNumber" "XXXXXXX"
| withParameter "size" "10"
| withParameter "fromDate" $tomorrow
| withParameter "untilDate" $tomorrow
| getResponse
}} |
Beta Was this translation helpful? Give feedback.
Found it in a community widget example, but it's also in the doc, my bad, apparently a dynamic request needs this approach, too bad we can't have dynamic parameters with original approach, it looks way cleaner that way :