bloxbean/yaci-store

[Account Api] Balance api endpoint needs address as both path param and query param.

Closed this issue · 0 comments

The following address balance api returns 404

http://localhost:8080/api/v1/addresses/addr_test1qryvgass5dsrf2kxl3vgfz76uhp83kv5lagzcp29tcana68ca5aqa6swlq6llfamln09tal7n5kvt4275ckwedpt4v7q48uhex/balance

Cause:

As @PathVariable annotation is missing in the method signature, controller also needs a query parameter address in the endpoint.

  @GetMapping("/addresses/{address}/balance")
  @Operation(description = "Get current balance at an address")
   public Optional<AddressBalanceDto> getAddressBalance(String address) {

The following url works.

http://localhost:8080/api/v1/addresses/addr_test1qryvgass5dsrf2kxl3vgfz76uhp83kv5lagzcp29tcana68ca5aqa6swlq6llfamln09tal7n5kvt4275ckwedpt4v7q48uhex/balance?address=addr_test1qryvgass5dsrf2kxl3vgfz76uhp83kv5lagzcp29tcana68ca5aqa6swlq6llfamln09tal7n5kvt4275ckwedpt4v7q48uhex

Fix:

Add @PathVariable annotation to method parameter. Also verify other methods in the AccountController