[SOLVED] fetch url problem / sms api

Hi, I’m trying to write a working script to send me SMS via API, the manual for API service can be found here

The script I tried and following error (personal data omitted):

/tool> fetch url="http://rest.nexmo.com/sms/xmlapi_key=KEY&api_secret=PASS&from=Gatekeeper&to=NUMBER&text=test_msg"     
  status: failed

failure: closing connection: <404 Not Found> 173.193.199.22:80 (4)

or

/tool> fetch address="rest.nexmo.com" mode=http src-path="/sms/xmlapi_key=KEY&api_secret=PASS&from=Gatekeeper&to=NUMBER&text=test_msg"     
  status: failed

failure: closing connection: <302 Moved Temporarily> 174.37.245.36:80 (4)

any idea how to get this working?

Try to clear your DNS cache with

/ip dns cache flush

before you make the request.

It appears nexmo recently changed their server, but are still keeping the old one to redirect to the new one, before they eventually take it down. “/tool fetch” doesn’t cope well with redirects. Clearing the cache should point it to their new server.

Did not help much, for now I resorted to PHP nexmo library that’s running on my server, and fetch is working normally there, maybe at some point add lighttpd server on Metarouter, and put scripts there.

found the solution today. Changed all “?” to “?”
fetch keep-result=no url=“http://rest.nexmo.com/sms/xml?api_key=KEY&api_secret=SECRET=SENDER&to=NUMBER=MESSAGE

It helps. Thank you.

anyone can help with 5.20 version?
it still say

status: failed

failure: 301 Moved Permanently

trying another
[hendra@MikroTik] > /tool fetch mode=http address=“tunnel.hostddns.us” src-path=“/ddns” dst-path=“/fddea32284b91e43acfef819d4997c83”
status: failed

failure: 302 Found

still same.

Thanks, it helped.