const endpointURL = /2/users/by/username/${body.userName}?user.fields=profile_image_url,name;

const res = await axios(endpointURL, {
headers: {
authorization: Bearer ${token},
},
});
console.log(“success status”, res.status);
console.log(“data”, res.data);

============
log is
success status 200

data {
errors: [
{
detail: ‘Could not find user with username: [3232eeee].’,
title: ‘Not Found Error’,
resource_type: ‘user’,
parameter: ‘username’,
value: ‘3232eeee’,
type: ‘2/problems/resource-not-found’
}
]
}

is it normal that response is with status 200 ?? i think it should be 404.

1 Like

Thanks for your feedback here. I’ll pass this on.

I’ve spoken with our API design team about this in the past, and the idea is that since the request is technically valid and would work with another username, we use the error object to show this. If you have suggestions for us to consider for the future, please let us know via our feedback channel.

Thanks again!

1 Like