Connecting to web services using Rails (HTTP requests)?

前端 未结 6 1675
终归单人心
终归单人心 2021-02-06 10:45

I am using Ruby on Rails 3 and I am trying to implement APIs to retrieve account information from a web service. That is, I would like to connect to a web service that has the A

6条回答
  •  我在风中等你
    2021-02-06 11:21

    Yes, since you're using RESTful routes, they are your basic API. You're also returning structured JSON data easily consumable by an application.

    There are other ways to implement a web services API (e.g. SOAP), but this is a good and proper way.

    Since it's a web services API, connecting to the correct URL and parsing the response is the way to go on the client side. Though if you need to access many different resources it might be a good idea to create a flexible way of building the request URL.

提交回复
热议问题