Page 1 of 1

How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 8:52 pm
by Christopher Herold

I am trying to access my external MySQL database to pull down some data using GET. I am testing out Arrest MySQL, seems simple enough.

The Arrest documentation specifies that to get the data from the database I need to call:

code
GET http://api.example.com/customers/123
/code

Where:
db name = customers
row ID = 123

But the problem is that I don't know how to structure this for the REST service that I am creating. In SETTINGS, I have entered the url http://api.example.com and selected Method: GET and Datatype: JSON. It tests ok, but the can't find the database.

When I put the "customers/123" on the end as part of the database descriptor, it fails and says that it cannot find the URL (no surprise, it does not exist). Do I need to specify a request parameter?

I really have no idea what I am doing here so any direction is appreciated.


How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 8:55 pm
by maxkatz

Instead of api.example.com - did you specify your server URL?


How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 8:58 pm
by Christopher Herold

Yes, I specified my server and the path to the arrest-mysql code. I was just using the above as an example. Mainly just trying to understand the basics behind how to do a cURL request when setting up a REST service in Appery.


How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 9:02 pm
by maxkatz

I'd first make sure your server/service is accessible from the Internet. Why it can't find the database -- I can't tell you.

A service you might want to use is http://hurl.it -- for testing.


How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 9:09 pm
by Christopher Herold

It is accessible.

https://www.msacl.org/arrest_mysql/

The question is that to cURL like that specified in the first block of this thread how do I do it when setting a REST service up on Appery.

When setting up the REST service Do I just enter the URL and then select Method: Get and that becomes a cURL like below?

code
GET http://api.example.com/customers/123
/code


How to call a cURL when creating a REST Service

Posted: Fri Jul 19, 2013 9:15 pm
by maxkatz

Yes, you can enter the entire URL (with parameters) and test it. You can also define parameters in Request section.

http://docs.appery.io/documentation/a...