Hello there, again posting after a long time. Today I'm excited to announce Abrays Quote API - A API that gives you Quotes from the Abrays for free with no limitations on making API calls. Abrays Quotes is a collection of Quotes to help make people change their mindset and to motivate one to achieve more in life.

Just make a request to our endpoint URL:

To get all quotes: https://abrays.adityanagla.xyz/quotes/api/v1/quotes

To get specific quote with ID: https://abrays.adityanagla.xyz/quotes/api/v1/quotes/{ID}

Also, see the best practices of using this API at the end of this post.

How to use this API with JavaScript:

To get all the quotes:

You can use Axios for making AJAX request to the API and then render the results to your HTML. Below is the Code to get all the Quotes.

<div id="app"></div>
<script type="text/javascript" src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
    axios.get('https://abrays.adityanagla.xyz/quotes/api/v1/quotes', { headers: {
    	'Content-Type': 'application/json',
        'User-Agent': 'App Name : Website : Email'
    }
    })
        .then(function (response) {
        var arr = []
        for(var i = 0; i < response.data.data.length; i++){
            arr.push(response.data.data[i].body)
        }
        document.getElementById('app').innerHTML = arr;
    })
        .catch(function (error) {
        console.log(error);
    });
</script>

To get a Quote with specific ID:

<div id="app"></div>
<script type="text/javascript" src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script type="text/javascript">
    var q_id = 1
    axios.get('https://abrays.adityanagla.xyz/quotes/api/v1/quotes/' + q_id, { headers: {
    	'Content-Type': 'application/json',
        'User-Agent': 'App Name : Website : Email'
    }
    })
      .then(function (response) {
        document.getElementById('app').innerHTML = response.data.data.body;
      })
      .catch(function (error) {
        console.log(error);
      });
</script>

From above, change the q_id value to get your own value.

How to use this API with Node.js:

For use in Node.js you can use "axios" or also "superagent". I prefer using superagent. You must also set headers like below:

/*
1. Install Super Agent
npm install --save superagent
*/

const request = require('superagent');
...
...
request
  .get(`https://abrays.adityanagla.xyz/quotes/api/v1/quotes.json`)
  .set({'User-Agent' : 'App Name : Website : Email', 'Content-Type' : 'application/json'})
  .end((err, res) => {
    if (!err) {
      var body = res.body.data;
    }
    else{
      console.log(err);
    }
});

Best Practices

  1. It's good to add a header when you make a request to our API with "User-Agent" : "App Name | Website | Email" so that we can monitor your requests to avoid spams. We'll block requests if we receive many requests w/o adding this header.
  2. This service is free, use it in your apps as much as you can. You just need to give credit to "Abrays - https://abrays.adityanagla.xyz" in your App/Website.