I have an endpoint for checking the username availability.
checking the username availability
How would you design the response of that endpoint. Normally I will say if the username is available or not but I am having a hard time thinking the data schema for that endpoint response
I see two ways.
Use another API for that task. You talk to https://api.example.com for normal business and use https://util.example.com for small tasks that are not based on resource manipulation.
Make a request to something like https://api.example.com/users?filter[username]=myusername and if a resource is returned, then that means that the username is taken.