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

API routes design proposal to allow batch requests #3949

Closed
sabau opened this issue Mar 20, 2019 · 4 comments
Closed

API routes design proposal to allow batch requests #3949

sabau opened this issue Mar 20, 2019 · 4 comments

Comments

@sabau
Copy link
Contributor

sabau commented Mar 20, 2019

Currently there is a single route in slashing, so we can just forget about signing_info but I think we should re-think our routing a bit to allow this kind or requests easily.

Either having a keyword that says all but it's hacky and if we validate addresses or other parameters it won't work easily, we have to add conditions for that all around.

Usually I would like instead to push variables as close to the end as possible to avoid those cases, as when you do when you use the CLI.
/slashing/validators/{validatorPubKey}/signing_info -> /slashing/validators/signing_info/{validatorPubKey}

Or in distribution for example in:
/distribution/delegators/{delegatorAddr}/rewards -> /distribution/delegators/rewards/{delegatorAddr}
/distribution/delegators/{delegatorAddr}/rewards/{validatorAddr} -> /distribution/delegators/rewards/{delegatorAddr}/{validatorAddr}

Originally posted by @sabau in #3226 (comment)

@sabau
Copy link
Contributor Author

sabau commented Mar 20, 2019

I would propose not to do that before we split the repositories but this may come with some benefit:

  • increase a bit the power to represent single items VS list of items all over, with no special cases
  • same logic as CLI,

@alexanderbez
Copy link
Contributor

Thanks @sabau! See my comment here: #3226 (comment). I think there are defintely places where we can improve our routing as you've suggested. But we should strive to maintain the RESTful nature of the endpoints too :)

@sabau
Copy link
Contributor Author

sabau commented Mar 20, 2019

Regarding that it's true if you see the delegator as resource and the reward as detail of that.
I was imagining to see the list of rewards as list or resources and a particular delegator as single resource.

But also with this reasoning we can't cover 100% cases

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants