bee icon indicating copy to clipboard operation
bee copied to clipboard

Add "ledgerIndex" field to some REST HTTP and MQTT API responses

Open samuel-rufi opened this issue 3 years ago • 1 comments

There are endpoints in the API that return the "current" balance of an address or the state of an output.

For the caller it's hard to figure out what that "current" point in time was. Thats why an additional field was introduced to bind the balance or the output state to the milestone index at which the request was made. The index must be locked for the request. This sorting in time is especially helpful for balance reconcilation use-cases.

Example response:

{
  "data": {
    "addressType": 0,
    "address": "efdc112efe262b304bcf379b26c31bad029f616ee3ec4aa6345a366e4c9e43a3",
    "balance": 1338263,
    "dustAllowed": true,
    "ledgerIndex": 422153
  }
}

To summarize, the field should be added to the responses of following REST API endpoints:

/api/v1/addresses/{address}
/api/v1/addresses/ed25519/{address}
/api​/v1​/addresses​/{address}​/outputs
/api​/v1​/addresses​/ed25519/{address}​/outputs
/api/v1/outputs/{outputId}

Also, the field should be added to the relevant MQTT responses.

samuel-rufi avatar May 31 '21 16:05 samuel-rufi

REST API calls are done, MQTT ones are missing

samuel-rufi avatar Jul 05 '21 19:07 samuel-rufi