The Tearline API reference is organized by resource type. Each resource type has one or more data representations and one or more methods.

 

Method

HTTP Request

Description

pages/?type=public_pages.PublicPage GET Returns JSON object containing all public post content. No authentication credentials required.

Example route for returning all fields for most recent article

https://www.tearline.mil/api/v2/pages/?type=public_pages.PublicPage&fields=*&order=-first_published_at&limit=1


Code Example: Get Public Post Data

#get all public posts
    import requests
    import re

    url = 'https://www.tearline.mil/api/v2/';

    method = 'pages/?type=public_pages.PublicPage&fields=*';

    # call public pages
    response = requests.get(url + method);

    print( "status: ", response.json()['status'])
    print( "count_total: ", response.json()['total_count'], "n")

    for post in response.json()['posts']:
        print( "Post Title: ", post['title'] )
        print( "Post Type: ", post['type'] )
        print( "Post ID: ", post['id'] )

    # get all id's of public posts
    public_id = [ post['id'] for post in response.json()['posts'] ]