I sure hope I'm in the right spot for this, as I have run out of places to look for answers.
I need to write a web service. I can find all the information in the world on consuming RESTful webservices, but I need to write one in Coldfusion. I have a service that will return JSON, but I don't know how to make them RESTful.
We are using these services to communicate with a Rhosync Server, and that portion has already been written. All I have to go on is how to test the call, and what data will be returned. The test call I was given is:
$ curl -i -H 'Accept: application/json' --user username:password 'http://coldfusionServer.domain.ca/appname/users/'
Is there a specific location that the CFCs should be, or a setting I need to have in the CFAdministrator?
Right now, I have gotten to the point that if I go to
I can get back the data I want.
The CFC I have are simple queries, which return JSON data (I am getting the correct format back) - it's an array of structs.
Any help - links, code examples, explanations of how simple (I Hope) it is to read in a RESTful call, and return JSON back, would be most appreciated.
The easiest way to get this working is to use some form of URL rewriting in the webserver. Such a rewrite could bes set up to translate http://coldfusionServer.domain.ca/appname/users/ to something like http://coldfusionServer.domain.ca/appname.cfc?method=users. The the username and password that are being sent are available to your application in the CGI scope just as the Accept header is.