Most formats used by retrieve APIs have a bytes available field and a bytes returned field. The bytes available field contains the length in bytes of all the data available to be returned to the user. The bytes returned field contains the length in bytes of all the data that is actually returned to the user.
All available data is returned if enough space is provided in the receiver variable. If the size of the receiver variable is at least large enough to contain all of the data, the bytes returned field equals the bytes available field. If the receiver variable is not large enough to contain all of the data, the bytes available field contains the number of bytes that can be returned.
Your code could check the values for both the bytes available and bytes returned fields. If the bytes available field is greater than the bytes returned field, the API had more information to return than what would fit in the receiver variable. This could occur, over time, because the APIs that you use may be enhanced with new releases. The API may also have more information to return if the receiver variable is being used to return a variable-length field (or array) and a very large value was returned on this API call. If both values are the same, the API returned all the information.
Depending on the capabilities of your high-level language, some API users take advantage of the following technique to avoid guessing the appropriate size for the receiver variable:
This technique provides for highly flexible use of APIs that can return variable amounts of data.