Skip to content

Enable retrieving and modifying a resource by id #485

@just-be-dev

Description

@just-be-dev

Currently we have no way of retrieving or acting on a resource if we have its id. To remedy that we should implement a suite of endpoints to act on resources given the id. Having an id is unique in that you don't have to do a path resolution to find the resource (given that ids are globally unique to a resource).

As originally suggested by @davepacheco, we've agreed on /by_id/<resource>/<id> as the general shape of the API. It makes sense to have GET, PUT, and DELETE actions for each of these resources.

Previous approach

When calling an API endpoint we should allow name or id to be used interchangeably. We've had several discussions about this in the past. @davepacheco mentioned using id:<uuid> as a pattern for specifying ids in the route.

I'd personally like to add a restriction to names such that a name can't be a valid UUID in order to avoid confusion there. We could go further by creating a wrapping enum Identifier type which looks like

enum Identifier {
  Id(Uuid),
  Name(String)
}

which would be type that the api expects as a resource identifier. That would then be converted from the api callsite down into an id to be passed to the rest of the internal calls.

Regardless of the implementation I do feel strongly we should have some mechanisms for being able to make requests by id especially given that we have no mechanism for tracing resource renames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelated to the API.mvp

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions