User
This is an object representing an User. The API allows you to retrieve individual User as well as a list of them using various filters. Furthermore it lets you update and delete an User.
#
The User object#
Attributesinteger#
idUnique identifier for an User.
string#
usernameThe User's username.
string confidential#
emailThe User's email.
note
This field is obscured1 to not-authorized in order to avoid email adresses' collecting behaviours.
bool confidential#
email_verifiedIndicates if the User has already confirmed their email.
note
This field is obscured1 to not-authorized.
enum#
roleThe User's role inside AniAPI.
"BASIC": 0,"MODERATOR": 1,"ADMINISTRATOR": 2
string#
avatarThe User's avatar. This value is imported from external User's trackers.
enum#
genderThe User's gender.
"UNKNOWN": 0,"MALE": 1,"FEMALE": 2
string confidential#
localizationThe User's preferred locale reference.
info
Check on Resource for further details on locales.
bool nullable#
has_anilistIndicates if the User has linked their AniList account with AniAPI.
bool nullable#
has_malIndicates if the User has linked their MyAnimeList account with AniAPI.
#
Example{ "username": "Dazorn", "role": 0, "gender": 1, "avatar": "https://s4.anilist.co/file/anilistcdn/user/avatar/large/b192651-setw7IgPvmZS.jpg", "id": 1}
#
Retrieve a specific UserRetrieves an User, based on its unique identifier.
#
ParametersNo parameters.
#
ReturnsReturns an obscured1 User object if a valid identifier was provided.
#
Try it
#
Get a list of UserReturns a list of obscured1 User objects.
The Users are returned sorted by username
, following alphabetical ascending order.
#
Parametersstring optional#
usernameA case-insensitive pattern filter on the list based on the username
field value.
string optional#
emailA case-sensitive filter on the list based on the email
field value.
#
ReturnsReturns an array of obscured1 User objects with a size based on the filter provided.
#
Try it
#
Update an Userwarning
We recommend you to not implement an User's update data form.
Instead, we strongly suggest you to redirect the User to the profile web page and to let us do the rest ♥.
Updates an User based on the provided values.
#
Parametersinteger required#
idThe User's id to update
string optional#
passwordThe User's new password value.
enum required#
genderThe User's gender value.
string optional#
localizationThe User's new localization value.
integer optional#
anilist_idThe User's AniList account external id.
string optional#
anilist_tokenThe User's AniList account external token.
This value becomes required
when you provide the anilist_id
field.
#
ReturnsReturns the updated User object.
#
Examplefetch('https://api.aniapi.com/v1/user', { method: 'POST', headers: { 'Authorization': 'Bearer <YOUR_JWT>', 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: { id: 1, gender: 1, localization: 'it' }});
{ "status_code": 200, "message": "User updated", "data": { "username": "Dazorn", "role": 0, "gender": 1, "localization": "it", "has_anilist": true, "has_mal": false, "id": 1 }, "version": "1"}
#
Delete an UserDeletes an User based on the provided unique identifier.
#
ParametersNo parameters.
#
ReturnsNo particular return.
#
Examplefetch('https://api.aniapi.com/v1/user/1', { method: 'DELETE', headers: { 'Authorization': 'Bearer <YOUR_JWT>', 'Content-Type': 'application/json', 'Accept': 'application/json' }});
{ "status_code": 200, "message": "User deleted", "data": "", "version": "1"}
- An obscured object has certain fields hidden↩