API Reference

Access our Virtue of the Week JSON data feed and display it on your website

Here are a couple of examples of how to use the Virtue of the Week JSON API, using PHP or JQUERY. It's free for everyone to use and all I ask is that you include a link to the full list of 52 virtues, like the example below. I've also included a Codepen embed at the bottom, of the CSS I used to create a fancy styled box, that you can play around with.

<a href="https://inall.love/virtues" target="_blank" rel="noopener">All 52 Virtues</a>

The JSON output

{
    "title": "CARING",
    "body": "Caring is giving love and attention to people. When you care about people, you help them. You cooperate, giving your very best effort. You treat people and things gently and respectfully. Caring is love in action.",
    "scripture": "\"A new commandment I give to you, that you love one another, even as I have loved you, that you also love one another. \"By this all men will know that you are My disciples, if you have love (care) for one another.\"",
    "cite": "John 13:34-35"
    "characteristic": "lamb"
}

There are 5 variables, "title", "body", "scripture", "cite" and "characteristic". The cite is the scripture reference and its up to you if you want to use the scripture or not.

Enter your name and email to generate an API Key

Don't worry, we don't share it with anyone else and you'll only receive emails from us if there's an update to the API.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Using PHP

<?php
// fetch the file with file_get_contents and turn it into an object array with json_decode
$virtue = json_decode(file_get_contents('https://inall.love/api/json?apikey=YOUR_API_KEY'));
// Output in your HTML and style it however you choose with CSS
?>
<div class="virtue-frame">
    <h3 class="virtue-title"><?php echo $virtue->title; ?></h3>
    <p class="virtue-characteristic"><?php echo $virtue->characteristic; ?></p>
    <p class="virtue-body"><?php echo $virtue->body; ?></p>
    <blockquote class="virtue-scripture"><?php echo $virtue->scripture; ?><cite><?php echo $virtue->cite; ?></cite></blockquote>
    <small><a href="https://inall.love/virtues" target="_blank" rel="noopener">All 52 Virtues</a></small>
</div>

Using JQUERY

<html>
    <body>
	    <div class="virtue-frame">
            <h3 class="virtue-title"></h3>
            <p class="virtue-characteristic"></p>
            <p class="virtue-body"></p>
            <blockquote><span class="virtue-scripture"></span><cite class="virtue-cite"></cite></blockquote>
            <small><a href="https://inall.love/virtues" target="_blank" rel="noopener">All 52 Virtues</a></small>
        </div>
        <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
         <script>  
            $(document).ready(function(){
                $.getJSON("https://inall.love/api/json?apikey=YOUR_API_KEY", function( data ) {
                    $('.virtue-title').html(data.title);
                    $('.virtue-characteristic').html(data.characteristic);
                    $('.virtue-body').html(data.body);
                    $('.virtue-scripture').html(data.scripture); // it's entirely up to you if you include the scripture or not
                    $('.virtue-cite').html(data.cite);
                });
            });
        </script>
        <!--- If you use async or defer for JQUERY, you can do it the following way --->
        <script src="https://code.jquery.com/jquery-3.4.1.min.js" async></script>
         <script>
            function setPage(){
                if (typeof jQuery === "function") {
                    $.getJSON("https://inall.love/api/json?apikey=YOUR_API_KEY", function( data ) {
                        $('.virtue-title').html(data.title);
                        $('.virtue-characteristic').html(data.characteristic);
                        $('.virtue-body').html(data.body);
                        $('.virtue-scripture').html(data.scripture);
                        $('.virtue-cite').html(data.cite);
                    });
                } else {
                    window.setTimeout(function() {
                        setPage()
                    }, 5);
                }
            }
            window.addEventListener("load",function(){
               setPage();
            });
        </script>
    </body>
</html>

See the Pen Virtue of the Week by Jean-Baptiste Amata Gastiganto (@jean-baptiste-amata-gastiganto) on CodePen.