let's say i have an API that returns users wallet balance and List of wallet transactions which is going to expiry
response = {
user_balance: 20
expiring_credits : [
{object 1 }
{object 2}
]
}
in case if user dont have any expiring transactions we can format respose in 2 ways option 1
response = {
user_balance: 20
}
option 2
response = {
user_balance: 20
expiring_credits : []
}
which is the ideal option or best practices? and why? looking for some expert insights. many thanks.
from REST API Best practice ? return Empty object vs no object
No comments:
Post a Comment