techquestion
techquestion

Reputation: 489

Infrastructure question: How to send/receive data to another website with my rails application?

It's the first time I'm trying this, but I don't know where to start/how to do it. I seem to be lacking some general knowledge on API requests (and their flow) in order to understand the documentation. Therefore, I have some (probably basic) questions on the topic.

Context

In my Ruby on Rails app, bike rental companies can manage all their bikes (reservations, payments etc.).

Goal

I would like to offer a bike rental companies the option to implement a booking form on their own website, so they can let customers make a reservation for a specific bike.

This booking form would then take prices and available bikes from my Rails app to their website and consequently send new reservation data back to the Rails app.

Questions

On the flow of API calls:

On the folder/action structure for an API call:

Upvotes: 0

Views: 89

Answers (1)

Abolfazl Mahmoodi
Abolfazl Mahmoodi

Reputation: 390

you should create api by the following steps:

  1. in the form of website, user fill information and submit them
  2. in the submit action it should call your Rails API (you should create a controller Api::BikesController and an action for example bikes_info). bikes_info API called.
  3. bikes information sent in response of API
  4. web sile get the information display to the user and user select one of that option and click submit button and second API called from your app
  5. "reserve" is the second API name in your app. you should get reservation info and save data in DB and send response to the web site

Upvotes: 1

Related Questions