curloptions, urladdparam & twig / API:

API: is a swiss webservice for managing reservations
Access to the API: The API expects a GET-request with a username-password-pair. The special thing is, that together with the username and password the current timestamp has to be sent and the whole thing has to be base64-encoded. Also the URL can have date/time-information: If you want to ask the API for all reservations from now back 14 days the timestamp has to be calculated dynamically.
This can be done in this way:
Put twig-code into the shortcode-parameters urladdparam and curloptions:
urladdparam=’&start_time={{“now”| date(“U”)}}&end_time={{“-14days” | date(“U”)}}’ curloptions=’CURLOPT_USERPWD={{ (“username” ~ (“now”| date(“U”)) ~”password”) | base64encode }}’
The plugin executes twig on the urladdparam-value: E.g. ‘{{“now”| date(“U”)}}’ stands for the current timestamp. The result of the twig-execution is added to the URL for asking the API.
[jsoncontentimporterpro url= parser=twig debugmode=10 urladdparam='&start_time={{"now"| date("U")}}&end_time={{"-14days" | date("U")}}' method=curlget curloptions='CURLOPT_USERPWD={{ ("username" ~ ("now"| date("U")) ~"password") | base64encode }}']
{% for d in data.results %}
name: {{}}, reservation_id: {{d.reservation_id}}
{% endfor %}