Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:18:46+00:00 2026-06-03T11:18:46+00:00

I am building an api for others to use. This is a simple enough

  • 0

I am building an api for others to use. This is a simple enough Json request the user passes as some data and we pass some back.

What I would love is to secure our api and have some sort of user system where we can turn users on and off and we can log how many requests each user makes.

What would be the best way to do this in Rails? I don’t want it to slow down the request. I can see ways of doing it using devise maybe but would be great to hear other people’s opinions.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:18:48+00:00Added an answer on June 3, 2026 at 11:18 am

    I’ve done this before using the Token Authentication capabilities of devise (see https://github.com/plataformatec/devise ).

    I found the following setup works:

    • Create a user account for each api user.
    • Configure devise for token authentication
    • Set the Token Authentication configuration to require the token to be submitted with each request.

    This will allow you to enable and disable individual users as well as to track every request back to the api user that made the call.

    If you’re really interested in tracking usage you may want to consider also creating a database table where you track all api requests. This can be setup to belong_to the users table so that you easily find all requests from different users (e.g., @user.api_requests).

    The count of all requests made by a user would be:

    @user.api_requests.count
    
    # or use a where clause to find how many of each type
    @user.api_requests.where("api_request_type = ?", 'SomeAPICallType').count
    

    One final note — I recently used the Grape library for building out an API. I thought it was pretty well done and it worked great for our needs. I especially like the ability it provided to version APIs. Details are here: https://github.com/intridea/grape/wiki

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a REST API. All GET methods currently use JSON as response
I am building a web service API, using JSON as the data language. Designing
Is there a compression API available for use on the iPhone? We're building some
I'm building an application that uses an elaborate API to fetch data from Youtube,
I'm currently building a library around the Google Analytics Data Export API. When i'm
I'm building a simple appliacation using the Google Maps API and I'm trying to
This I think is related to my use of the nlog C++ API (and
For parsing JSON like this twitter API users/show response I've been using Jackson and
I'm building a Rails app that needs some data visualization. What is a good
I am building an API, one of its feature is the use of HTTP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.