Best practices with Web Services

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

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

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

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

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