# Automatic token HTTP request

**URL:** <https://discourse.nodered.org/t/automatic-token-http-request/63516>\
**Category:** General\
**Tags:** http-request\
**Created:** [6 June 2022 14:00 UTC](https://discourse.nodered.org/t/automatic-token-http-request/63516 "2022-06-06T14:00:02Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![LinkView\_Maze](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@LinkView\_Maze](https://discourse.nodered.org/u/LinkView_Maze)\
**Post date:** [9 June 2022 20:59 UTC](https://discourse.nodered.org/t/automatic-token-http-request/63516/21 "2022-06-09T20:59:55Z")

</div>

hello

I revive the subject for a small supplement.

I improved my code and I get a new msg.payload which contains a value of 1 or 10 . How can I isolate this value to be able to add all the msg.payload?

```auto
DATA 10 Go IP PUBLIQUE FIXE ACCESS EUROPE 4G KPN

```

my code

```auto
[{"id":"67a49484.c566fc","type":"http request","z":"7cfd6fff.005c","name":"POST : TOKEN","method":"POST","ret":"obj","paytoqs":"ignore","url":"https://api.matooma.com/token","tls":"","persist":false,"proxy":"","authType":"basic","x":220,"y":160,"wires":[["64b0272.3b80bd8"]]},{"id":"64b0272.3b80bd8","type":"change","z":"7cfd6fff.005c","name":"","rules":[{"t":"set","p":"token","pt":"msg","to":"payload.access_token","tot":"msg"},{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.Authorization","pt":"msg","to":"\"Bearer \" & $$.token","tot":"jsonata"},{"t":"set","p":"url","pt":"msg","to":"https://api.matooma.com/v1/simcards?page=1&size=10&state=active","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":420,"y":160,"wires":[["3edafc97.5db734"]]},{"id":"e8b0abc3.3157a8","type":"moment","z":"7cfd6fff.005c","name":"","topic":"","input":"","inputType":"msg","inTz":"Europe/Paris","adjAmount":0,"adjType":"days","adjDir":"add","format":"","locale":"fr-FR","output":"","outputType":"msg","outTz":"Europe/Paris","x":420,"y":80,"wires":[["3704edaa.f52322"]]},{"id":"aa2236c.bed6ec8","type":"string","z":"7cfd6fff.005c","name":"Month","methods":[{"name":"between","params":[{"type":"str","value":"-"},{"type":"str","value":"-"}]}],"prop":"payload","propout":"month","object":"msg","objectout":"msg","x":750,"y":80,"wires":[["67a49484.c566fc"]]},{"id":"3704edaa.f52322","type":"string","z":"7cfd6fff.005c","name":"Date","methods":[{"name":"delRightMost","params":[{"type":"str","value":"T"}]}],"prop":"payload","propout":"date","object":"msg","objectout":"msg","x":610,"y":80,"wires":[["aa2236c.bed6ec8"]]},{"id":"3edafc97.5db734","type":"http request","z":"7cfd6fff.005c","name":"GET : SIMCARD","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":250,"y":260,"wires":[["54f0c9e6.7b6ec8","e531b4b7.ef9f18"]]},{"id":"4d326081.ecdd5","type":"cronplus","z":"7cfd6fff.005c","name":"5h15","outputField":"payload","timeZone":"","persistDynamic":true,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"schedule1","topic":" ","payloadType":"date","payload":"","expressionType":"cron","expression":"0 15 5 * * ? *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":190,"y":80,"wires":[["e8b0abc3.3157a8"]]},{"id":"e531b4b7.ef9f18","type":"change","z":"7cfd6fff.005c","name":"ID","rules":[{"t":"set","p":"payload","pt":"msg","to":"msg.payload[*].deviceId","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":260,"wires":[["c1639985.77a9e8"]]},{"id":"54f0c9e6.7b6ec8","type":"debug","z":"7cfd6fff.005c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":220,"wires":[]},{"id":"c1639985.77a9e8","type":"template","z":"7cfd6fff.005c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","output":"str","x":620,"y":260,"wires":[["afa201ad.930d5"]]},{"id":"afa201ad.930d5","type":"split","z":"7cfd6fff.005c","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":770,"y":260,"wires":[["c3d9ff33.c903e","525eb1e3.35c36"]]},{"id":"c3d9ff33.c903e","type":"change","z":"7cfd6fff.005c","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"id","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":950,"y":260,"wires":[["8b974fc3.059eb"]]},{"id":"8b974fc3.059eb","type":"change","z":"7cfd6fff.005c","name":"","rules":[{"t":"set","p":"token","pt":"msg","to":"payload.access_token","tot":"msg"},{"t":"set","p":"headers","pt":"msg","to":"{}","tot":"json"},{"t":"set","p":"headers.Authorization","pt":"msg","to":"\"Bearer \" & $$.token","tot":"jsonata"},{"t":"set","p":"url","pt":"msg","to":"\"https://api.matooma.com/v1/devices/\" & $$.id","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1160,"y":260,"wires":[["156f8fd6.44f85"]]},{"id":"156f8fd6.44f85","type":"http request","z":"7cfd6fff.005c","name":"GET : PROFILS","method":"GET","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":480,"y":340,"wires":[["11e66f84.1466f"]]},{"id":"15900846.1b3908","type":"join","z":"7cfd6fff.005c","name":"","mode":"auto","build":"string","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":850,"y":340,"wires":[["91613762.47f468","7b0019a1.df8688"]]},{"id":"525eb1e3.35c36","type":"debug","z":"7cfd6fff.005c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":220,"wires":[]},{"id":"7b0019a1.df8688","type":"debug","z":"7cfd6fff.005c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":380,"wires":[]},{"id":"91613762.47f468","type":"change","z":"7cfd6fff.005c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload[*].profileName","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":1040,"y":340,"wires":[["c0838960.7e8928"]]},{"id":"11e66f84.1466f","type":"change","z":"7cfd6fff.005c","name":"","rules":[{"t":"set","p":"parts.type","pt":"msg","to":"array","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":340,"wires":[["15900846.1b3908"]]},{"id":"c0838960.7e8928","type":"template","z":"7cfd6fff.005c","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{payload}}","output":"str","x":1220,"y":340,"wires":[["f2cae0cf.249e2"]]},{"id":"f2cae0cf.249e2","type":"split","z":"7cfd6fff.005c","name":"","splt":",","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":1370,"y":340,"wires":[["431282b2.6726ec"]]},{"id":"431282b2.6726ec","type":"debug","z":"7cfd6fff.005c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1550,"y":300,"wires":[]}]

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [23 June 2022 21:00 UTC](https://discourse.nodered.org/t/automatic-token-http-request/63516/22 "2022-06-23T21:00:06Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/automatic-token-http-request/63516.md?page=1)
