Nganime-Docs/pages/rest-api/Meta/anilist-anime/get-trending-anime.mdx

92 lines
2.2 KiB
Plaintext
Raw Normal View History

2024-03-09 04:46:18 +07:00
---
title: Anilist (Anime) | Trending Anime
---
import { Tab, Tabs } from "nextra-theme-docs";
# Search
Technical details regarding the usage of the search function for the anilist provider can be found below. Example code is provided for both JavaScript and Python, along with a response schema.
## Route Schema (URL)
```
https://api.nganime.my.id/meta/anilist/trending?page={page}&perPage={perPage}
```
## Query Parameters
| Parameter | Type | Description | Required? | Default |
| :-------: | :-----: | --------------------------------------- | :-------: | :-----: |
| page | integer | The page number of results to return. | No | `1` |
| perPage | integer | The numb of results per page to return. | No | `20` |
## Request Samples
<Tabs items={["JavaScript", "Python"]}>
<Tab>
<>
```js
import axios from "axios";
// Using the example query "demon", and looking at the first page of results.
const url = "https://api.nganime.my.id/meta/anilist/trending";
const data = async () => {
try {
const { data } = await axios.get(url, { params: {
page: 1,
perPage: 20
} });
return data;
} catch (err) {
throw new Error(err.message);
}
};
console.log(data);
```
</>
</Tab>
<Tab>
<>
```python
import requests
# Using the example query "demon", and looking at the first page of results.
url = "https://api.nganime.my.id/meta/anilist/trending"
response = requests.get(url, params={
"page": 1,
"perPage": 20
})
data = response.json()
print(data)
```
</>
</Tab>
</Tabs>
## Response Schema
<Tabs items={["200 OK"]}>
<Tab>
**MIME Type:** `application/json`
```json copy=false
{
"currentPage": 1,
"results": [
{
"id": "string",
"title": "string",
"image": "string",
"type": "string",
"rating": "number",
"releaseDate": "string"
}
]
}
```
</Tab>
</Tabs>