Christopher Herold
Posts: 0
Joined: Fri Jun 28, 2013 8:27 pm

How to call a cURL when creating a REST Service

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to call a cURL when creating a REST Service

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

Christopher Herold
Posts: 0
Joined: Fri Jun 28, 2013 8:27 pm

How to call a cURL when creating a REST Service

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.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to call a cURL when creating a REST Service

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.

Christopher Herold
Posts: 0
Joined: Fri Jun 28, 2013 8:27 pm

How to call a cURL when creating a REST Service

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

How to call a cURL when creating a REST Service

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...

Return to “Issues”