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

  • Home
  • SEARCH
  • 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 8812131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:32:07+00:00 2026-06-14T03:32:07+00:00

I am currently implementing a token REST service. A token is just a string,

  • 0

I am currently implementing a “token” REST service.

A token is just a string, built from some parameters, which is then hashed and expires after a certain amount of time.

I want to have an endpoint in my REST service which can validate a token, but I’m not 100% sure how to implement it in a RESTful way

  1. I assume this should be done via GET because it doesn’t change state and so long as i set cache controls correctly it can be cached for a sensible amount of time. i.e mysite.com/token/kjfhwekjfwekj
  2. What are the appropriate return codes? I would assume 200 if it is valid, but what about if it’s invalid? I feel a 400 is wrong because although the resource itself is invalid, the client isn’t calling the endpoint incorrectly. Is 404 correct here? If we think of tokens as short lived resources I guess so?
  • 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-14T03:32:08+00:00Added an answer on June 14, 2026 at 3:32 am

    GET is the correct HTTP verb to check a token.

    Assuming that ‘invalid’ for a token means that:

    1. it never existed, or
    2. it existed but does not exist anymore.

    Do you want the client of your service to be able to know the difference?

    • If yes, return 404 Not Found for case 1, and 410 Gone for case 2.
    • If no, return 404 Not Found.

    If the token exists, 200 OK is correct.

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

Sidebar

Related Questions

I'm currently implementing a RESTful API (nothing serious, just for a blog engine i'm
I am currently implementing S3 integration into my Rais application which uses Paperclip. Currently,
I'm currently implementing memcached into my service but what keeps cropping up is the
I'm currently implementing a pageview counter on some webpages using the Google Analytics API.
I am currently implementing SiteMinder for the site, which looks for a key called
I'm currently working on implementing a fuzzy search for a terminology web service and
I'm currently implementing some custom exceptions in a project and can't decide wither to
I'm currently implementing a non-renewable in-app purchase and am a little concerned over the
I'm currently implementing a JavaScript library that keeps track of the history of changes
I'm currently implementing a very complex tree structure to allow for near-instant data access,

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.