Dev Oskii
Dev Oskii

Reputation: 929

GET request works with CURL but not as a URL

Here are two GET requests. The first one using CURL in php works, but the second one generated by an HTML form receives an error from the response server.

The first (working) is a GET request using CURL

1.

curl 'https://api.authy.com/protected/json/phones/verification/start' \
-d api_key=my_key\
-d via=sms \
-d phone_number=my_number\
-d country_code=my_code

The second (not working) is a GET request URL like one generated from an html form <form method='get'>

2.

https://api.authy.com/protected/json/phones/verification/start?api_key=my_key&via=sms&phone_number=my_number&country_code=my_code

The error message from the response server when using the second one is:

{"message":"Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs","success":false,"errors":{"message":"Requested URL was not found. Please check http://docs.authy.com/ to see the valid URLs"},"error_code":"60000"}

Question

What is the difference between second GET request compared to the CURL GET request? They look to me like they are identical.

Upvotes: 1

Views: 1107

Answers (1)

Nico Haase
Nico Haase

Reputation: 12130

According to the documentation at https://www.twilio.com/docs/verify/api/verification, you should use a POST request to use that API, and that is what the -d option of cURL does.

In your second call, you send a GET request, and according to the documentation and the error message, that is not successful

Upvotes: 7

Related Questions