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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:05:41+00:00 2026-05-15T21:05:41+00:00

Suppose you are working on an API, and you want nice URLs. For example,

  • 0

Suppose you are working on an API, and you want nice URLs. For example, you want to provide the ability to query articles based on author, perhaps with sorting.

Standard:

GET http://example.com/articles.php?author=5&sort=desc

I imagine a RESTful way of doing this might be:

GET http://example.com/articles/all/author/5/sort/desc

Am I correct? Or have I got this REST thing all wrong?

  • 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-15T21:05:43+00:00Added an answer on May 15, 2026 at 9:05 pm

    You are mostly right. The thing with REST api’s is to focus on the nouns.

    What does the noun all do in this case? Wouldn’t you expect your API to always return all articles, unless you filter it?

    I would make sort a query string parameters, further, I would make any and all filtering query string parameters. If you look at how Stack is implemented when you click on the “Newest” questions link, you get a query string to filter the questions.

    So perhaps something like:

    GET http://example.com/aritcles/authors/5?sort=desc

    But also think about what happens with each URL:

    GET http://example.com/aritcles/ might return all current articles

    GET http://example.com/aritcles/authors/ What does this url do? does it return all authors of all articles, or does it return all the articles for all authors (which is essentially the same functionality of the URL above.)

    GET http://example.com/aritcles/authors/5/ might return all articles by author 5, or does it return author 5’s information?

    I would maybe change it to:

    http://example.com/aritcles returns all articles
    http://example.com/aritcles/5 returns all articles from author 5
    http://example.com/authors returns all authors
    http://example.com/authors/5 returns information for author 5

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

Sidebar

Related Questions

For an API that I am working on, I want to allow the user
Suppose you're working on a project and the time/money budget does not allow 100%
Suppose I'm working on a MongoMapper class that looks like this: class Animal include
I suppose this question is more general than working with COM components. I have
hi i am working on a shellscript.. suppose this is the data my shell
now I am working with python. So one question about dict .... suppose I
I am working with an api that requires me to post xml to url
I'm working with the Google Docs API in my iPhone application. I've sent the
I have api keys which i don't want to show in public but still
I'm working on a location-based web app (learning purposes), where users will rate local

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.