Public Address identify and foward via fetchtool

Good Day

Im trying to create a script to identify my routers public address at a specific port (mutiple ISPs in use behind nat) and foward my identified address via fetch-tool
I have the fetch tool script working well to post messages but i think i need a script that will identify the public address and save it to a “variable” and then forward the “variable” via fetch-tool.

Here is a snipet of my script for fetchtool that simply sends a “eth=down” message to a specific ipaddress and port.

/tool fetch mode=http url=“http://xxx.xxx.xxx.xxx:xxxx/example/string” http-method=post http-data=“eth=down”

Any pointers or ideas will be appreciated

what do you mean by script like this?

:local WANIP [/ip address get [find where interface=WANINTERFACE] address];
/tool fetch mode=http url="http://xxx.xxx.xxx.xxx:xxxx/example/string" http-method=post http-data="eth=down IP=$WANIP"

Thanks for the reply it got me on track, although i still need to refine the script to do multiple ISP public.
So far i have set the following script to run in scheduler.

/ip cloud set ddns-enabled=yes
/ip cloud force-update
/delay 40
/global WANIP [ip cloud get public-address]
/log info $WANIP
/tool fetch mode=/tool fetch mode=http url="http://xxx.xxx.xxx.xxx:xxxx/example/string" http-method=post  http-data="IPWAN=$WANIP"
/delay 20
/ip cloud set ddns-enabled=no