Please excuse our look. We're just getting started here.

Want to learn more about Twilio Forums? Check out our FAQ page here.

Messages.json Not Found

Indigo
Indigo
edited September 5 in Twilio Community

I am attempting to create my create a Message Resource with the Twilio Rest API. When I attempt to post the following:

curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID\Messages.json \
--data-urlencode "Body=Hi there" \
--data-urlencode "From=+15017122661" \
--data-urlencode "To=+15558675310" \
-u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN

I get the following returned to the terminal:

{"code": 20404, "message": "The requested resource /2010-04-01/Accounts/Messages.json was not found", "more_info": "https://www.twilio.com/docs/errors/20404", "status": 404}

What is the Messages.json?

Thank you for reading!

Comments

  • Hey @Indigo, Normally when you get a 404 like this it is because your Account SID is missing from the URL. Note the error says /2010-04-01/Accounts/Messages.json was not found. But the path should be /2010-04-01/Accounts/{TWILIO_ACCOUNT_SID}/Messages.json

    One issue you definitely have is the back slash before Messages.json in your curl command. That should be a forward slash.

    So, make sure that $TWILIO_ACCOUNT_SID and $TWILIO_AUTH_TOKEN are both present in your environment and use the correct slashes, like below:

    curl -X POST https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json \
    --data-urlencode "Body=Hi there" \
    --data-urlencode "From=+15017122661" \
    --data-urlencode "To=+15558675310" \
    -u $TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN
    
  • Thanks @pnash. The problem has been resolved. I used the node.js to interface with the API instead. I appreciate this great advice!

  • technofest
    edited September 23

    How to you Get url in webhook which sends body and from number parameter to my API? API is in C#.

    Sample api = https://serverdomain/api/sms/receive

    Will it give from, to and body of brackets?