Random article
curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'api-key: <api-key>'import requests
url = "https://api.bonai.io/news/article/random"
headers = {"api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'api-key': '<api-key>'}};
fetch('https://api.bonai.io/news/article/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonai.io/news/article/random"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'api-key: <api-key>'{
"success": true,
"data": {
"title": "<string>",
"url": "<string>",
"excerpt": "<string>",
"thumbnail": "<string>",
"language": "<string>",
"paywall": true,
"contentLength": 123,
"date": "2023-11-07T05:31:56Z",
"authors": [
"<string>"
],
"keywords": [
"<string>"
],
"publisher": {
"name": "<string>",
"url": "<string>",
"favicon": "<string>"
},
"content": "<string>"
}
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}API Reference
Random article
Retrieve a random article based on optional filters
GET
/
article
/
random
Random article
curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'api-key: <api-key>'import requests
url = "https://api.bonai.io/news/article/random"
headers = {"api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'api-key': '<api-key>'}};
fetch('https://api.bonai.io/news/article/random', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bonai.io/news/article/random"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}curl --request GET \
--url https://api.bonai.io/news/article/random \
--header 'api-key: <api-key>'{
"success": true,
"data": {
"title": "<string>",
"url": "<string>",
"excerpt": "<string>",
"thumbnail": "<string>",
"language": "<string>",
"paywall": true,
"contentLength": 123,
"date": "2023-11-07T05:31:56Z",
"authors": [
"<string>"
],
"keywords": [
"<string>"
],
"publisher": {
"name": "<string>",
"url": "<string>",
"favicon": "<string>"
},
"content": "<string>"
}
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}{
"success": false,
"code": 123,
"message": "<string>",
"fields": [
{
"name": "<string>",
"type": "<string>",
"description": "<string>"
}
]
}Authorizations
Your Bonai API key. Create one in the Bonai console (https://console.bonai.io).
Headers
API version to consume. Defaults to the latest version (2024-01-01).
Available options:
2024-01-01 Query Parameters
Topic filter
Language code
Content type to return
Available options:
plaintext, html Response
Successful response
Available options:
true Hide child attributes
Hide child attributes
Language code, for example en
Publish date (ISO 8601)
Full article content. Only returned by GET /article when your plan includes it.
Was this page helpful?