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

REST Api call /v1/pool/batch/snapshots should work without parameters #204

Closed
mutatrum opened this issue Jan 22, 2021 · 0 comments · Fixed by #210
Closed

REST Api call /v1/pool/batch/snapshots should work without parameters #204

mutatrum opened this issue Jan 22, 2021 · 0 comments · Fixed by #210
Assignees
Labels
enhancement New feature or request REST API

Comments

@mutatrum
Copy link

The /v1/pool/batch/snapshots has two parameters, start_batch_id and num_batches_back. Without the parameters, the call doesn't work:
/v1/pool/batch/snapshots -> Not Found
/v1/pool/batch/snapshots/ -> Not Found
/v1/pool/batch/snapshots// -> JSON formatted error: type mismatch, parameter: num_batches_back
/v1/pool/batch/snapshots//1 -> Returns last batch snapshot.

This is a non-standard URL pattern. A more standard pattern would be to have num_batches_back as a query parameter and have the path parameter start_batch_id optional.

/v1/pool/batch/snapshots -> return array with last batch
/v1/pool/batch/snapshots/ -> return array with last batch
/v1/pool/batch/snapshots?num_batches_back=5 -> return array with last 5 batches
/v1/pool/batch/snapshots/deadbeef -> return array with batch deadbeef
/v1/pool/batch/snapshots/deadbeef?num_batches_back=5 -> return array with 5 batches starting from batch deadbeef

get: "/v1/pool/batch/snapshots/{start_batch_id}/{num_batches_back}"

@guggero guggero added enhancement New feature or request REST API labels Jan 22, 2021
@guggero guggero self-assigned this Jan 22, 2021
guggero added a commit to guggero/pool that referenced this issue Jan 26, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Jan 27, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Jan 28, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Jan 28, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Jan 28, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Jan 29, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
guggero added a commit to guggero/pool that referenced this issue Feb 2, 2021
Fixes lightninglabs#204 by allowing multiple REST URI patterns for the batch
snapshots call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request REST API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants