Skip to content

“/participations/{ID}/participants” sometimes fails for valid participation IDs #73

@tripu

Description

@tripu

eg, /participations/14935/participants?embed=true

Looking at some examples, I suspect that this query errors with a 404 when the participation is of type individual==true. It kind of makes sense, but this is the only case I've found until now in the API where I cannot fetch a (seemingly valid, logical) URL and be sure that it'll return something (a valid envelope containing an empty array, if nothing else).

Until I noticed this, a client like Unitas could reliably hard-code all the hierarchy of objects and that worked in all cases. This breaks that assumption, and makes it a bit more complicated on my side1.

Can we have this method always return something valid (an empty list of participants, instead of 404)? Does it make sense?


1 To discover related URLs dynamically à la HAL looks like the right thing to do, instead of hard-coding fields etc. But in practice, there would be several disadvantages to that:

  • URIs could not be fetched in parallel if we had to wait for the result of each request to arrive, be interpreted, and extract all subsequent URLs from it.
  • There are exceptions and special treatments anyway, so we can't avoid hard-coding names of properties and fields: we can't display user photos the same way we display textual fields; some values like dates, URLs or descriptions containing markup need manipulation/escaping; there are properties that need special treatment like self, _embedded, _links; IDs need to be translated into human-friendly labels (eg, “editor's draft” instead of editor-draft).
  • Not all related URLs are sent inside _links (eg, info about a group does not include links to its services nor its users, even when it has some), so unless that relation is hard-coded, it won't be discovered by a client (am I right about this?).

Because of all those “irregularities” or special needs, I ended up hard-coding the hierarchy of objects in Unitas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions