# Best practices with Web Services

**URL:** <https://www.ruby-forum.com/t/best-practices-with-web-services/62490>\
**Category:** Rails\
**Created:** [June 5, 2006, 3:54pm UTC](https://www.ruby-forum.com/t/best-practices-with-web-services/62490 "2006-06-05T15:54:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [June 5, 2006, 3:54pm UTC](https://www.ruby-forum.com/t/best-practices-with-web-services/62490/1 "2006-06-05T15:54:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [June 5, 2006, 4:22pm UTC](https://www.ruby-forum.com/t/best-practices-with-web-services/62490/2 "2006-06-05T16:22:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [June 5, 2006, 6:13pm UTC](https://www.ruby-forum.com/t/best-practices-with-web-services/62490/3 "2006-06-05T18:13:17Z")

</div>

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 Keys is typing](https://therealadam.com/)**
>
> Developer and engineering manager at large

---

<div class="post-metadata">

**Author:** ![janovetz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/53a042/32.png) [@janovetz](https://www.ruby-forum.com/u/janovetz)\
**Post date:** [June 5, 2006, 10:04pm UTC](https://www.ruby-forum.com/t/best-practices-with-web-services/62490/4 "2006-06-05T22:04:32Z")

</div>

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
