sidebar_position |
---|
5 |
import ApiCodeBlock from '../../src/components/ApiCodeBlock'; import Highlight from '../../src/components/Highlight'; import ApiTryIt from '../../src/components/ApiTryIt';
export const endpoints = [ { method: 'GET', uri: '/v1/user/:id' }, { method: 'GET', uri: '/v1/user' }, { method: 'POST', uri: '/v1/user' }, { method: 'DELETE', uri: '/v1/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.
Unique identifier for an User.
The User's username.
The User's email.
:::note
This field is obscured1 to not-authorized in order to avoid email adresses' collecting behaviours.
:::
Indicates if the User has already confirmed their email.
:::note
This field is obscured1 to not-authorized.
:::
The User's role inside AniAPI.
"BASIC": 0,
"MODERATOR": 1,
"ADMINISTRATOR": 2
The User's avatar. This value is imported from external User's trackers.
The User's gender.
"UNKNOWN": 0,
"MALE": 1,
"FEMALE": 2
The User's preferred locale reference.
:::info
Check on Resource for further details on locales.
:::
Indicates if the User has linked their AniList account with AniAPI.
Indicates if the User has linked their MyAnimeList account with AniAPI.
{
"username": "Dazorn",
"role": 0,
"gender": 1,
"avatar": "https://s4.anilist.co/file/anilistcdn/user/avatar/large/b192651-setw7IgPvmZS.jpg",
"id": 1
}
Retrieves an User, based on its unique identifier.
No parameters.
Returns an obscured1 User object if a valid identifier was provided.
export const retrieveUserParams = [ { name: ':id', type: 'number', placeholder: ':id', value: '1' } ];
Returns a list of obscured1 User objects.
The Users are returned sorted by username
, following alphabetical ascending order.
A case-insensitive pattern filter on the list based on the username
field value.
A case-sensitive filter on the list based on the email
field value.
Returns an array of obscured1 User objects with a size based on the filter provided.
export const getListUserParams = [ { name: 'username', type: 'text', placeholder: 'username', value: 'Daz' }, { name: 'email', type: 'text', placeholder: 'email', value: '' } ];
:::warning
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.
The User's id to update
The User's new password value.
The User's gender value.
The User's new localization value.
The User's AniList account external id.
The User's AniList account external token.
This value becomes required
when you provide the anilist_id
field.
Returns the updated User object.
fetch('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"
}
Deletes an User based on the provided unique identifier.
No parameters.
No particular return.
fetch('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"
}