Kiera Affarantia 573f65184d add News Page
2024-03-09 04:59:18 +07:00

100 lines
2.7 KiB
Plaintext

---
title: Fetch News Feeds
---
import { Tab, Tabs } from "nextra-theme-docs";
# Fetch News Feeds
Technical details regarding the usage of the fetch news feeds function for the ANN 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/news/ann/recent-feeds
```
## Query Parameters
| Parameter | Type | Description | Required? | Default |
| :-------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------: | ------------------------------------------------------------------------- | :-------: | :-----: |
| topic | Enum: <br></br>`"anime"` `"animation"` `"manga"` `"games"` `"novels"` `"live-action"` `"covid-19"` `"industry"` `"music"` `"people"` `"merch"` `"events"` | This Controls the topic of the news that will be returned in the request. | No | N/A |
## Request Samples
<Tabs items={["JavaScript", "Python"]}>
<Tab>
<>
```js
import axios from "axios";
// Example request using no paramters, which fetches all recent news.
const url = "https://api.nganime.my.id/news/ann/recent-feeds";
const data = async () => {
try {
const { data } = await axios.get(url);
return data;
} catch (err) {
throw new Error(err.message);
}
};
console.log(data);
```
</>
</Tab>
<Tab>
<>
```python
import requests
# Example request using no paramters, which fetches all recent news.
url = "https://api.nganime.my.id/news/ann/recent-feeds"
response = requests.get(url)
data = response.json()
print(data)
```
</>
</Tab>
</Tabs>
## Response Schema
<Tabs items={["200 OK", "404 Not Found", "500 Internal Server Error"]}>
<Tab>
**MIME Type:** `application/json`
```json copy=false
[
{
"title": "string",
"id": "string",
"uploadedAt": "string",
"topics": [
"string"
],
"preview": {
"intro": "string",
"full": "string"
},
"thumbnail": "string",
"url": "string"
},
]
```
</Tab>
<Tab>
**MIME Type:** `application/json`
```json copy=false
"message": {}
```
</Tab>
<Tab>
**MIME Type:** `application/json`
```json copy=false
"message": {}
```
</Tab>
</Tabs>