• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Writing RESTful Web Services

Guest
Feb 09, 2010 Feb 09, 2010

Copy link to clipboard

Copied

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

http://coldfusionServer.domain.ca/appname/services/user.cfc?method=remoteGetUser&uName=Jenn&pass=jen...

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.

Thanks!

Jenn

TOPICS
Advanced techniques

Views

481

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 09, 2010 Feb 09, 2010

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation