### addColumns() options example with columns and mode Source: https://docs.synesty.com/ssud/add-ons/api-connector-tools/xmlreader-1.0/ Example of the options parameter with columns and mode. The options is a JSON object. ```JSON {"columns":["zip", "city"], "mode":"include"} ``` -------------------------------- ### JSON input example with items array Source: https://docs.synesty.com/ssud/add-ons/api-connector-tools/jsonreader-1.0/ Example JSON document with an 'Items' array containing objects with id, Filename, and Link fields. ```json { "Items":[ { "id1":{ "Filename":"f1.jpg", "Link":"http://www.mywebsite.de/f1.jpg" } }, { "id2":{ "Filename":"f2.jpg", "Link":"http://www.mywebsite.de/f2.jpg" } } ] } ``` -------------------------------- ### Example: Using urlcontentBase64() in RequestBody Source: https://docs.synesty.com/ssud/add-ons/api-connector-tools/spreadsheeturldownload-1.0/ Shows how to embed a Base64-encoded image in a request body using the urlcontentBase64() method. The method takes the file/image URL and a boolean indicating whether to check the URL for a file (default true). On error, it returns a string starting with 'ERROR:'. The example uses a FreeMarker template to conditionally include the JSON if no error occurs. ```freemarker <#assign base64img = meta.urlcontentBase64(image_url!, true)/> <#if !base64img?startsWith("ERROR") > { "id": 1, "base64Image": ${base64img} } ``` -------------------------------- ### pagination() example with output Source: https://docs.synesty.com/ssud/add-ons/api-connector-tools/apicall-1.0/ Shows the pagination() function call and its resulting URL for a simple case. ```freemarker ${pagination('http://api.example.com/products', 1, 1000, 100).plusOne('page')} ``` ```text http://api.example.com/products?page=2 ``` -------------------------------- ### Counter variable increment examples in FreeMarker Source: https://docs.synesty.com/ssud/release-notes-archiv/release-notes-09-2017/ Shows how to use counter.inc() to increment a counter variable. The counter starts at 0 and increments by 1 each call. With an argument, separate counters are maintained per argument. Outputs are shown as comments. ```freemarker ${counter.inc()} => Ausgabe: 1 ${counter.inc()} => Ausgabe: 2 ${counter.inc("wort1")} => Ausgabe: 1 ${counter.inc("wort1")} => Ausgabe: 2 ${counter.inc("wort2")} => Ausgabe: 1 ${counter.inc("wort2")} => Ausgabe: 2 ${counter.inc("wort2")} => Ausgabe: 3 ``` -------------------------------- ### nextUrl() without pagination() - page-based pagination Source: https://docs.synesty.com/ssud/add-ons/api-connector-tools/apicall-1.0/ Example of using nextUrl() without pagination() to implement custom pagination logic. Assumes initialUrl does not contain a page parameter. Uses callcounter (starts at 0) and callLimit (max calls). The IF condition prevents infinite loops. ```freemarker <#if (numRowsInJsonResponse > 0 && callcounter < callLimit)> <#assign nextPageNumber = (callcounter + 1)> ${nextUrl(initialUrl+"&page="+nextPageNumber)} ``` -------------------------------- ### newMap() ohne Parameter initialisieren Source: https://docs.synesty.com/ssud/scripting/ Erstellt eine leere MAP und gibt sie als JSON aus. Die Ausgabe ist ein leeres Objekt {}. ```freemarker ${toJSON(newMap(), {'pretty': true})} ``` ```json {} ``` -------------------------------- ### Arithmetic examples Source: https://docs.synesty.com/ssud/scripting/ Shows basic arithmetic with FreeMarker: adding two numbers and adding two column values converted to numbers. Comments indicate the expected output. ```freemarker ${1 + 2} # gibt 3 aus ${spalte1?number + spalte2?number} # gibt die Summer von zwei Spalten aus. ```