Skip to content

API spec

LomaxRx edited this page Nov 19, 2016 · 23 revisions

New America API

An API for accessing New America's CMS data
Version: 1.0.0
BasePath:/api

Access

[ Jump to Models ]

Table of Contents

  1. get /post
  2. get /author
  3. get /meta
  4. get /meta/content
  5. get /meta/program
  6. get /meta/subprogram
<pre class="get"><code class="huge"><span class="http-method">get</span> /post</code></pre></div>
<div class="method-summary">Posts (<span class="nickname">postGet</span>)</div>
<div class="method-notes">All posts  </div>





<h3 class="field-label">Query parameters</h3>
<div class="field-items">
  <div class="param">**program** (optional)</div>

  <div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; limit by parent program </div><div class="param">**content_type** (optional)</div>

  <div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; type of content </div><div class="param">**subprogram** (optional)</div>

  <div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; associate subprogram </div><div class="param">**after** (optional)</div>

  <div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; inclusive greater than start date format: date</div><div class="param">**before** (optional)</div>

  <div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; inclusive less than end date format: date</div>
</div>  <!-- field-items -->


<h3 class="field-label">Return type</h3>
<div class="return-type">
  array[<a href="#Post">Post</a>]

</div>

<!--Todo: process Response Object and its headers, schema, examples -->

<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>[ {

"date" : "2000-01-23T04:56:07.000+00:00", "content_type" : { "api_name" : "aeiou", "name" : "aeiou" }, "story_excerpt" : "aeiou", "id" : "aeiou", "programs" : [ { "name" : "aeiou", "description" : "aeiou", "logo" : "aeiou", "id" : "aeiou", "subprograms" : [ { "name" : "aeiou", "id" : "aeiou", "url" : "aeiou" } ], "url" : "aeiou" } ], "subprograms" : [ "" ], "title" : "aeiou", "subheading" : "aeiou", "url" : "aeiou", "story_image" : "aeiou" } ]

<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="heaader">Content-Type</span> response header.
<ul>
  <li><code>application/json</code></li>
</ul>

<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
An array of posts

<h4 class="field-label">0</h4>
Unexpected error
    <a href="#Error">Error</a>
get /author
Author Bio (authorGet)

Query parameters

**program** (optional)
<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; limit authors by programs </div><div class="param">**subprogram** (optional)</div>

<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; limit authors by subprograms </div><div class="param">**role** (optional)</div>

<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; search by role&#39;s name name </div><div class="param">**name** (optional)</div>

<div class="param-desc"><span class="param-type">Query Parameter</span> &mdash; search by author&#39;s name </div>

Return type

array[Author]

Example data

Content-Type: application/json
[ {
"profile_image" : "aeiou",
"full_name" : "aeiou",
"role" : "aeiou",
"short_bio" : "aeiou",
"last_name" : "aeiou",
"long_bio" : "aeiou",
"id" : "aeiou",
"position" : "aeiou",
"first_name" : "aeiou",
"posts" : [ {
  "date" : "2000-01-23T04:56:07.000+00:00",
  "content_type" : {
    "api_name" : "aeiou",
    "name" : "aeiou"
  },
  "story_excerpt" : "aeiou",
  "id" : "aeiou",
  "programs" : [ {
    "name" : "aeiou",
    "description" : "aeiou",
    "logo" : "aeiou",
    "id" : "aeiou",
    "subprograms" : [ {
      "name" : "aeiou",
      "id" : "aeiou",
      "url" : "aeiou"
    } ],
    "url" : "aeiou"
  } ],
  "subprograms" : [ "" ],
  "title" : "aeiou",
  "subheading" : "aeiou",
  "url" : "aeiou",
  "story_image" : "aeiou"
} ]
} ]

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

An array of authors

0

Unexpected error Error
get /meta
Meta Data (metaGet)
Get data about content types, programs and subprograms

Return type

Example data

