Relax and General RESTFul API questions

Hello Everyone,

I am currently working on an API for one of our partners to update
information with our app. I am very new to writing APIs in general and
to go. Relax only makes this more attractive, but I am struggling a
bit. I am hoping that someone with some experience in writing such
APIs could help me to understand a little better.

Luis' documentation and videos were very helpful, but I think they
assume knowledge of writing REST services. They trail off right at the
point of doing the actual calls (the existing forgebox API is used for
demonstration) and that is where I am confused...

Does someone have some examples of an API they have written with Relax
that they would be willing to share?

Thanks in advance for any help and thank you Luis for continuing to
write awesome tools!

Jeff Reese

Hi Jeff,

Relax is more of a tool for testing, documenting and logging calls against an existing API as opposed to building an API. That being said if you configure Relax correctly you can actually generate your Routes file to use as a starting point for own API. Perhaps the most important part of designing and coding an API is really around having a solid understanding of following RESTful best practices. ColdBox community member Aaron Greenlee is actually doing a cfmeetup tomorrow talking about his experience with architecting an API using CF and ColdBox. I'm sure this will provide you with some valuable knowledge on how to hit the ground running.

I've done some work on building API's using ColdBox myself and would happy to answer any question if you have them.

A couple things which really came into play for me were ColdBox Routes and handler method security. In addition RESTful API's should follow these conventions

1. Retrieving or Reading information should be an HTTP GET
2. Inserting information should be a POST
3. Updating information should be a PUT
4. Removing information should be a DELETE

These are standard REST conventions. Other conventions to follow are around building human readable routes or endpoints - i.e GET http://api.mysite.com/artists/{artistname}/art.json would retrieve a listing of art by a particular artist name.

Hope this helps.

Nolan

Hey Nolan,

Thank you for your reply, the link to the meetup and your offer to
help.

I am going to attend the meetup and do some more researching and then
I may take you up on your offer and ask some questions. Now that you
pointed out that Relax is more of a tool for existing APIs, it makes a
lot more sense to me.

Thanks again,

Jeff