318 lines
No EOL
19 KiB
HTML
318 lines
No EOL
19 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
|
<title>REST API — Accounting API 0.1-beta documentation</title>
|
|
|
|
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: './',
|
|
VERSION: '0.1-beta',
|
|
COLLAPSE_INDEX: false,
|
|
FILE_SUFFIX: '.html',
|
|
HAS_SOURCE: true
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/underscore.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
<link rel="top" title="Accounting API 0.1-beta documentation" href="index.html" />
|
|
<link rel="next" title="accounting package" href="api/accounting.html" />
|
|
<link rel="prev" title="The Accounting API" href="README.html" />
|
|
</head>
|
|
<body>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="genindex.html" title="General Index"
|
|
accesskey="I">index</a></li>
|
|
<li class="right" >
|
|
<a href="http-routingtable.html" title="HTTP Routing Table"
|
|
>routing table</a> |</li>
|
|
<li class="right" >
|
|
<a href="py-modindex.html" title="Python Module Index"
|
|
>modules</a> |</li>
|
|
<li class="right" >
|
|
<a href="api/accounting.html" title="accounting package"
|
|
accesskey="N">next</a> |</li>
|
|
<li class="right" >
|
|
<a href="README.html" title="The Accounting API"
|
|
accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">Accounting API 0.1-beta documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
<div class="section" id="rest-api">
|
|
<h1>REST API<a class="headerlink" href="#rest-api" title="Permalink to this headline">¶</a></h1>
|
|
<div class="section" id="get-transactions">
|
|
<h2>Get transactions<a class="headerlink" href="#get-transactions" title="Permalink to this headline">¶</a></h2>
|
|
<dl class="get">
|
|
<dt id="get--transaction">
|
|
<tt class="descname">GET </tt><tt class="descname">/transaction</tt><a class="headerlink" href="#get--transaction" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Get all transactions</p>
|
|
<p><strong>Example request</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="nf">GET</span> <span class="nn">/transaction</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
|
<span class="na">Host</span><span class="o">:</span> <span class="l">accounting.example</span>
|
|
<span class="na">Accept</span><span class="o">:</span> <span class="l">application/json</span>
|
|
</pre></div>
|
|
</div>
|
|
<p><strong>Example response</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
|
|
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
|
|
|
|
<span class="p">{</span>
|
|
<span class="nt">"transactions"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Transaction"</span><span class="p">,</span>
|
|
<span class="nt">"date"</span><span class="p">:</span> <span class="s2">"2010-01-01"</span><span class="p">,</span>
|
|
<span class="nt">"id"</span><span class="p">:</span> <span class="s2">"Ids can be anything"</span><span class="p">,</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{},</span>
|
|
<span class="nt">"payee"</span><span class="p">:</span> <span class="s2">"Kindly T. Donor"</span><span class="p">,</span>
|
|
<span class="nt">"postings"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Income:Foo:Donation"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"-100"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"Invoice"</span><span class="p">:</span> <span class="s2">"Projects/Foo/Invoices/Invoice20100101.pdf"</span>
|
|
<span class="p">}</span>
|
|
<span class="p">},</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Assets:Checking"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"100"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{}</span>
|
|
<span class="p">}</span>
|
|
<span class="p">]</span>
|
|
<span class="p">},</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Transaction"</span><span class="p">,</span>
|
|
<span class="nt">"date"</span><span class="p">:</span> <span class="s2">"2011-03-15"</span><span class="p">,</span>
|
|
<span class="nt">"id"</span><span class="p">:</span> <span class="s2">"but mind you if they collide."</span><span class="p">,</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{},</span>
|
|
<span class="nt">"payee"</span><span class="p">:</span> <span class="s2">"Another J. Donor"</span><span class="p">,</span>
|
|
<span class="nt">"postings"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Income:Foo:Donation"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"-400"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"Approval"</span><span class="p">:</span> <span class="s2">"Projects/Foo/earmark-record.txt"</span>
|
|
<span class="p">}</span>
|
|
<span class="p">},</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Assets:Checking"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"400"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{}</span>
|
|
<span class="p">}</span>
|
|
<span class="p">]</span>
|
|
<span class="p">},</span>
|
|
<span class="p">]</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
</div>
|
|
<div class="section" id="add-transactions">
|
|
<h2>Add transactions<a class="headerlink" href="#add-transactions" title="Permalink to this headline">¶</a></h2>
|
|
<dl class="post">
|
|
<dt id="post--transaction">
|
|
<tt class="descname">POST </tt><tt class="descname">/transaction</tt><a class="headerlink" href="#post--transaction" title="Permalink to this definition">¶</a></dt>
|
|
<dd><table class="docutils field-list" frame="void" rules="none">
|
|
<col class="field-name" />
|
|
<col class="field-body" />
|
|
<tbody valign="top">
|
|
<tr class="field-odd field"><th class="field-name" colspan="2">Json Parameters:</th></tr>
|
|
<tr class="field-odd field"><td> </td><td class="field-body"><ul class="first last simple">
|
|
<li><strong>transactions</strong> (<em>array</em>) – A list of Transaction objects to add.</li>
|
|
</ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<p><strong>Example request</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="nf">POST</span> <span class="nn">/transaction</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
|
<span class="na">Host</span><span class="o">:</span> <span class="l">accounting.example</span>
|
|
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
|
|
<span class="na">Accept</span><span class="o">:</span> <span class="l">application/json</span>
|
|
|
|
<span class="p">{</span>
|
|
<span class="nt">"transactions"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Transaction"</span><span class="p">,</span>
|
|
<span class="nt">"date"</span><span class="p">:</span> <span class="s2">"2010-01-01"</span><span class="p">,</span>
|
|
<span class="nt">"id"</span><span class="p">:</span> <span class="s2">"Ids can be anything"</span><span class="p">,</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{},</span>
|
|
<span class="nt">"payee"</span><span class="p">:</span> <span class="s2">"Kindly T. Donor"</span><span class="p">,</span>
|
|
<span class="nt">"postings"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Income:Foo:Donation"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"-100"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"Invoice"</span><span class="p">:</span> <span class="s2">"Projects/Foo/Invoices/Invoice20100101.pdf"</span>
|
|
<span class="p">}</span>
|
|
<span class="p">},</span>
|
|
<span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Posting"</span><span class="p">,</span>
|
|
<span class="nt">"account"</span><span class="p">:</span> <span class="s2">"Assets:Checking"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="p">{</span>
|
|
<span class="nt">"__type__"</span><span class="p">:</span> <span class="s2">"Amount"</span><span class="p">,</span>
|
|
<span class="nt">"amount"</span><span class="p">:</span> <span class="s2">"100"</span><span class="p">,</span>
|
|
<span class="nt">"symbol"</span><span class="p">:</span> <span class="s2">"$"</span>
|
|
<span class="p">},</span>
|
|
<span class="nt">"metadata"</span><span class="p">:</span> <span class="p">{}</span>
|
|
<span class="p">}</span>
|
|
<span class="p">]</span>
|
|
<span class="p">},</span>
|
|
<span class="p">]</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
<p><strong>Example response</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
|
|
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
|
|
|
|
<span class="p">{</span>
|
|
<span class="nt">"status"</span><span class="p">:</span> <span class="s2">"OK"</span><span class="p">,</span>
|
|
<span class="nt">"transaction_ids"</span><span class="p">:</span> <span class="p">[</span>
|
|
<span class="s2">"Ids can be anything"</span>
|
|
<span class="p">]</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
</div>
|
|
<div class="section" id="delete-a-transaction">
|
|
<h2>Delete a transaction<a class="headerlink" href="#delete-a-transaction" title="Permalink to this headline">¶</a></h2>
|
|
<dl class="delete">
|
|
<dt id="delete--transaction--string-transaction_id-">
|
|
<tt class="descname">DELETE </tt><tt class="descname">/transaction/<string:transaction_id></tt><a class="headerlink" href="#delete--transaction--string-transaction_id-" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Delete the transaction with ID <tt class="xref py py-data docutils literal"><span class="pre">transaction_id</span></tt>.</p>
|
|
<p><strong>Example request</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="nf">DELETE</span> <span class="nn">/transaction/123456</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
|
<span class="na">Host</span><span class="o">:</span> <span class="l">accounting.example</span>
|
|
<span class="na">Accept</span><span class="o">:</span> <span class="l">application/json</span>
|
|
</pre></div>
|
|
</div>
|
|
<p><strong>Example response</strong></p>
|
|
<div class="highlight-http"><div class="highlight"><pre><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">200</span> <span class="ne">OK</span>
|
|
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
|
|
|
|
<span class="p">{</span>
|
|
<span class="nt">"status"</span><span class="p">:</span> <span class="s2">"OK"</span>
|
|
<span class="p">}</span>
|
|
</pre></div>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sphinxsidebar">
|
|
<div class="sphinxsidebarwrapper">
|
|
<h3><a href="index.html">Table Of Contents</a></h3>
|
|
<ul>
|
|
<li><a class="reference internal" href="#">REST API</a><ul>
|
|
<li><a class="reference internal" href="#get-transactions">Get transactions</a></li>
|
|
<li><a class="reference internal" href="#add-transactions">Add transactions</a></li>
|
|
<li><a class="reference internal" href="#delete-a-transaction">Delete a transaction</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="README.html"
|
|
title="previous chapter">The Accounting API</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="api/accounting.html"
|
|
title="next chapter">accounting package</a></p>
|
|
<h3>This Page</h3>
|
|
<ul class="this-page-menu">
|
|
<li><a href="_sources/restapi.txt"
|
|
rel="nofollow">Show Source</a></li>
|
|
</ul>
|
|
<div id="searchbox" style="display: none">
|
|
<h3>Quick search</h3>
|
|
<form class="search" action="search.html" method="get">
|
|
<input type="text" name="q" />
|
|
<input type="submit" value="Go" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
<p class="searchtip" style="font-size: 90%">
|
|
Enter search terms or a module, class or function name.
|
|
</p>
|
|
</div>
|
|
<script type="text/javascript">$('#searchbox').show(0);</script>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px">
|
|
<a href="genindex.html" title="General Index"
|
|
>index</a></li>
|
|
<li class="right" >
|
|
<a href="http-routingtable.html" title="HTTP Routing Table"
|
|
>routing table</a> |</li>
|
|
<li class="right" >
|
|
<a href="py-modindex.html" title="Python Module Index"
|
|
>modules</a> |</li>
|
|
<li class="right" >
|
|
<a href="api/accounting.html" title="accounting package"
|
|
>next</a> |</li>
|
|
<li class="right" >
|
|
<a href="README.html" title="The Accounting API"
|
|
>previous</a> |</li>
|
|
<li><a href="index.html">Accounting API 0.1-beta documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2013, Joar Wandborg.
|
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.
|
|
</div>
|
|
</body>
|
|
</html> |