Docs

Below you'll find examples using Fetch API but you can use any other http library out there.


Important Notes

  1. Default rate limit is 100 requests per hour.
  2. Default number of quotes returned from query endpoints is 10.
  3. If you don't find the Shloka you are looking for then submit a request here.

Get a Bahgavad Gita Shloka by Chapter and Verse

fetch("https://shloka.onrender.com/api/v1/bahgavad_gita/shloka?chapter=1&verse=5")
.then((response) => response.json())
.then((data) => console.log(data));

Output

{
"Verse No": "...",
Shloka: "...",
EnglishTranslation: "...",
Explanation: "...",
Chapter: "..."
}

Get all Bahgavad Gita Shloka by Chapter with default limit of 10

fetch("https://shloka.onrender.com/api/v1/bahgavad_gita/all?chapter=1")
.then((response) => response.json())
.then((quote) => console.log(quote));

Output

[
{
chapter: "...",
"Verse No": "...",
"English Translation": "...",
Explanation: "..."
},
"...9 more"
]

Get a random Bahgavad Gita Shloka

fetch("https://shloka.onrender.com/api/v1/bahgavad_gita/random")
.then((response) => response.json())
.then((quote) => console.log(quote));

Output

{
"Verse No": "...",
Shloka: "...",
"English Translation": "...",
Explanation: "..."
}

Get a random Bahgavad Gita Shloka by Chapter

fetch("https://shloka.onrender.com/api/v1/bahgavad_gita/random/by?chapter=1")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

{
"Verse No": "...",
Shloka: "...",
"English Translation": "...",
Explanation: "..."
}

Get a random Chanakya Shloka

fetch("https://shloka.onrender.com/api/v1/chanakya/shloka/random")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

{
Sloka: "....",
Class: "..."
}

Get 10 Chanakya Shloka

fetch("https://shloka.onrender.com/api/v1/chanakya/shloka")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

[
{
Sloka: "....",
Class: "..."
},
"...9 more"
]

Get all Chanakya ShlokaNew

fetch('https://shloka.onrender.com/api/v1/chanakya/all')
.then(response => response.json())
.then(animes => console.log(animes))

Output

[
{
Sloka: "....",
Class: "..."
},
"... more"
]

Get a random Sanskrit Slogan

fetch("https://shloka.onrender.com/api/v1/sanskrit/slogan/random")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

{
Sloka: "....",
Class: "..."
}

Get 10 Sanskrit Slogan

fetch("https://shloka.onrender.com/api/v1/sanskrit/slogan")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

[
{
Sloka: "....",
Class: "..."
},
"...9 more"
]

Get all Sanskrit SloganNew

fetch('https://shloka.onrender.com/api/v1/sanskrit/all')
.then(response => response.json())
.then(animes => console.log(animes))

Output

[
{
Sloka: "....",
Class: "..."
},
"... more"
]

Get a random Vidur Niti Shlokas

fetch("https://shloka.onrender.com/api/v1/vidur_niti/maxims/random")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

{
Sloka: "....",
Class: "..."
}

Get 10 Vidur Niti Shlokas

fetch("https://shloka.onrender.com/api/v1/vidur_niti/maxims")
.then((response) => response.json())
.then((quotes) => console.log(quotes));

Output

[
{
Sloka: "....",
Class: "..."
},
"...9 more"
]

Get all Vidur Niti ShlokasNew

fetch('https://shloka.onrender.com/api/v1/vidur_niti/all')
.then(response => response.json())
.then(animes => console.log(animes))

Output

[
{
Sloka: "....",
Class: "..."
},
"... more"
]

Pagination

Pagination works only on all in Bahgavad Gita Shloka and maxims, slogans, shloks in others query endpoints. Default pagination count is 10 Shlokas per page..

fetch('https://shloka.onrender.com/api/v1/bahgavad_gita/all?chapter=1&page=1&limit=10')
.then(response => response.json())
.then(data => console.log(data))
// works on character queries too 👇
// https://shloka.onrender.com/api/v1/chanakya/shloka?page=1&limit=10,
// https://shloka.onrender.com/api/v1/sanskrit/slogan?page=1&limit=10,
// https://shloka.onrender.com/api/v1/vidur_niti/maxims?page=1&limit=10

Output

[
{
chapter: "...",
"Verse No": "...",
"English Translation": "...",
Explanation: "..."
},
"...9 more"
]

Created ❤️ by shivam © 2023