Forum: Ruby on Rails Best practices with Web Services

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jake J. (Guest)
on 2006-06-05 17:54
Hello--

I'm investigating the API facet of my site and wanted to ask a couple
questions:

1. The Agile book describes adding an API using the web_services
generator which adds stuff to app/api.  In Rails 1.1, Jamis added some
wants.xml stuff to the controller code which also allows API generation.
Which is better to use now?  Do they mutually exclude one another?

2. In some cases, I will want to remove or rename certain attributes
from the API response to reduce visibility into the database.  How is
this done?

3. Is there a good app out there I can see that implements web services?
It would be nice to see a nice example of a more complicated setup.

   Jake
Jake J. (Guest)
on 2006-06-05 18:22
Jake J. wrote:
> 2. In some cases, I will want to remove or rename certain attributes
> from the API response to reduce visibility into the database.  How is
> this done?
>
> 3. Is there a good app out there I can see that implements web services?
> It would be nice to see a nice example of a more complicated setup.

I apologize for answering my own post, but I realized that Typo has a WS
backend and provided a good starting point to both of these questions.

If Typo were redesigned today, would it use Jamis' new web service stuff
to embed the WS in the regular controllers?

   Jake
Adam K. (Guest)
on 2006-06-05 20:13
(Received via mailing list)
On Jun 5, 2006, at 9:22 AM, Jake J. wrote:
> I apologize for answering my own post, but I realized that Typo has
> a WS
> backend and provided a good starting point to both of these questions.
>
> If Typo were redesigned today, would it use Jamis' new web service
> stuff
> to embed the WS in the regular controllers?

Typo implements XML-RPC APIs.  While most web services use REST or
SOAP, XML-RPC is wildly popular in the world of APIs for blogging
software such as Typo.

So you're really talking apples to oranges here.  If Typo were to be
redesigned tomorrow, it would still need to do XML-RPC.  However, if
they wanted to add Atom Publishing Protocol support, which is a REST
API, they would probably benefit from one of the RESTful plugins.

--
~akk
http://therealadam.com
Jake J. (Guest)
on 2006-06-06 00:04
Adam K. wrote:
> Typo implements XML-RPC APIs.  While most web services use REST or
> SOAP, XML-RPC is wildly popular in the world of APIs for blogging
> software such as Typo.
>
> So you're really talking apples to oranges here.  If Typo were to be
> redesigned tomorrow, it would still need to do XML-RPC.  However, if
> they wanted to add Atom Publishing Protocol support, which is a REST
> API, they would probably benefit from one of the RESTful plugins.


Interesting.  Being new to this, I didn't realize the impact that
choosing the API would have.

So, my problem with embedding the API control into each controller
action (or at least the ones that support APIs) is that blurs the line
between the application and the API.  I wonder how others feel about
this line becoming blurred.

I recognize that putting this logic within the controller makes it more
"DRY".

   Jake
This topic is locked and can not be replied to.