Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor API to follow REST conventions #1449

Open
4 tasks
johndeange opened this issue Sep 11, 2023 · 3 comments
Open
4 tasks

Refactor API to follow REST conventions #1449

johndeange opened this issue Sep 11, 2023 · 3 comments
Labels
tech-debt Resolved technical debt (tooling, configuration, or workflow)

Comments

@johndeange
Copy link
Contributor

johndeange commented Sep 11, 2023

Goals

  • Endpoints should not have /endpoint/1/blah
    This should follow the following ruleset:

Should an endpoint exist

  • Does it perform business logic checks?

  • Does it perform a complex calculation?

  • Is that resource used in more than 2 places in the frontend?

  • Is it NOT only for rendering data cleaner (reducing the need for additional endpoint calls)?

  • Responses should return ids or urls

@johndeange johndeange added the tech-debt Resolved technical debt (tooling, configuration, or workflow) label Sep 11, 2023
@tdonaworth
Copy link
Collaborator

This is specifically referring to Resource Nesting - and doing it efficiently; There's no hard rule that says it has to be limited to one level, but that is the "preferred" path.
👍

@tdonaworth
Copy link
Collaborator

tdonaworth commented Sep 11, 2023

Examples:
1 /agreements/{id}/history returns the Agreement History records
Instead create
2 /agreement-history/{id} <-- Preferred based on AuthZ (for our discussion, this is considered BL) - until deemed otherwise.
3 /history?agreement_id={id} <-- could still be used, but preference would be as a redirect, or only for raw data consumption.

/portfolios/{id}/calcFunding --> /portfolio-funding/{id} <-- this one lives as a result of business-logic calculations
/portfolios/{id}/cans/ --> /cans?portfolio_id={id} <-- this one is a query filter

/bli-table-view?bli_id={id} BLI Summary Resource

Should an endpoint exist

  • Does it perform business logic checks?
  • Does it perform a complex calculation?
  • Is that resource used in more than 2 places in the frontend?
  • Is it NOT only for rendering data cleaner (reducing the need for additional endpoint calls)?

@tdonaworth
Copy link
Collaborator

Responses should return ids or urls

  • For now continue to use ids, but if future support for uri is needed, no objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-debt Resolved technical debt (tooling, configuration, or workflow)
Projects
None yet
Development

No branches or pull requests

2 participants