Content-Type: application/json
{
"content_types" : [ {
  "api_name" : "aeiou",
  "name" : "aeiou"
} ],
"programs" : [ {
  "name" : "aeiou",
  "description" : "aeiou",
  "logo" : "aeiou",
  "id" : "aeiou",
  "subprograms" : [ {
    "name" : "aeiou",
    "id" : "aeiou",
    "url" : "aeiou"
  } ],
  "url" : "aeiou"
} ],
"subprograms" : [ {
  "name" : "aeiou",
  "parent_programs" : [ "" ],
  "id" : "aeiou"
} ]
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Object of content_type, programs and subprograms Meta
get /meta/content_type
Content Types (metaContentTypesGet)
get list of all content types

Return type

Example data

Content-Type: application/json
{
"api_name" : "aeiou",
"name" : "aeiou"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

List of all post content types ContentType
get /meta/program
Programs (metaProgramsGet)
get list of all programs

Return type

Example data

Content-Type: application/json
{
"name" : "aeiou",
"description" : "aeiou",
"logo" : "aeiou",
"id" : "aeiou",
"subprograms" : [ {
  "name" : "aeiou",
  "id" : "aeiou",
  "url" : "aeiou"
} ],
"url" : "aeiou"
}

Produces

This API call produces the following media types according to the Accept request header; the media type will be conveyed by the Content-Type response header.
  • application/json

Responses

200

Program list information Program

0

Unexpected error Error
<pre class="get"><code class="huge"><span class="http-method">get</span> /meta/subprogram</code></pre></div>
<div class="method-summary">Subprograms (<span class="nickname">metaSubprogramGet</span>)</div>
<div class="method-notes">get list of all subprograms</div>

<h3 class="field-label">Return type</h3>
<div class="return-type">
  <a href="#Subprogram">Subprogram</a>

</div>

<!--Todo: process Response Object and its headers, schema, examples -->

<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/json</div>
<pre class="example"><code>{

"name" : "aeiou", "id" : "aeiou", "url": "aeiou", "parent_programs" : [ { "name" : "aeiou", "id" : "aeiou", "url" : "aeiou" } ] }

<h3 class="field-label">Produces</h3>
This API call produces the following media types according to the <span class="header">Accept</span> request header;
the media type will be conveyed by the <span class="heaader">Content-Type</span> response header.
<ul>
  <li><code>application/json</code></li>
</ul>

<h3 class="field-label">Responses</h3>
<h4 class="field-label">200</h4>
Program list information
    <a href="#Program">Program</a>
<h4 class="field-label">0</h4>
Unexpected error
    <a href="#Error">Error</a>
[ Jump to Methods ]

Table of Contents

  1. Author
  2. ContentType
  3. Error
  4. Meta
  5. Post
  6. Post_content_type
  7. Program
  8. Program_subprograms
  9. Subprogram
id (optional)
String unique id
full_name (optional)
String full name of author
first_name (optional)
String author's first name
last_name (optional)
String author's last name
profile_image (optional)
String absolute path to author's image
role (optional)
String e.g executive, central
short_bio (optional)
long_bio (optional)
position (optional)
String position at new america
posts (optional)
api_name (optional)
String api name used for querying content types
name (optional)
String human-friendly name
code (optional)
Integer format: int32
message (optional)
fields (optional)
programs (optional)
subprograms (optional)
content_type (optional)
id (optional)
String A unique string
title (optional)
String title of post
subheading (optional)
String subheading for
date (optional)
date publication date format: date
content_type (optional)
programs (optional)
array[Program] all associated programs
subprograms (optional)
array[Program] all associate subprograms
url (optional)
String absolute path to post
story_excerpt (optional)
String short excerpt for post
story_image (optional)
String absolute path to post's cover image
name (optional)
api_name (optional)
id (optional)
String Unique identifier
description (optional)
String Description of program.
name (optional)
String Display name of product.
url (optional)
String absolute path to program's home page
subprograms (optional)
logo (optional)
String Image URL for program's logo
id (optional)
name (optional)
url (optional)
id (optional)
name (optional)
parent_programs (optional)