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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:50:45+00:00 2026-05-14T21:50:45+00:00

I am designing a REST API where some resources can be filtered through query

  • 0

I am designing a REST API where some resources can be filtered through query parameters. In some cases, these filter values would be resources from the same REST API. This makes for longish and pretty unreadable URIs. While this is not too much of a problem in itself because the URIs are meant to be created and manipulated programmatically, it makes for some painful debugging. I was thinking of allowing shortcuts to URIs used as filter values and I wonder if this is allowed according to the REST architecture and if there are any best practices.

For example:

I have a resource that gets me Java classes. Then the following request would give me all Java classes:

GET http://example.org/api/v1/class

Suppose I want all subclasses of the Collection Java class, then I would use the following request:

GET http://example.org/api/v1/class?has-supertype=http://example.org/api/v1/class/collection

That request would return me Vector, ArrayList and all other subclasses of the Collection Java class.

That URI is quite long though. I could already shorten it by allowing hs as an alias for has-supertype. This would give me:

GET http://example.org/api/v1/class?hs=http://example.org/api/v1/class/collection

Another way to allow shorter URIs would be to allow aliases for URI prefixes. For example, I could define class as an alias for the URI prefix http://example.org/api/v1/class/. Which would give me the following possibility:

GET http://example.org/api/v1/class?hs=class:collection

Another possibility would be to remove the class alias entirely and always prefix the parameter value with http://example.org/api/v1/class/ as this is the only thing I would support. This would turn the request for all subtypes of Collection into:

GET http://example.org/api/v1/class?hs=collection

Do these “simplifications” of the original request URI still conform to the principles of a REST architecture? Or did I just go off the deep end?

ADDENDUM:
There might be more than one filter in the URI at once. Either as different parameters, or as a list of values for a single parameter.
Think along the lines of “All classes that implement Interface X and/or Interface Y” or “All classes that implement Interface X and are in package A.B.C” (where packages would also be addressable to a URI like http://example.org/api/v1/packages/a/b/c)

  • 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-14T21:50:46+00:00Added an answer on May 14, 2026 at 9:50 pm

    I’d go for making:

    GET http://example.org/api/v1/class/java.util.Collection/subclasses
    

    return a list of links to other entries in your RESTful API, one for each direct subclass. I’d also make that information available as part of the descriptor returned by:

    GET http://example.org/api/v1/class/java.util.Collection
    

    (That would also include a link to the preceding specific query.)

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

Sidebar

Related Questions

I'm working on designing a REST API that can respond with a variety of
I am designing a REST API one of my resources is all about to
I'm designing a web service that serves up JSON through a REST API. This
I'm designing a REST API, and I would like to know the proper way
I am designing a rails rest API that I would like to expose either
I'm designing a REST API. What response should a server send to mean I've
I am designing a REST API for a web application. I want to clearly
I am designing a REST API and I wonder what the recommended way to
I am designing a REST api for one of my applications & considering using
We are currently designing a REST API that we want to publish in a

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.