sidebar_position |
---|
6 |
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_story/:id' }, { method: 'GET', uri: '/v1/user_story' }, { method: 'PUT', uri: '/v1/user_story' }, { method: 'POST', uri: '/v1/user_story' }, { method: 'DELETE', uri: '/v1/user_story' } ];
This is an object representing an User's watch history. The API allows you to retrieve individual UserStory as well as a list of them using various filters. Furthermore it lets you create, update and delete an UserStory.
UserStory is used to synchronize data between AniAPI and external Anime tracking systems.
Unique identifier for an UserStory.
User external unique identifier.
Anime external unique identifier.
The UserStory's watching status.
"CURRENT": 0,
"PLANNING": 1,
"COMPLETED": 2,
"DROPPED": 3,
"PAUSED": 4,
"REPEATING": 5
The UserStory's watching progress.
The UserStory's current_episode
watching time in milliseconds.
{
"user_id": 1,
"anime_id": 10,
"status": 2,
"current_episode": 220,
"current_episode_ticks": 0,
"id": 27
}
Retrieves an UserStory, based on its unique identifier.
No parameters.
Returns an UserStory object if a valid identifier was provided and the authenticated User owns the rights to get it.
export const retrieveUserStoryParams = [ { name: ':id', type: 'number', placeholder: ':id', value: '1' } ];
Returns a list of UserStory objects.
The UserStories are returned sorted by creation_date
, following descending order.
:::info
As default, it will return all the UserStories owned by the request's authenticated User using the user_id
filter's field.
:::
A filter on the list based on the anime_id
field value.
A filter on the list based on the user_id
field value.
A filter on the list based on the status
field value.
A filter on the list based on the synced
field value.
synced
field indicates if an UserStory has been synchronized with User's linked trackers.
Returns an array of UserStory objects with a size based on the filter provided.
export const getListUserStoryParams = [ { name: 'anime_id', type: 'number', placeholder: 'anime_id', value: '' }, { name: 'user_id', type: 'number', placeholder: 'user_id', value: '' }, { name: 'status', type: 'number', placeholder: 'status', value: '' }, { name: 'synced', type: 'checkbox', placeholder: 'synced', value: true }, ];
Creates an UserStory based on the provided values.
The User's id that own the UserStory.
The UserStory's Anime.
The UserStory's watching status.
The UserStory's watching progress.
Must be equal or less than the Anime's episodes_count
value.
When you provide a status
equal to 1
or 2
this field is auto-calculated.
The UserStory's current_episode
watching time in milliseconds.
Returns the created UserStory object.
fetch('https://api.aniapi.com/v1/user_story', {
method: 'PUT',
headers: {
'Authorization': 'Bearer <YOUR_JWT>',
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: {
user_id: 1,
anime_id: 10,
status: 2
}
});
{
"status_code": 200,
"message": "Story created",
"data": {
"user_id": 1,
"anime_id": 10,
"status": 2,
"current_episode": 220,
"current_episode_ticks": 0,
"id": 1
},
"version": "1"
}
Updates an UserStory based on the provided values.
The UserStory's unique identifier.
The User's id that owns the UserStory.
The UserStory's Anime.
The UserStory's watching status.
The UserStory's watching progress.
Must be equal or less than the Anime's episodes_count
value.
The UserStory's current_episode
watching time in milliseconds.
Returns the updated UserStory object.
fetch('https://api.aniapi.com/v1/user_story', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_JWT>',
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: {
id: 27,
user_id: 1,
anime_id: 10,
status: 0,
current_episode: 140,
current_episode_ticks: 1200000
}
});
{
"status_code": 200,
"message": "Story updated",
"data": {
"user_id": 1,
"anime_id": 10,
"status": 0,
"current_episode": 140,
"current_episode_ticks": 1200000,
"id": 27
},
"version": "1"
}
Deletes an UserStory based on the provided unique identifier.
:::caution
You should use this endpoint only when the User has zero linked trackers. Otherwise the UserStory will get re-imported!
:::
No parameters.
No particular return.
fetch('https://api.aniapi.com/v1/user_story/27', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer <YOUR_JWT>',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
});
{
"status_code": 200,
"message": "Story deleted",
"data": "",
"version": "1"
}