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 6371819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:08:18+00:00 2026-05-25T01:08:18+00:00

I was designing a web app and then stopped to think about how my

  • 0

I was designing a web app and then stopped to think about how my api should be designed as a RESTful web service. For now, most of my URI’s are generic and might apply to various web apps:

GET  /logout   // destroys session and redirects to /
GET  /login    // gets the webpage that has the login form
POST /login    // authenticates credentials against database and either redirects home with a new session or redirects back to /login
GET  /register // gets the webpage that has the registration form
POST /register // records the entered information into database as a new /user/xxx
GET  /user/xxx // gets and renders current user data in a profile view
POST /user/xxx // updates new information about user

I have a feeling I’m doing a lot wrong here after poking around on SO and google.

Starting with /logout, perhaps since I don’t really GET anything – it may be more appropriate to POST a request to /logout, destroy the session, and then GET the redirect. And should the /logout term stay?

What about /login and /register. I could change /register to /registration but that doesn’t alter how my service fundamentally works – if it has deeper issues.

I notice now that I never expose a /user resource. Perhaps that could be utilized somehow. For instance, take the user myUser:

foo.com/user/myUser

or

foo.com/user

The end user doesn’t require that extra verbosity in the URI. However, which one is more appealing visually?

I noticed some other questions here on SO about this REST business, but I would really appreciate some guidance on what I’ve laid out here if possible.

Thanks!

UPDATE:

I would also like some opinions on:

/user/1

vs

/user/myUserName
  • 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-05-25T01:08:20+00:00Added an answer on May 25, 2026 at 1:08 am

    One thing sticks out in particular as not REST-ful: the use of a GET request for logging out.

    (from http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Safe_methods)

    Some methods (for example, HEAD, GET, OPTIONS and TRACE) are defined as safe, which means they are intended only for information retrieval and should not change the state of the server. In other words, they should not have side effects, beyond relatively harmless effects such as logging, caching, the serving of banner advertisements or incrementing a web counter. […]

    [… H]andling [of GET requests] by the server is not technically limited in any way. Therefore, careless or deliberate programming can cause non-trivial changes on the server. This is discouraged, because it can cause problems for Web caching, search engines and other automated agents […]

    As for logging out and redirecting, you could have a post to your logout URI give a 303 response redirecting to the post-logout page.

    http://en.wikipedia.org/wiki/Post/Redirect/Get

    http://en.wikipedia.org/wiki/HTTP_303

    Edit to address URL design concerns:

    "How do I design my resources?" is an important question to me; "how do I design my URLs?" is a consideration in two areas:

    URLs that users will see should not be too ugly and meaningful if possible;
    if you want cookies to be sent in requests to some resource but not others, you’ll want to structure your paths and cookie paths.

    If JRandomUser wants to look at his own profile and you want the URL to be prettier than foo.com/user/JRandomUser or foo.com/user/(JRandom's numeric user id here), you could make a separate URL just for a user to look at their own information:

    GET foo.com/profile /*examines cookies to figure out who 
                         * is logged in (SomeUser) and then 
                         * displays the same response as a
                         * GET to foo.com/users/SomeUser.
                         */
    

    I would claim ignorance much more readily than wisdom on this subject, but here are a few resource design considerations:

    1. Consumer: which resources are meant to be viewed directly in a browser, loaded via XHR, or accessed by some other kind of client?
    2. Access / identity: does the response depend on cookies or referrers?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi I just finished designing a mobile web app and now want to start
I'm designing a RESTful Web app that will provide an authentication system for several
When designing an API for our web app, we'll use the their subdomain as
We're designing the URL structure for our web app and want to use RESTful,
I'm designing a Java based web-app and I need a key-value store. Berkeley DB
I'm designing a web service in ASP.NET and VS2008, and am using typed datasets
I am designing a python web app, where people can have an email sent
I am in the process of designing web-app, and would like to know what
I'm designing some web app, I went for some _layout.cshtml, which fragment: //some html
I'm on the process of designing a web application based on Google App Engine

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.