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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:01:41+00:00 2026-06-15T04:01:41+00:00

Let us consider we have an api for zoos such that ../api/zoos which goes

  • 0

Let us consider we have an api for zoos such that ../api/zoos which goes all the way to accessing individual animals in a given zoo such as ../api/zoos/123/elephants/234 i.e there are well defined apis for each animal type.
    Now if we want to query at the super type ( abstract class Animal where class Elephant extends Animal) , is exposing an api of the sort ../api/zoos/123/animals?type="mammal"&legs=4 for such meta-queries a good idea ?
    What makes me think twice about such an approach is while super-type api is practically useful for metaqueries across the concrete types but this essentially is a read-only query, also from the extensibility point of view say between the super type Animal and concrete type Elephant there can be many other types like Mammal, FourLegged etc. which can be individually queried then a call needs to be taken on whether or not read-only apis needs to be exposed on these as well or we have a type parameter on animal query that does the job. Please suggest.

  • 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-15T04:01:43+00:00Added an answer on June 15, 2026 at 4:01 am

    Do you have seperate IDs for each species of animal?
    I mean, is there an Elephant ID=4 and a Tiger ID=4?

    If not, I would structure this as /zoos/123/animals/234

    You could then do /zoos/123/animals?species=elephant to list all elephants, and get back an array of links with IDs that might look somewhat random: { /zoos/123/animals/5, /zoos/123/animals/19, /zoos/123/animals/34, /zoos/123/animals/35, /zoos/123/animals/72 }

    If you do have conflicting IDs across species, then I would suggest creating a new resource mapping of Animal IDs to Species IDs:

    +----------------------------+
    |animal_id|species|species_id|
    +----------------------------+
    |       1 |  duck |        1 |  => the first duck is /animals/1
    |       2 |  frog |        1 |  => the first frog is /animals/2
    +----------------------------+
    

    Then you can still use the URL structure /zoos/123/animals/234. You would have no need to refer to the frog as /frogs/1 as a page such as /animals?order=anura&page=1&limit=10 would have given you a link directly to /animals/2

    In summary, IDs belong in your superclass

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

Sidebar

Related Questions

Let's consider that I have some Class A which has property of class B.
Let's consider we have QWidget that contains QTableWidget (only). So we want to resize
Consider that I have 1 resource and 2 urls (let's say new one and
Let's consider we have a QWidget and a QLayout named general_layout that contains other
Let's consider the following scenario. I have the following page where all rendered elements
Let's consider that I want to extend an existing JSF component, such as the
I have an unusual problem. Let's consider such models (taken from django docs): class
Let us consider that we have Categories (with PK as CategoryId) and Products (with
Please let me know which one is good Consider I have a class like
In windows API to create process we have CreateProcess function. Now let's consider we

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.