JSFiddle - React, Tailwind, and code Playground

by mpriatel

HTML

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<h2 class='resource-uri'><em class='label rest-verb-post'>POST</em> /datasources</h2>

<p>Create a data source.  Data source properties can optionally be specified in the post data.</p>

<h3>Parameters</h3>
<dl>
    <dt>no_instance {boolean}</dt>
    <dd>prevents the creation of an associated data source instance.</dd>
</dl>

<h3>Response Codes</h3>

<dl>
    <dt>400</dt>
    <dd>bad request if 'name', 'description', ‘format’, ‘connector’, ‘refresh_interval’, or ‘properties’ are missing or improperly formatted</dd>
    
    <dt>400</dt>
    <dd>(format must be one of: ‘csv’, ‘xml’, ‘xls’, ‘json’)</dd>
        
    <dt>400</dt>
    <dd>connector must be one of: 'box', 'db', 'dropbox', 'facebook', 'ftp', 'google_analytics', 'google_spreadsheets', 'omniture', 'radian6', 'salesforce', 'simple_rest', 'xmla'</dd>

    <dt>401</dt>
    <dd>access denied to non-admins</dd>

    <dt>500</dt>
    <dd>data could not be retrieved from the specified data source</dd>
    
</dl>

<h3>Example Request</h3>

<p>Optionally include <code>client_id</code> in the post data to create a data source for a client</p>

<code>{
  'name': 'Example', 
  'description': 'This is a new data source', 
  'format': 'xml', 
  'connector': 'simple_rest', 
  'refresh_interval': 1800, 
  'client_id': '07e277378b10628d8e024b9202a5710b', 
  'properties': {'endpoint_url': 'http://kane/data/scatter.xml', 'method': 'GET'}
} 

</code>

<h3>Example Response</h3>

<p>Note that both the location of both the data source and its instance are returned.</p>

<code>
{
  "meta": {
    "success": true,
    "status": 201,
    "location": "/datasources/5d8821caa9ac3b2a291496e182de13e2",
    "instance_location":...

CSS

body { font-family:arial; padding:20px }
dt { font-family: consolas }
dd { margin-left:20px ; margin-bottom:20px }
code { 
 white-space: pre-wrap;       /* css-3 */
 white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
 white-space: -pre-wrap;      /* Opera 4-6 */
 white-space: -o-pre-wrap;    /* Opera 7 */
 word-wrap: break-word;   
}

em {
   font-style:normal;
}

em.rest-verb-post {
    background-color:orange;

}

h2 { margin-bottom:30px }