Agendrix's public API Ruby on Rails integration example
This project is an example of how to integrate with Agendrix's public API, from the OAuth authentication to making calls to the API itself. The example is built with Ruby on Rails.
This application is a good example of:
- how to interact with Agendrix's OAuth provider.
- how to securely store your tokens received from the OAuth provider.
- how to make calls to Agendrix's API.
- the refresh flow implementation, mandatory when using Agendrix's API (the access tokens have a TTL of 2 hours).
This application is NOT:
- An example of the best programming practices for a web app. The goal here is really to give a good idea of what you need in order to integrate with the API, not what a web app should be like.
- A project meant to be copied in a production environment.
If you want to run the application yourself, follow these steps:
-
Go to the Developer Portal to retrieve your sandbox credentials.
-
In credentials.rb, change the constants
client_id
andclient_secret
for your credentials. -
In the Developer Portal interface, add the app redirect url - https://localhost:3000/integrations/agendrix/oauth/redirect - to your credentials redirect uris.
-
Make sure you have everything setup to run a Ruby on Rails app
-
Start the app:
bundle install rails s -b 'ssl://localhost:3000?key=config/ssl/localhost.key&cert=config/ssl/localhost.crt'
With:
- ruby 2.7.4
- bundler 2.4.22
Open https://localhost:3000/, and enjoy!