Date picker String in url part

Hello

i have a problem which i dont know how to solfe (read the paper for the date picker but it dosent work for me)

i have this Date Picker in my Dashboard

grafik

Now i want pick the date and trow it in a url.

I have this function and want to include the output in the URL. There will be a 2nd datapicker which should come to a second place in the URL.

The URL looks like this:
https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=2022-10-04,toDateTime=2022-10-05)

Now i want to pick the "von" data to "fromDateTime=yyyy-mm-dd" and the "bis" data to "toDateTime=yyyy-mm-dd" in this url.

Maybe sime one have the solution for it

Here is an example using a change node and a form node, it uses JSONata and moments to format the date and adjust any time zone, it the concatenates the url.

[{"id":"552f973997e16203","type":"ui_form","z":"fe76f7928e585317","name":"","label":"","group":"2d4fe667.28f8ba","order":15,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":150,"y":2440,"wires":[["bd521561b6acb97e"]]},{"id":"bd521561b6acb97e","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":2440,"wires":[["5f521f6e4526fbed"]]},{"id":"5f521f6e4526fbed","type":"debug","z":"fe76f7928e585317","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":2360,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

Ok the url get generated. But i become the error "invalid url" when i want put it in the http request

i try it with {{payload}} and {{msg.payload}} both dosent work for me also try with all three "userdaten (payload)" without a fix

Use triple {{{payload}}}
from the http node info help text

Using {{{...}}} prevents mustache from escaping characters like / & etc.

Alternatively set the url to msg.url and leave http url input blank.
e.g.

[{"id":"f1445127b52eb50e","type":"ui_form","z":"fe76f7928e585317","name":"","label":"","group":"2d4fe667.28f8ba","order":15,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"submit","cancel":"cancel","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":130,"y":2300,"wires":[["e97e8b2e48fdc894"]]},{"id":"e97e8b2e48fdc894","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":2300,"wires":[["6ebcdc0686359616"]]},{"id":"6ebcdc0686359616","type":"http request","z":"fe76f7928e585317","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":2320,"wires":[["c33b83b26bab4505"]]},{"id":"c33b83b26bab4505","type":"debug","z":"fe76f7928e585317","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":2320,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

I get a token from the previous steps which I have to include in the URL. But this is not forwarded because of the forma

It looks like this. But after the Date part, it dont do anything

It is best to give all info in the first post. Also images are not the best as no one can copy the text and post an example with your data.

If you are running node-red 3.2, then you can add the authentication header in the http request node.

[edit]
example

[{"id":"75ee466a384296c9","type":"inject","z":"fe76f7928e585317","name":"result of first http request","props":[{"p":"payload.access_token","v":"Basdfghj","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":230,"y":2160,"wires":[["a6af4c814a06d9d9"]]},{"id":"a6af4c814a06d9d9","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"payload.access_token","pt":"msg","to":"\"Bearer \" & $$.payload.access_token","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":2160,"wires":[["39c68265a34fe744"]]},{"id":"39c68265a34fe744","type":"join","z":"fe76f7928e585317","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":2200,"wires":[["ca8226b2a8011cdb"]]},{"id":"dde82edbc8a62b33","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"DD-MM-YYYY\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":2240,"wires":[["39c68265a34fe744"]]},{"id":"ca8226b2a8011cdb","type":"switch","z":"fe76f7928e585317","name":"","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"form","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":2200,"wires":[["b9aee1661dffcbfc"]]},{"id":"d77f9e70d392ce3a","type":"ui_form","z":"fe76f7928e585317","name":"","label":"","group":"2d4fe667.28f8ba","order":15,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"submit","cancel":"cancel","topic":"torm","topicType":"str","splitLayout":"","className":"","x":130,"y":2240,"wires":[["dde82edbc8a62b33"]]},{"id":"b9aee1661dffcbfc","type":"http request","z":"fe76f7928e585317","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"payload.access_token"}],"x":590,"y":2260,"wires":[["a0964be414ecabcd"]]},{"id":"a0964be414ecabcd","type":"debug","z":"fe76f7928e585317","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":2260,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]
1 Like

This is unfortunately too high for me. I now have a mess. will probably have to undo everything and enter the date manually each day.
I no longer understand where I have to enter what with the join and switch etc.. Thanks anyway for your efforts.

Here is the code which I have so far (secret ids etc I had to removed)

[{"id":"9f11e0559d57c435","type":"tab","label":"Telefon History","disabled":false,"info":"","env":[]},{"id":"bdbfaae1fc42e876","type":"inject","z":"9f11e0559d57c435","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":80,"y":40,"wires":[["7d2f789f975a8835"]]},{"id":"332e34ad2e399ceb","type":"http request","z":"9f11e0559d57c435","name":"Post Request absenden","method":"POST","ret":"txt","paytoqs":"ignore","url":"https://login.microsoftonline.com/MYID/oauth2/v2.0/token","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":200,"wires":[["dab2069bcddc1025","5f521f6e4526fbed"]]},{"id":"7d2f789f975a8835","type":"function","z":"9f11e0559d57c435","name":"Post Part erstellen","func":"msg.payload = {\n    \"client_id\": \"MYCLIENTID\",\n    \"scope\": \"https://graph.microsoft.com/.default\",\n    \"client_secret\": 'MYSECRETID',\n    \"grant_type\": \"client_credentials\"\n};\nmsg.headers = {};\nmsg.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":140,"wires":[["332e34ad2e399ceb"]]},{"id":"dab2069bcddc1025","type":"json","z":"9f11e0559d57c435","name":"JSON Response abfangen","property":"payload","action":"","pretty":false,"x":360,"y":260,"wires":[["8c7ea2297ee66efb"]]},{"id":"40dbdefb476cd315","type":"http request","z":"9f11e0559d57c435","name":"Get Request absenden","method":"GET","ret":"txt","paytoqs":"ignore","url":"{{{payload}}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":410,"y":480,"wires":[["ec3f13cdf7b294c5","122f781dbb619410"]]},{"id":"8c7ea2297ee66efb","type":"function","z":"9f11e0559d57c435","name":"Header Request vorbereiten","func":"msg.headers = {};\nmsg.headers = {\n    Authorization: \"Bearer \" + msg.payload.access_token\n    \n};\nmsg.headers[\"Content-Type\"] = \"application/json\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":320,"wires":[["552f973997e16203"]]},{"id":"ec3f13cdf7b294c5","type":"json","z":"9f11e0559d57c435","name":"","property":"payload","action":"","pretty":false,"x":370,"y":600,"wires":[["47742f60d9d455df"]]},{"id":"7689c002eb80a439","type":"ui_button","z":"9f11e0559d57c435","name":"","group":"4fce8c2af3820dd7","order":2,"width":0,"height":0,"passthru":false,"label":"Hole Daten","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":120,"wires":[["7d2f789f975a8835"]]},{"id":"7da81c9ddc68e882","type":"ui_table","z":"9f11e0559d57c435","group":"4fce8c2af3820dd7","name":"","order":3,"width":"20","height":"15","columns":[],"outputs":0,"cts":false,"x":890,"y":560,"wires":[]},{"id":"47742f60d9d455df","type":"function","z":"9f11e0559d57c435","name":"function 1","func":"msg.payload = msg.payload.value.map(e => {\n    return {\n        \"Anrufzeit\": e.startDateTime,\n        \"Anurfnummer\": e.callerNumber,\n        \"Anrufdauer in Sekunden\" : e.duration,\n        \"Display Name\": e.userDisplayName\n    }\n})\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":580,"wires":[["7da81c9ddc68e882"]]},{"id":"122f781dbb619410","type":"debug","z":"9f11e0559d57c435","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":400,"wires":[]},{"id":"552f973997e16203","type":"ui_form","z":"9f11e0559d57c435","name":"","label":"","group":"4fce8c2af3820dd7","order":1,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"Daten Holen","cancel":"Abbrechen","topic":"topic","topicType":"msg","splitLayout":"","className":"","x":170,"y":380,"wires":[["bd521561b6acb97e"]]},{"id":"bd521561b6acb97e","type":"change","z":"9f11e0559d57c435","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":380,"wires":[["40dbdefb476cd315"]]},{"id":"5f521f6e4526fbed","type":"debug","z":"9f11e0559d57c435","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":260,"wires":[]},{"id":"4fce8c2af3820dd7","type":"ui_group","name":"Teams History","tab":"9bb60f34ca928aab","order":4,"disp":true,"width":"20","collapse":false,"className":""},{"id":"9bb60f34ca928aab","type":"ui_tab","name":"Hauptfenster","icon":"dashboard","disabled":false,"hidden":false}]

Try this

[{"id":"8c7ea2297ee66efb","type":"function","z":"9f11e0559d57c435","name":"Header Request vorbereiten","func":"msg.headers = {};\nmsg.payload.access_token = \"Bearer \" + msg.payload.access_token;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":260,"wires":[["b38033df69bb8a76","5f521f6e4526fbed"]]},{"id":"332e34ad2e399ceb","type":"http request","z":"9f11e0559d57c435","name":"Post Request absenden","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://login.microsoftonline.com/MYID/oauth2/v2.0/token","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":200,"wires":[["5f521f6e4526fbed","8c7ea2297ee66efb"]]},{"id":"149ddf3238dcacc4","type":"inject","z":"9f11e0559d57c435","name":"","props":[{"p":"payload.access_token","v":"asdfghjk","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":130,"y":280,"wires":[["8c7ea2297ee66efb"]]},{"id":"b38033df69bb8a76","type":"join","z":"9f11e0559d57c435","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":590,"y":340,"wires":[["25a36c5bc6f001eb"]]},{"id":"5f521f6e4526fbed","type":"debug","z":"9f11e0559d57c435","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":260,"wires":[]},{"id":"7d2f789f975a8835","type":"function","z":"9f11e0559d57c435","name":"Post Part erstellen","func":"msg.payload = {\n    \"client_id\": \"MYCLIENTID\",\n    \"scope\": \"https://graph.microsoft.com/.default\",\n    \"client_secret\": 'MYSECRETID',\n    \"grant_type\": \"client_credentials\"\n};\nmsg.headers = {};\nmsg.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":140,"wires":[["332e34ad2e399ceb"]]},{"id":"552f973997e16203","type":"ui_form","z":"9f11e0559d57c435","name":"","label":"","group":"4fce8c2af3820dd7","order":1,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"Daten Holen","cancel":"Abbrechen","topic":"form","topicType":"str","splitLayout":"","className":"","x":430,"y":340,"wires":[["b38033df69bb8a76"]]},{"id":"25a36c5bc6f001eb","type":"switch","z":"9f11e0559d57c435","name":"send if form is sent","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"form","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":340,"wires":[["bd521561b6acb97e"]]},{"id":"bdbfaae1fc42e876","type":"inject","z":"9f11e0559d57c435","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":80,"y":40,"wires":[["7d2f789f975a8835"]]},{"id":"7689c002eb80a439","type":"ui_button","z":"9f11e0559d57c435","name":"","group":"4fce8c2af3820dd7","order":2,"width":0,"height":0,"passthru":false,"label":"Hole Daten","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":120,"wires":[["7d2f789f975a8835"]]},{"id":"bd521561b6acb97e","type":"change","z":"9f11e0559d57c435","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":400,"wires":[["f4474fc86c2ec6e6","40dbdefb476cd315"]]},{"id":"f4474fc86c2ec6e6","type":"debug","z":"9f11e0559d57c435","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":760,"y":400,"wires":[]},{"id":"40dbdefb476cd315","type":"http request","z":"9f11e0559d57c435","name":"Get Request absenden","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"access_token"}],"x":410,"y":480,"wires":[["122f781dbb619410","47742f60d9d455df"]]},{"id":"122f781dbb619410","type":"debug","z":"9f11e0559d57c435","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":720,"y":480,"wires":[]},{"id":"47742f60d9d455df","type":"function","z":"9f11e0559d57c435","name":"function 1","func":"msg.payload = msg.payload.value.map(e => {\n    return {\n        \"Anrufzeit\": e.startDateTime,\n        \"Anurfnummer\": e.callerNumber,\n        \"Anrufdauer in Sekunden\" : e.duration,\n        \"Display Name\": e.userDisplayName\n    }\n})\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":680,"y":580,"wires":[["7da81c9ddc68e882"]]},{"id":"7da81c9ddc68e882","type":"ui_table","z":"9f11e0559d57c435","group":"4fce8c2af3820dd7","name":"","order":3,"width":"20","height":"15","columns":[],"outputs":0,"cts":false,"x":890,"y":560,"wires":[]},{"id":"4fce8c2af3820dd7","type":"ui_group","name":"Teams History","tab":"9bb60f34ca928aab","order":4,"disp":true,"width":"20","collapse":false,"className":""},{"id":"9bb60f34ca928aab","type":"ui_tab","name":"Hauptfenster","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

When i click on the "Daten Holen" Button under the "Date form"

Expand the debug objects so we can see the payloads.
Are you using node-red 3.0.2?
You also need to press HOLE DATEN first to retrieve the token.

1 Like

Yes i use 3.0.2

Which butten must i press? the "Hole Daten" Button or the button from the Form?

Because when i press "Hole Daten" then, they just take the Bear Token.

grafik

All the payload objects from debugs, half info does not help.

you need to press "hole daten" to retrieve the access code. then "daten holen" to send the form.

1 Like

If you want me to see what is going on you will need to send me the access_token in a pm, The access token only works for 1 hour then is usless. I will not require your secret key
[edit] there was an typo in the header of http request node.
try this

[{"id":"bdbfaae1fc42e876","type":"inject","z":"9f11e0559d57c435","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":true,"onceDelay":"0.5","topic":"","payload":"","payloadType":"date","x":90,"y":40,"wires":[["7d2f789f975a8835"]]},{"id":"7d2f789f975a8835","type":"function","z":"9f11e0559d57c435","name":"Post Part erstellen","func":"msg.payload = {\n    \"client_id\": \"MYCLIENTID\",\n    \"scope\": \"https://graph.microsoft.com/.default\",\n    \"client_secret\": 'MYSECRETID',\n    \"grant_type\": \"client_credentials\"\n};\nmsg.headers = {};\nmsg.headers[\"Content-Type\"] = \"application/x-www-form-urlencoded\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":430,"y":140,"wires":[["332e34ad2e399ceb"]]},{"id":"7689c002eb80a439","type":"ui_button","z":"9f11e0559d57c435","name":"","group":"4fce8c2af3820dd7","order":2,"width":0,"height":0,"passthru":false,"label":"Hole Daten","tooltip":"","color":"","bgcolor":"","className":"","icon":"","payload":"","payloadType":"str","topic":"topic","topicType":"msg","x":90,"y":120,"wires":[["7d2f789f975a8835"]]},{"id":"332e34ad2e399ceb","type":"http request","z":"9f11e0559d57c435","name":"Post Request absenden","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://login.microsoftonline.com/MYID/oauth2/v2.0/token","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":370,"y":200,"wires":[["5f521f6e4526fbed","8c7ea2297ee66efb"]]},{"id":"5f521f6e4526fbed","type":"debug","z":"9f11e0559d57c435","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":620,"y":260,"wires":[]},{"id":"8c7ea2297ee66efb","type":"function","z":"9f11e0559d57c435","name":"Header Request vorbereiten","func":"msg.headers = {};\nmsg.payload.access_token = \"Bearer \" + msg.payload.access_token;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":260,"wires":[["b38033df69bb8a76","5f521f6e4526fbed"]]},{"id":"554d34610ea61e05","type":"inject","z":"9f11e0559d57c435","name":"","props":[{"p":"payload.access_token","v":"","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":90,"y":260,"wires":[["8c7ea2297ee66efb"]]},{"id":"b38033df69bb8a76","type":"join","z":"9f11e0559d57c435","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"3","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":590,"y":340,"wires":[["25a36c5bc6f001eb"]]},{"id":"552f973997e16203","type":"ui_form","z":"9f11e0559d57c435","name":"","label":"","group":"4fce8c2af3820dd7","order":1,"width":0,"height":0,"options":[{"label":"from","value":"from","type":"date","required":true,"rows":null},{"label":"to","value":"to","type":"date","required":true,"rows":null}],"formValue":{"from":"","to":""},"payload":"","submit":"Daten Holen","cancel":"Abbrechen","topic":"form","topicType":"str","splitLayout":"","className":"","x":430,"y":340,"wires":[["b38033df69bb8a76"]]},{"id":"25a36c5bc6f001eb","type":"switch","z":"9f11e0559d57c435","name":"send if form is sent","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"form","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":750,"y":340,"wires":[["bd521561b6acb97e"]]},{"id":"bd521561b6acb97e","type":"change","z":"9f11e0559d57c435","name":"","rules":[{"t":"set","p":"url","pt":"msg","to":"\"https://graph.microsoft.com/beta/communications/callRecords/getDirectRoutingCalls(fromDateTime=\" & \t$moment($$.payload.from).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\",toDateTime=\" & \t$moment($$.payload.to).tz(\"Europe/London\").format(\"YYYY-MM-DD\") & \t\")\"","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":400,"wires":[["f4474fc86c2ec6e6","40dbdefb476cd315"]]},{"id":"f4474fc86c2ec6e6","type":"debug","z":"9f11e0559d57c435","name":"debug 13","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":720,"y":400,"wires":[]},{"id":"40dbdefb476cd315","type":"http request","z":"9f11e0559d57c435","name":"Get Request absenden","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"other","keyValue":"Authorization","valueType":"msg","valueValue":"payload.access_token"}],"credentials":{},"x":410,"y":480,"wires":[["122f781dbb619410","47742f60d9d455df"]]},{"id":"122f781dbb619410","type":"debug","z":"9f11e0559d57c435","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":480,"wires":[]},{"id":"47742f60d9d455df","type":"function","z":"9f11e0559d57c435","name":"function 1","func":"msg.payload = msg.payload.value.map(e => {\n    return {\n        \"Anrufzeit\": e.startDateTime,\n        \"Anurfnummer\": e.callerNumber,\n        \"Anrufdauer in Sekunden\" : e.duration,\n        \"Display Name\": e.userDisplayName\n    }\n})\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":600,"y":540,"wires":[["7da81c9ddc68e882"]]},{"id":"7da81c9ddc68e882","type":"ui_table","z":"9f11e0559d57c435","group":"4fce8c2af3820dd7","name":"","order":3,"width":"20","height":"15","columns":[],"outputs":0,"cts":false,"x":730,"y":540,"wires":[]},{"id":"4fce8c2af3820dd7","type":"ui_group","name":"Teams History","tab":"9bb60f34ca928aab","order":4,"disp":true,"width":"20","collapse":false,"className":""},{"id":"9bb60f34ca928aab","type":"ui_tab","name":"Hauptfenster","icon":"dashboard","disabled":false,"hidden":false}]
1 Like

This works =)
Thank you very much for your help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.