update docs for remaining endpoints - fix #21
and fix some routes to add authentication
This commit is contained in:
		@@ -1,8 +1,6 @@
 | 
				
			|||||||
Records
 | 
					Records
 | 
				
			||||||
#######
 | 
					#######
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    records.get_records
 | 
					    records.get_records
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,7 @@
 | 
				
			|||||||
Sports
 | 
					Sports
 | 
				
			||||||
######
 | 
					######
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    sports.get_sports,
 | 
					    sports.get_sports,
 | 
				
			||||||
    sports.get_sport,
 | 
					    sports.get_sport
 | 
				
			||||||
    sports.post_sport,
 | 
					 | 
				
			||||||
    sports.update_sport,
 | 
					 | 
				
			||||||
    sports.delete_sport
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,6 @@
 | 
				
			|||||||
Statistics
 | 
					Statistics
 | 
				
			||||||
##########
 | 
					##########
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    stats.get_activities_by_sport,
 | 
					    stats.get_activities_by_sport,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,6 @@
 | 
				
			|||||||
Users
 | 
					Users
 | 
				
			||||||
#####
 | 
					#####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    users.get_users,
 | 
					    users.get_users,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -239,7 +239,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
<dt class="field-even">Query Parameters</dt>
 | 
					<dt class="field-even">Query Parameters</dt>
 | 
				
			||||||
@@ -268,7 +268,12 @@
 | 
				
			|||||||
<dt class="field-even">Status Codes</dt>
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -345,7 +350,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
					<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -357,7 +362,12 @@
 | 
				
			|||||||
<dt class="field-odd">Status Codes</dt>
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – Provide a valid auth token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">403 Forbidden</a> – You do not have permissions</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4">403 Forbidden</a> – You do not have permissions</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
@@ -456,7 +466,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
<dt class="field-even">Form Parameters</dt>
 | 
					<dt class="field-even">Form Parameters</dt>
 | 
				
			||||||
@@ -480,7 +490,12 @@
 | 
				
			|||||||
<li><p>File extension not allowed.</p></li>
 | 
					<li><p>File extension not allowed.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</p></li>
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -492,7 +507,7 @@
 | 
				
			|||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/activities/no_gpx</code><a class="headerlink" href="#post--api-activities-no_gpx" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">POST </code><code class="sig-name descname">/api/activities/no_gpx</code><a class="headerlink" href="#post--api-activities-no_gpx" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Post an activity without gpx file</p>
 | 
					<dd><p>Post an activity without gpx file</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/activities/</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/activities/no_gpx</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -578,7 +593,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
<dt class="field-even">Request JSON Object</dt>
 | 
					<dt class="field-even">Request JSON Object</dt>
 | 
				
			||||||
@@ -600,7 +615,12 @@
 | 
				
			|||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2">201 Created</a> – activity created</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.2">201 Created</a> – activity created</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – invalid payload</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – invalid payload</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -698,7 +718,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
					<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -724,7 +744,12 @@
 | 
				
			|||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – activity updated</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – activity updated</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – invalid payload</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – invalid payload</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
@@ -749,7 +774,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
					<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -761,7 +786,12 @@
 | 
				
			|||||||
<dt class="field-odd">Status Codes</dt>
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">204 No Content</a> – activity deleted</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">204 No Content</a> – activity deleted</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error. Please try again or contact the administrator.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error. Please try again or contact the administrator.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
@@ -787,19 +817,18 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					 | 
				
			||||||
<li><p><strong>map_id</strong> (<em>string</em>) – activity map id</p></li>
 | 
					<li><p><strong>map_id</strong> (<em>string</em>) – activity map id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
<dt class="field-even">Request Headers</dt>
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
					 | 
				
			||||||
</ul>
 | 
					 | 
				
			||||||
</dd>
 | 
					 | 
				
			||||||
<dt class="field-odd">Status Codes</dt>
 | 
					 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – map does not exist</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – map does not exist</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
@@ -832,7 +861,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
					<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -845,7 +874,12 @@
 | 
				
			|||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – no gpx file for this activity</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – no gpx file for this activity</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
@@ -893,7 +927,7 @@
 | 
				
			|||||||
<dl class="field-list simple">
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dt class="field-odd">Parameters</dt>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id</p></li>
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
					<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -906,7 +940,12 @@
 | 
				
			|||||||
<dd class="field-odd"><ul class="simple">
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – no gpx file for this activity</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">400 Bad Request</a> – no gpx file for this activity</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – invalid token</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – activity not found</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – </p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,7 +128,7 @@
 | 
				
			|||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/register</code><a class="headerlink" href="#post--api-auth-register" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/register</code><a class="headerlink" href="#post--api-auth-register" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>register a user</p>
 | 
					<dd><p>register a user</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/auth/register</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/auth/register</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -196,7 +196,7 @@
 | 
				
			|||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/login</code><a class="headerlink" href="#post--api-auth-login" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/login</code><a class="headerlink" href="#post--api-auth-login" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>user login</p>
 | 
					<dd><p>user login</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/auth/login</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/auth/login</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -248,7 +248,7 @@
 | 
				
			|||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/auth/logout</code><a class="headerlink" href="#get--api-auth-logout" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/auth/logout</code><a class="headerlink" href="#get--api-auth-logout" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>user logout</p>
 | 
					<dd><p>user logout</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/auth/logout</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/auth/logout</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -297,7 +297,7 @@
 | 
				
			|||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/auth/profile</code><a class="headerlink" href="#get--api-auth-profile" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/auth/profile</code><a class="headerlink" href="#get--api-auth-profile" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>get authenticated user info</p>
 | 
					<dd><p>get authenticated user info</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/auth/profile</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/auth/profile</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -337,7 +337,12 @@
 | 
				
			|||||||
<dt class="field-even">Status Codes</dt>
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success.</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – Provide a valid auth token.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
</dl>
 | 
					</dl>
 | 
				
			||||||
@@ -348,7 +353,7 @@
 | 
				
			|||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/profile/edit</code><a class="headerlink" href="#post--api-auth-profile-edit" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/profile/edit</code><a class="headerlink" href="#post--api-auth-profile-edit" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>edit authenticated user</p>
 | 
					<dd><p>edit authenticated user</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/auth/profile/edit</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/auth/profile/edit</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -405,7 +410,12 @@
 | 
				
			|||||||
<li><p>Password and password confirmation don’t match.</p></li>
 | 
					<li><p>Password and password confirmation don’t match.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</p></li>
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – Provide a valid auth token.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error. Please try again or contact the administrator.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error. Please try again or contact the administrator.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -417,7 +427,7 @@
 | 
				
			|||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/picture</code><a class="headerlink" href="#post--api-auth-picture" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">POST </code><code class="sig-name descname">/api/auth/picture</code><a class="headerlink" href="#post--api-auth-picture" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>update authenticated user picture</p>
 | 
					<dd><p>update authenticated user picture</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/auth/picture</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">POST</span> <span class="nn">/api/auth/picture</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">multipart/form-data</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">multipart/form-data</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -469,7 +479,12 @@
 | 
				
			|||||||
<li><p>File extension not allowed.</p></li>
 | 
					<li><p>File extension not allowed.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</p></li>
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – Provide a valid auth token.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error during picture update.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error during picture update.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
@@ -481,7 +496,7 @@
 | 
				
			|||||||
<code class="sig-name descname">DELETE </code><code class="sig-name descname">/api/auth/picture</code><a class="headerlink" href="#delete--api-auth-picture" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">DELETE </code><code class="sig-name descname">/api/auth/picture</code><a class="headerlink" href="#delete--api-auth-picture" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>delete authenticated user picture</p>
 | 
					<dd><p>delete authenticated user picture</p>
 | 
				
			||||||
<p><strong>Example request</strong>:</p>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">DELETE</span> <span class="nn">/auth/picture</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">DELETE</span> <span class="nn">/api/auth/picture</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
</pre></div>
 | 
					</pre></div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
@@ -499,7 +514,12 @@
 | 
				
			|||||||
<dt class="field-even">Status Codes</dt>
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
<dd class="field-even"><ul class="simple">
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">204 No Content</a> – picture deleted</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5">204 No Content</a> – picture deleted</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – Provide a valid auth token.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error during picture deletion.</p></li>
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">500 Internal Server Error</a> – Error during picture deletion.</p></li>
 | 
				
			||||||
</ul>
 | 
					</ul>
 | 
				
			||||||
</dd>
 | 
					</dd>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,11 +123,113 @@
 | 
				
			|||||||
      
 | 
					      
 | 
				
			||||||
  <div class="section" id="records">
 | 
					  <div class="section" id="records">
 | 
				
			||||||
<h1>Records<a class="headerlink" href="#records" title="Permalink to this headline">¶</a></h1>
 | 
					<h1>Records<a class="headerlink" href="#records" title="Permalink to this headline">¶</a></h1>
 | 
				
			||||||
<p>work in progress</p>
 | 
					 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-records">
 | 
					<dt id="get--api-records">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/records</code><a class="headerlink" href="#get--api-records" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/records</code><a class="headerlink" href="#get--api-records" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get all records for authenticated user</p>
 | 
					<dd><p>Get all records for authenticated user.</p>
 | 
				
			||||||
 | 
					<dl class="simple">
 | 
				
			||||||
 | 
					<dt>Following types of records are available:</dt><dd><ul class="simple">
 | 
				
			||||||
 | 
					<li><p>average speed (record_type: ‘AS’)</p></li>
 | 
				
			||||||
 | 
					<li><p>farest distance (record_type: ‘FD’)</p></li>
 | 
				
			||||||
 | 
					<li><p>longest duration (record_type: ‘LD’)</p></li>
 | 
				
			||||||
 | 
					<li><p>maximum speed (record_type: ‘MS’)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/records</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example responses</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>returning records</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"records"</span><span class="p">:</span> <span class="p">[</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Sun, 07 Jul 2019 08:00:00 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">9</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"AS"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Sun, 07 Jul 2019 08:00:00 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"FD"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Sun, 07 Jul 2019 08:00:00 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">7</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">11</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"LD"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"value"</span><span class="p">:</span> <span class="s2">"1:01:00"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Sun, 07 Jul 2019 08:00:00 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">12</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"record_type"</span><span class="p">:</span> <span class="s2">"MS"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"sport_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"user_id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"value"</span><span class="p">:</span> <span class="mi">18</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">]</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>no records</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"records"</span><span class="p">:</span> <span class="p">[]</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,35 +123,159 @@
 | 
				
			|||||||
      
 | 
					      
 | 
				
			||||||
  <div class="section" id="sports">
 | 
					  <div class="section" id="sports">
 | 
				
			||||||
<h1>Sports<a class="headerlink" href="#sports" title="Permalink to this headline">¶</a></h1>
 | 
					<h1>Sports<a class="headerlink" href="#sports" title="Permalink to this headline">¶</a></h1>
 | 
				
			||||||
<p>work in progress</p>
 | 
					 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-sports">
 | 
					<dt id="get--api-sports">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/sports</code><a class="headerlink" href="#get--api-sports" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/sports</code><a class="headerlink" href="#get--api-sports" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get all sports</p>
 | 
					<dd><p>Get all sports</p>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/sports</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"sports"</span><span class="p">:</span> <span class="p">[</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/cycling-sport.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Cycling (Sport)"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/cycling-transport.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Cycling (Transport)"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/hiking.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Hiking"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">4</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/mountain-biking.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Mountain Biking"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/running.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Running"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/walking.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Walking"</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">]</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-sports-(int-sport_id)">
 | 
					<dt id="get--api-sports-(int-sport_id)">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/sports/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">sport_id</em><span class="sig-paren">)</span><a class="headerlink" href="#get--api-sports-(int-sport_id)" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/sports/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">sport_id</em><span class="sig-paren">)</span><a class="headerlink" href="#get--api-sports-(int-sport_id)" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get a sport</p>
 | 
					<dd><p>Get a sport</p>
 | 
				
			||||||
</dd></dl>
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/sports/1</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>success</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="post">
 | 
					<span class="p">{</span>
 | 
				
			||||||
<dt id="post--api-sports">
 | 
					  <span class="nt">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
<code class="sig-name descname">POST </code><code class="sig-name descname">/api/sports</code><a class="headerlink" href="#post--api-sports" title="Permalink to this definition">¶</a></dt>
 | 
					    <span class="nt">"sports"</span><span class="p">:</span> <span class="p">[</span>
 | 
				
			||||||
<dd><p>Post a sport</p>
 | 
					      <span class="p">{</span>
 | 
				
			||||||
</dd></dl>
 | 
					        <span class="nt">"_can_be_deleted"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"img"</span><span class="p">:</span> <span class="s2">"/img/sports/cycling-sport.png"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"label"</span><span class="p">:</span> <span class="s2">"Cycling (Sport)"</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">]</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>sport not found</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span> <span class="m">404</span> <span class="ne">NOT FOUND</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="patch">
 | 
					<span class="p">{</span>
 | 
				
			||||||
<dt id="patch--api-sports-(int-sport_id)">
 | 
					  <span class="nt">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
<code class="sig-name descname">PATCH </code><code class="sig-name descname">/api/sports/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">sport_id</em><span class="sig-paren">)</span><a class="headerlink" href="#patch--api-sports-(int-sport_id)" title="Permalink to this definition">¶</a></dt>
 | 
					    <span class="nt">"sports"</span><span class="p">:</span> <span class="p">[]</span>
 | 
				
			||||||
<dd><p>Update a sport</p>
 | 
					  <span class="p">},</span>
 | 
				
			||||||
</dd></dl>
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"not found"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
<dl class="delete">
 | 
					</pre></div>
 | 
				
			||||||
<dt id="delete--api-sports-(int-sport_id)">
 | 
					</div>
 | 
				
			||||||
<code class="sig-name descname">DELETE </code><code class="sig-name descname">/api/sports/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">sport_id</em><span class="sig-paren">)</span><a class="headerlink" href="#delete--api-sports-(int-sport_id)" title="Permalink to this definition">¶</a></dt>
 | 
					<dl class="field-list simple">
 | 
				
			||||||
<dd><p>Delete a sport</p>
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>sport_id</strong> (<em>integer</em>) – sport id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – sport not found</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,17 +123,212 @@
 | 
				
			|||||||
      
 | 
					      
 | 
				
			||||||
  <div class="section" id="statistics">
 | 
					  <div class="section" id="statistics">
 | 
				
			||||||
<h1>Statistics<a class="headerlink" href="#statistics" title="Permalink to this headline">¶</a></h1>
 | 
					<h1>Statistics<a class="headerlink" href="#statistics" title="Permalink to this headline">¶</a></h1>
 | 
				
			||||||
<p>work in progress</p>
 | 
					 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-stats-(int-user_id)-by_sport">
 | 
					<dt id="get--api-stats-(int-user_id)-by_sport">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_sport</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_sport" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_sport</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_sport" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get activities statistics for a user by sport</p>
 | 
					<dd><p>Get activities statistics for a user by sport</p>
 | 
				
			||||||
 | 
					<p><strong>Example requests</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>without parameters (get stats for all sports with activities)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_sport</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>with sport id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_sport?sport_id=1</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example responses</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>success</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"statistics"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					      <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mi">47</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">9960</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">5.613</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">1267</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="nt">"3"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">15.282</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">12341</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">}</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>no activities</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					      <span class="nt">"statistics"</span><span class="p">:</span> <span class="p">{}</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Query Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>sport_id</strong> (<em>integer</em>) – sport id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>User does not exist.</p></li>
 | 
				
			||||||
 | 
					<li><p>Sport does not exist.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-stats-(int-user_id)-by_time">
 | 
					<dt id="get--api-stats-(int-user_id)-by_time">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_time</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_time" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/stats/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/by_time</code><a class="headerlink" href="#get--api-stats-(int-user_id)-by_time" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get activities statistics for a user by time</p>
 | 
					<dd><p>Get activities statistics for a user by time</p>
 | 
				
			||||||
 | 
					<p><strong>Example requests</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>without parameters</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_time</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>with parameters</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/stats/1/by_time?from=2018-01-01&to=2018-06-30&time=week</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example responses</strong>:</p>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>success</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"statistics"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					      <span class="nt">"2017"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"3"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					          <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">15.282</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">12341</span>
 | 
				
			||||||
 | 
					        <span class="p">}</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="nt">"2019"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					          <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mi">47</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">9960</span>
 | 
				
			||||||
 | 
					        <span class="p">},</span>
 | 
				
			||||||
 | 
					        <span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					          <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">5.613</span><span class="p">,</span>
 | 
				
			||||||
 | 
					          <span class="nt">"total_duration"</span><span class="p">:</span> <span class="mi">1267</span>
 | 
				
			||||||
 | 
					        <span class="p">}</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">}</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<ul class="simple">
 | 
				
			||||||
 | 
					<li><p>no activities</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					      <span class="nt">"statistics"</span><span class="p">:</span> <span class="p">{}</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Query Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>from</strong> (<em>string</em>) – start date (format: <code class="docutils literal notranslate"><span class="pre">%Y-%m-%d</span></code>)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>to</strong> (<em>string</em>) – end date (format: <code class="docutils literal notranslate"><span class="pre">%Y-%m-%d</span></code>)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>time</strong> (<em>string</em>) – <p>time frame:</p>
 | 
				
			||||||
 | 
					<ul>
 | 
				
			||||||
 | 
					<li><p><code class="docutils literal notranslate"><span class="pre">week</span></code>: week starting Sunday</p></li>
 | 
				
			||||||
 | 
					<li><p><code class="docutils literal notranslate"><span class="pre">weekm</span></code>: week starting Monday</p></li>
 | 
				
			||||||
 | 
					<li><p><code class="docutils literal notranslate"><span class="pre">month</span></code>: month</p></li>
 | 
				
			||||||
 | 
					<li><p><code class="docutils literal notranslate"><span class="pre">year</span></code>: year (default)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>User does not exist.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -123,29 +123,221 @@
 | 
				
			|||||||
      
 | 
					      
 | 
				
			||||||
  <div class="section" id="users">
 | 
					  <div class="section" id="users">
 | 
				
			||||||
<h1>Users<a class="headerlink" href="#users" title="Permalink to this headline">¶</a></h1>
 | 
					<h1>Users<a class="headerlink" href="#users" title="Permalink to this headline">¶</a></h1>
 | 
				
			||||||
<p>work in progress</p>
 | 
					 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-users">
 | 
					<dt id="get--api-users">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users</code><a class="headerlink" href="#get--api-users" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users</code><a class="headerlink" href="#get--api-users" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get all users</p>
 | 
					<dd><p>Get all users</p>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/users</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"users"</span><span class="p">:</span> <span class="p">[</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"admin"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"bio"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"birth_date"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"created_at"</span><span class="p">:</span> <span class="s2">"Sun, 14 Jul 2019 14:09:58 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"email"</span><span class="p">:</span> <span class="s2">"admin@example.com"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"first_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"last_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"location"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_sports"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"picture"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"timezone"</span><span class="p">:</span> <span class="s2">"Europe/Paris"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">67.895</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_duration"</span><span class="p">:</span> <span class="s2">"6:50:27"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"admin"</span>
 | 
				
			||||||
 | 
					      <span class="p">},</span>
 | 
				
			||||||
 | 
					      <span class="p">{</span>
 | 
				
			||||||
 | 
					        <span class="nt">"admin"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"bio"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"birth_date"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"created_at"</span><span class="p">:</span> <span class="s2">"Sat, 20 Jul 2019 11:27:03 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"email"</span><span class="p">:</span> <span class="s2">"sam@example.com"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"first_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"id"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"last_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"location"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"nb_sports"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"picture"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"timezone"</span><span class="p">:</span> <span class="s2">"Europe/Paris"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"total_duration"</span><span class="p">:</span> <span class="s2">"0:00:00"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					        <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"sam"</span>
 | 
				
			||||||
 | 
					      <span class="p">}</span>
 | 
				
			||||||
 | 
					    <span class="p">]</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-users-(user_id)">
 | 
					<dt id="get--api-users-(user_id)">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users/</code><span class="sig-paren">(</span><em class="sig-param">user_id</em><span class="sig-paren">)</span><a class="headerlink" href="#get--api-users-(user_id)" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users/</code><span class="sig-paren">(</span><em class="sig-param">user_id</em><span class="sig-paren">)</span><a class="headerlink" href="#get--api-users-(user_id)" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>Get single user details</p>
 | 
					<dd><p>Get single user details</p>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/users/1</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"data"</span><span class="p">:</span> <span class="p">{</span>
 | 
				
			||||||
 | 
					    <span class="nt">"admin"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"bio"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"birth_date"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"created_at"</span><span class="p">:</span> <span class="s2">"Sun, 14 Jul 2019 14:09:58 GMT"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"email"</span><span class="p">:</span> <span class="s2">"admin@example.com"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"first_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"id"</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"last_name"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"location"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"nb_activities"</span><span class="p">:</span> <span class="mi">6</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"nb_sports"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"picture"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"timezone"</span><span class="p">:</span> <span class="s2">"Europe/Paris"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"total_distance"</span><span class="p">:</span> <span class="mf">67.895</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"total_duration"</span><span class="p">:</span> <span class="s2">"6:50:27"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					    <span class="nt">"username"</span><span class="p">:</span> <span class="s2">"admin"</span>
 | 
				
			||||||
 | 
					  <span class="p">},</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Request Headers</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="https://tools.ietf.org/html/rfc7235#section-4.2">Authorization</a> – OAuth 2.0 Bearer Token</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>User does not exist</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-users-(user_id)-picture">
 | 
					<dt id="get--api-users-(user_id)-picture">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users/</code><span class="sig-paren">(</span><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/picture</code><a class="headerlink" href="#get--api-users-(user_id)-picture" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/users/</code><span class="sig-paren">(</span><em class="sig-param">user_id</em><span class="sig-paren">)</span><code class="sig-name descname">/picture</code><a class="headerlink" href="#get--api-users-(user_id)-picture" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>get user picture</p>
 | 
					<dd><p>get user picture</p>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/users/1/picture</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">image/jpeg</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Parameters</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><strong>auth_user_id</strong> (<em>integer</em>) – authenticate user id (from JSON Web Token)</p></li>
 | 
				
			||||||
 | 
					<li><p><strong>user_id</strong> (<em>integer</em>) – user id</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					<dt class="field-even">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-even"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">401 Unauthorized</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>Provide a valid auth token.</p></li>
 | 
				
			||||||
 | 
					<li><p>Signature expired. Please log in again.</p></li>
 | 
				
			||||||
 | 
					<li><p>Invalid token. Please log in again.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">404 Not Found</a> – <ul>
 | 
				
			||||||
 | 
					<li><p>User does not exist</p></li>
 | 
				
			||||||
 | 
					<li><p>No picture.</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<dl class="get">
 | 
					<dl class="get">
 | 
				
			||||||
<dt id="get--api-ping">
 | 
					<dt id="get--api-ping">
 | 
				
			||||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/ping</code><a class="headerlink" href="#get--api-ping" title="Permalink to this definition">¶</a></dt>
 | 
					<code class="sig-name descname">GET </code><code class="sig-name descname">/api/ping</code><a class="headerlink" href="#get--api-ping" title="Permalink to this definition">¶</a></dt>
 | 
				
			||||||
<dd><p>health check endpoint</p>
 | 
					<dd><p>health check endpoint</p>
 | 
				
			||||||
 | 
					<p><strong>Example request</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/ping</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
 | 
				
			||||||
 | 
					<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<p><strong>Example response</strong>:</p>
 | 
				
			||||||
 | 
					<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><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">"message"</span><span class="p">:</span> <span class="s2">"pong!"</span><span class="p">,</span>
 | 
				
			||||||
 | 
					  <span class="nt">"status"</span><span class="p">:</span> <span class="s2">"success"</span>
 | 
				
			||||||
 | 
					<span class="p">}</span>
 | 
				
			||||||
 | 
					</pre></div>
 | 
				
			||||||
 | 
					</div>
 | 
				
			||||||
 | 
					<dl class="field-list simple">
 | 
				
			||||||
 | 
					<dt class="field-odd">Status Codes</dt>
 | 
				
			||||||
 | 
					<dd class="field-odd"><ul class="simple">
 | 
				
			||||||
 | 
					<li><p><a class="reference external" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">200 OK</a> – success</p></li>
 | 
				
			||||||
 | 
					</ul>
 | 
				
			||||||
 | 
					</dd>
 | 
				
			||||||
 | 
					</dl>
 | 
				
			||||||
</dd></dl>
 | 
					</dd></dl>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -232,11 +232,6 @@
 | 
				
			|||||||
       <td>
 | 
					       <td>
 | 
				
			||||||
       <a href="api/auth.html#post--api-auth-register"><code class="xref">POST /api/auth/register</code></a></td><td>
 | 
					       <a href="api/auth.html#post--api-auth-register"><code class="xref">POST /api/auth/register</code></a></td><td>
 | 
				
			||||||
       <em></em></td></tr>
 | 
					       <em></em></td></tr>
 | 
				
			||||||
     <tr>
 | 
					 | 
				
			||||||
       <td></td>
 | 
					 | 
				
			||||||
       <td>
 | 
					 | 
				
			||||||
       <a href="api/sports.html#post--api-sports"><code class="xref">POST /api/sports</code></a></td><td>
 | 
					 | 
				
			||||||
       <em></em></td></tr>
 | 
					 | 
				
			||||||
     <tr>
 | 
					     <tr>
 | 
				
			||||||
       <td></td>
 | 
					       <td></td>
 | 
				
			||||||
       <td>
 | 
					       <td>
 | 
				
			||||||
@@ -247,21 +242,11 @@
 | 
				
			|||||||
       <td>
 | 
					       <td>
 | 
				
			||||||
       <a href="api/auth.html#delete--api-auth-picture"><code class="xref">DELETE /api/auth/picture</code></a></td><td>
 | 
					       <a href="api/auth.html#delete--api-auth-picture"><code class="xref">DELETE /api/auth/picture</code></a></td><td>
 | 
				
			||||||
       <em></em></td></tr>
 | 
					       <em></em></td></tr>
 | 
				
			||||||
     <tr>
 | 
					 | 
				
			||||||
       <td></td>
 | 
					 | 
				
			||||||
       <td>
 | 
					 | 
				
			||||||
       <a href="api/sports.html#delete--api-sports-(int-sport_id)"><code class="xref">DELETE /api/sports/(int:sport_id)</code></a></td><td>
 | 
					 | 
				
			||||||
       <em></em></td></tr>
 | 
					 | 
				
			||||||
     <tr>
 | 
					     <tr>
 | 
				
			||||||
       <td></td>
 | 
					       <td></td>
 | 
				
			||||||
       <td>
 | 
					       <td>
 | 
				
			||||||
       <a href="api/activities.html#patch--api-activities-(int-activity_id)"><code class="xref">PATCH /api/activities/(int:activity_id)</code></a></td><td>
 | 
					       <a href="api/activities.html#patch--api-activities-(int-activity_id)"><code class="xref">PATCH /api/activities/(int:activity_id)</code></a></td><td>
 | 
				
			||||||
       <em></em></td></tr>
 | 
					       <em></em></td></tr>
 | 
				
			||||||
     <tr>
 | 
					 | 
				
			||||||
       <td></td>
 | 
					 | 
				
			||||||
       <td>
 | 
					 | 
				
			||||||
       <a href="api/sports.html#patch--api-sports-(int-sport_id)"><code class="xref">PATCH /api/sports/(int:sport_id)</code></a></td><td>
 | 
					 | 
				
			||||||
       <em></em></td></tr>
 | 
					 | 
				
			||||||
   </table>
 | 
					   </table>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								docs/objects.inv
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								docs/objects.inv
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -1,8 +1,6 @@
 | 
				
			|||||||
Records
 | 
					Records
 | 
				
			||||||
#######
 | 
					#######
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    records.get_records
 | 
					    records.get_records
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,12 +1,7 @@
 | 
				
			|||||||
Sports
 | 
					Sports
 | 
				
			||||||
######
 | 
					######
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    sports.get_sports,
 | 
					    sports.get_sports,
 | 
				
			||||||
    sports.get_sport,
 | 
					    sports.get_sport
 | 
				
			||||||
    sports.post_sport,
 | 
					 | 
				
			||||||
    sports.update_sport,
 | 
					 | 
				
			||||||
    sports.delete_sport
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,6 @@
 | 
				
			|||||||
Statistics
 | 
					Statistics
 | 
				
			||||||
##########
 | 
					##########
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    stats.get_activities_by_sport,
 | 
					    stats.get_activities_by_sport,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,6 @@
 | 
				
			|||||||
Users
 | 
					Users
 | 
				
			||||||
#####
 | 
					#####
 | 
				
			||||||
 | 
					
 | 
				
			||||||
work in progress
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
.. autoflask:: fittrackee_api:create_app()
 | 
					.. autoflask:: fittrackee_api:create_app()
 | 
				
			||||||
   :endpoints:
 | 
					   :endpoints:
 | 
				
			||||||
    users.get_users,
 | 
					    users.get_users,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -137,7 +137,7 @@ def get_activities(auth_user_id):
 | 
				
			|||||||
            "status": "success"
 | 
					            "status": "success"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :query integer page: page if using pagination (default: 1)
 | 
					    :query integer page: page if using pagination (default: 1)
 | 
				
			||||||
    :query integer per_page: number of activities per page (default: 5)
 | 
					    :query integer per_page: number of activities per page (default: 5)
 | 
				
			||||||
@@ -157,7 +157,10 @@ def get_activities(auth_user_id):
 | 
				
			|||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: success
 | 
					    :statuscode 200: success
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -302,13 +305,16 @@ def get_activity(auth_user_id, activity_id):
 | 
				
			|||||||
          "status": "not found"
 | 
					          "status": "not found"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
    :param integer activity_id: activity id
 | 
					    :param integer activity_id: activity id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: success
 | 
					    :statuscode 200: success
 | 
				
			||||||
    :statuscode 401: Provide a valid auth token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 403: You do not have permissions
 | 
					    :statuscode 403: You do not have permissions
 | 
				
			||||||
    :statuscode 404: activity not found
 | 
					    :statuscode 404: activity not found
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -416,14 +422,17 @@ def get_activity_gpx(auth_user_id, activity_id):
 | 
				
			|||||||
        "status": "success"
 | 
					        "status": "success"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
    :param integer activity_id: activity id
 | 
					    :param integer activity_id: activity id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: success
 | 
					    :statuscode 200: success
 | 
				
			||||||
    :statuscode 400: no gpx file for this activity
 | 
					    :statuscode 400: no gpx file for this activity
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 404: activity not found
 | 
					    :statuscode 404: activity not found
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -476,14 +485,17 @@ def get_activity_chart_data(auth_user_id, activity_id):
 | 
				
			|||||||
        "status": "success"
 | 
					        "status": "success"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
    :param integer activity_id: activity id
 | 
					    :param integer activity_id: activity id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: success
 | 
					    :statuscode 200: success
 | 
				
			||||||
    :statuscode 400: no gpx file for this activity
 | 
					    :statuscode 400: no gpx file for this activity
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 404: activity not found
 | 
					    :statuscode 404: activity not found
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -511,13 +523,13 @@ def get_map(map_id):
 | 
				
			|||||||
      HTTP/1.1 200 OK
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
      Content-Type: image/png
 | 
					      Content-Type: image/png
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					 | 
				
			||||||
    :param string map_id: activity map id
 | 
					    :param string map_id: activity map id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    :statuscode 200: success
 | 
					    :statuscode 200: success
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 404: map does not exist
 | 
					    :statuscode 404: map does not exist
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -636,7 +648,7 @@ def post_activity(auth_user_id):
 | 
				
			|||||||
          "status": "success"
 | 
					          "status": "success"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :form file: gpx file (allowed extensions: .gpx, .zip)
 | 
					    :form file: gpx file (allowed extensions: .gpx, .zip)
 | 
				
			||||||
    :form data: sport id and notes (example: ``{"sport_id": 1, "notes": ""}``)
 | 
					    :form data: sport id and notes (example: ``{"sport_id": 1, "notes": ""}``)
 | 
				
			||||||
@@ -649,7 +661,10 @@ def post_activity(auth_user_id):
 | 
				
			|||||||
        - No file part.
 | 
					        - No file part.
 | 
				
			||||||
        - No selected file.
 | 
					        - No selected file.
 | 
				
			||||||
        - File extension not allowed.
 | 
					        - File extension not allowed.
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -721,7 +736,7 @@ def post_activity_no_gpx(auth_user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      POST /api/activities/ HTTP/1.1
 | 
					      POST /api/activities/no_gpx HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example response**:
 | 
					    **Example response**:
 | 
				
			||||||
@@ -805,7 +820,7 @@ def post_activity_no_gpx(auth_user_id):
 | 
				
			|||||||
          "status": "success"
 | 
					          "status": "success"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :<json string activity_date: activity date  (format: ``%Y-%m-%d %H:%M``)
 | 
					    :<json string activity_date: activity date  (format: ``%Y-%m-%d %H:%M``)
 | 
				
			||||||
    :<json float distance: activity distance in km
 | 
					    :<json float distance: activity distance in km
 | 
				
			||||||
@@ -818,7 +833,10 @@ def post_activity_no_gpx(auth_user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    :statuscode 201: activity created
 | 
					    :statuscode 201: activity created
 | 
				
			||||||
    :statuscode 400: invalid payload
 | 
					    :statuscode 400: invalid payload
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -951,7 +969,7 @@ def update_activity(auth_user_id, activity_id):
 | 
				
			|||||||
          "status": "success"
 | 
					          "status": "success"
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
    :param integer activity_id: activity id
 | 
					    :param integer activity_id: activity id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :<json string activity_date: activity date  (format: ``%Y-%m-%d %H:%M``)
 | 
					    :<json string activity_date: activity date  (format: ``%Y-%m-%d %H:%M``)
 | 
				
			||||||
@@ -968,7 +986,10 @@ def update_activity(auth_user_id, activity_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: activity updated
 | 
					    :statuscode 200: activity updated
 | 
				
			||||||
    :statuscode 400: invalid payload
 | 
					    :statuscode 400: invalid payload
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 404: activity not found
 | 
					    :statuscode 404: activity not found
 | 
				
			||||||
    :statuscode 500:
 | 
					    :statuscode 500:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1039,13 +1060,16 @@ def delete_activity(auth_user_id, activity_id):
 | 
				
			|||||||
      HTTP/1.1 204 NO CONTENT
 | 
					      HTTP/1.1 204 NO CONTENT
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param integer auth_user_id: authenticate user id
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
    :param integer activity_id: activity id
 | 
					    :param integer activity_id: activity id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 204: activity deleted
 | 
					    :statuscode 204: activity deleted
 | 
				
			||||||
    :statuscode 401: invalid token
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 404: activity not found
 | 
					    :statuscode 404: activity not found
 | 
				
			||||||
    :statuscode 500: Error. Please try again or contact the administrator.
 | 
					    :statuscode 500: Error. Please try again or contact the administrator.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,101 @@ records_blueprint = Blueprint('records', __name__)
 | 
				
			|||||||
@records_blueprint.route('/records', methods=['GET'])
 | 
					@records_blueprint.route('/records', methods=['GET'])
 | 
				
			||||||
@authenticate
 | 
					@authenticate
 | 
				
			||||||
def get_records(auth_user_id):
 | 
					def get_records(auth_user_id):
 | 
				
			||||||
    """Get all records for authenticated user"""
 | 
					    """
 | 
				
			||||||
 | 
					    Get all records for authenticated user.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Following types of records are available:
 | 
				
			||||||
 | 
					        - average speed (record_type: 'AS')
 | 
				
			||||||
 | 
					        - farest distance (record_type: 'FD')
 | 
				
			||||||
 | 
					        - longest duration (record_type: 'LD')
 | 
				
			||||||
 | 
					        - maximum speed (record_type: 'MS')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/records HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example responses**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - returning records
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "records": [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "activity_date": "Sun, 07 Jul 2019 08:00:00 GMT",
 | 
				
			||||||
 | 
					              "activity_id": 4,
 | 
				
			||||||
 | 
					              "id": 9,
 | 
				
			||||||
 | 
					              "record_type": "AS",
 | 
				
			||||||
 | 
					              "sport_id": 1,
 | 
				
			||||||
 | 
					              "user_id": 1,
 | 
				
			||||||
 | 
					              "value": 18
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "activity_date": "Sun, 07 Jul 2019 08:00:00 GMT",
 | 
				
			||||||
 | 
					              "activity_id": 4,
 | 
				
			||||||
 | 
					              "id": 10,
 | 
				
			||||||
 | 
					              "record_type": "FD",
 | 
				
			||||||
 | 
					              "sport_id": 1,
 | 
				
			||||||
 | 
					              "user_id": 1,
 | 
				
			||||||
 | 
					              "value": 18
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "activity_date": "Sun, 07 Jul 2019 08:00:00 GMT",
 | 
				
			||||||
 | 
					              "activity_id": 7,
 | 
				
			||||||
 | 
					              "id": 11,
 | 
				
			||||||
 | 
					              "record_type": "LD",
 | 
				
			||||||
 | 
					              "sport_id": 1,
 | 
				
			||||||
 | 
					              "user_id": 1,
 | 
				
			||||||
 | 
					              "value": "1:01:00"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "activity_date": "Sun, 07 Jul 2019 08:00:00 GMT",
 | 
				
			||||||
 | 
					              "activity_id": 4,
 | 
				
			||||||
 | 
					              "id": 12,
 | 
				
			||||||
 | 
					              "record_type": "MS",
 | 
				
			||||||
 | 
					              "sport_id": 1,
 | 
				
			||||||
 | 
					              "user_id": 1,
 | 
				
			||||||
 | 
					              "value": 18
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - no records
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "records": []
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    records = Record.query.filter_by(user_id=auth_user_id)\
 | 
					    records = Record.query.filter_by(user_id=auth_user_id)\
 | 
				
			||||||
        .order_by(
 | 
					        .order_by(
 | 
				
			||||||
        Record.sport_id.asc(),
 | 
					        Record.sport_id.asc(),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,79 @@ sports_blueprint = Blueprint('sports', __name__)
 | 
				
			|||||||
@sports_blueprint.route('/sports', methods=['GET'])
 | 
					@sports_blueprint.route('/sports', methods=['GET'])
 | 
				
			||||||
@authenticate
 | 
					@authenticate
 | 
				
			||||||
def get_sports(auth_user_id):
 | 
					def get_sports(auth_user_id):
 | 
				
			||||||
    """Get all sports"""
 | 
					    """
 | 
				
			||||||
 | 
					    Get all sports
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/sports HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "sports": [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 1,
 | 
				
			||||||
 | 
					              "img": "/img/sports/cycling-sport.png",
 | 
				
			||||||
 | 
					              "label": "Cycling (Sport)"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 2,
 | 
				
			||||||
 | 
					              "img": "/img/sports/cycling-transport.png",
 | 
				
			||||||
 | 
					              "label": "Cycling (Transport)"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 3,
 | 
				
			||||||
 | 
					              "img": "/img/sports/hiking.png",
 | 
				
			||||||
 | 
					              "label": "Hiking"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 4,
 | 
				
			||||||
 | 
					              "img": "/img/sports/mountain-biking.png",
 | 
				
			||||||
 | 
					              "label": "Mountain Biking"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 5,
 | 
				
			||||||
 | 
					              "img": "/img/sports/running.png",
 | 
				
			||||||
 | 
					              "label": "Running"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 6,
 | 
				
			||||||
 | 
					              "img": "/img/sports/walking.png",
 | 
				
			||||||
 | 
					              "label": "Walking"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sports = Sport.query.order_by(Sport.id).all()
 | 
					    sports = Sport.query.order_by(Sport.id).all()
 | 
				
			||||||
    response_object = {
 | 
					    response_object = {
 | 
				
			||||||
        'status': 'success',
 | 
					        'status': 'success',
 | 
				
			||||||
@@ -25,7 +97,66 @@ def get_sports(auth_user_id):
 | 
				
			|||||||
@sports_blueprint.route('/sports/<int:sport_id>', methods=['GET'])
 | 
					@sports_blueprint.route('/sports/<int:sport_id>', methods=['GET'])
 | 
				
			||||||
@authenticate
 | 
					@authenticate
 | 
				
			||||||
def get_sport(auth_user_id, sport_id):
 | 
					def get_sport(auth_user_id, sport_id):
 | 
				
			||||||
    """Get a sport"""
 | 
					    """Get a sport
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/sports/1 HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "sports": [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "_can_be_deleted": false,
 | 
				
			||||||
 | 
					              "id": 1,
 | 
				
			||||||
 | 
					              "img": "/img/sports/cycling-sport.png",
 | 
				
			||||||
 | 
					              "label": "Cycling (Sport)"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - sport not found
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 404 NOT FOUND
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "sports": []
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "not found"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					    :param integer sport_id: sport id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					    :statuscode 404: sport not found
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sport = Sport.query.filter_by(id=sport_id).first()
 | 
					    sport = Sport.query.filter_by(id=sport_id).first()
 | 
				
			||||||
    if sport:
 | 
					    if sport:
 | 
				
			||||||
        response_object = {
 | 
					        response_object = {
 | 
				
			||||||
@@ -46,6 +177,8 @@ def get_sport(auth_user_id, sport_id):
 | 
				
			|||||||
    return jsonify(response_object), code
 | 
					    return jsonify(response_object), code
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# no administration - no documentation for now
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@sports_blueprint.route('/sports', methods=['POST'])
 | 
					@sports_blueprint.route('/sports', methods=['POST'])
 | 
				
			||||||
@authenticate_as_admin
 | 
					@authenticate_as_admin
 | 
				
			||||||
def post_sport(auth_user_id):
 | 
					def post_sport(auth_user_id):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -130,12 +130,180 @@ def get_activities(user_id, filter_type):
 | 
				
			|||||||
@stats_blueprint.route('/stats/<int:user_id>/by_time', methods=['GET'])
 | 
					@stats_blueprint.route('/stats/<int:user_id>/by_time', methods=['GET'])
 | 
				
			||||||
@authenticate
 | 
					@authenticate
 | 
				
			||||||
def get_activities_by_time(auth_user_id, user_id):
 | 
					def get_activities_by_time(auth_user_id, user_id):
 | 
				
			||||||
    """Get activities statistics for a user by time"""
 | 
					    """
 | 
				
			||||||
 | 
					    Get activities statistics for a user by time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example requests**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - without parameters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/stats/1/by_time HTTP/1.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - with parameters
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/stats/1/by_time?from=2018-01-01&to=2018-06-30&time=week HTTP/1.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example responses**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "statistics": {
 | 
				
			||||||
 | 
					            "2017": {
 | 
				
			||||||
 | 
					              "3": {
 | 
				
			||||||
 | 
					                "nb_activities": 2,
 | 
				
			||||||
 | 
					                "total_distance": 15.282,
 | 
				
			||||||
 | 
					                "total_duration": 12341
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "2019": {
 | 
				
			||||||
 | 
					              "1": {
 | 
				
			||||||
 | 
					                "nb_activities": 3,
 | 
				
			||||||
 | 
					                "total_distance": 47,
 | 
				
			||||||
 | 
					                "total_duration": 9960
 | 
				
			||||||
 | 
					              },
 | 
				
			||||||
 | 
					              "2": {
 | 
				
			||||||
 | 
					                "nb_activities": 1,
 | 
				
			||||||
 | 
					                "total_distance": 5.613,
 | 
				
			||||||
 | 
					                "total_duration": 1267
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - no activities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					            "statistics": {}
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					    :param integer user_id: user id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :query string from: start date (format: ``%Y-%m-%d``)
 | 
				
			||||||
 | 
					    :query string to: end date (format: ``%Y-%m-%d``)
 | 
				
			||||||
 | 
					    :query string time: time frame:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      - ``week``: week starting Sunday
 | 
				
			||||||
 | 
					      - ``weekm``: week starting Monday
 | 
				
			||||||
 | 
					      - ``month``: month
 | 
				
			||||||
 | 
					      - ``year``: year (default)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					    :statuscode 404:
 | 
				
			||||||
 | 
					        - User does not exist.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    return get_activities(user_id, 'by_time')
 | 
					    return get_activities(user_id, 'by_time')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@stats_blueprint.route('/stats/<int:user_id>/by_sport', methods=['GET'])
 | 
					@stats_blueprint.route('/stats/<int:user_id>/by_sport', methods=['GET'])
 | 
				
			||||||
@authenticate
 | 
					@authenticate
 | 
				
			||||||
def get_activities_by_sport(auth_user_id, user_id):
 | 
					def get_activities_by_sport(auth_user_id, user_id):
 | 
				
			||||||
    """Get activities statistics for a user by sport"""
 | 
					    """
 | 
				
			||||||
 | 
					    Get activities statistics for a user by sport
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example requests**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - without parameters (get stats for all sports with activities)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/stats/1/by_sport HTTP/1.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - with sport id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/stats/1/by_sport?sport_id=1 HTTP/1.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example responses**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "statistics": {
 | 
				
			||||||
 | 
					            "1": {
 | 
				
			||||||
 | 
					              "nb_activities": 3,
 | 
				
			||||||
 | 
					              "total_distance": 47,
 | 
				
			||||||
 | 
					              "total_duration": 9960
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "2": {
 | 
				
			||||||
 | 
					              "nb_activities": 1,
 | 
				
			||||||
 | 
					              "total_distance": 5.613,
 | 
				
			||||||
 | 
					              "total_duration": 1267
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            "3": {
 | 
				
			||||||
 | 
					              "nb_activities": 2,
 | 
				
			||||||
 | 
					              "total_distance": 15.282,
 | 
				
			||||||
 | 
					              "total_duration": 12341
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    - no activities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					            "statistics": {}
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					    :param integer user_id: user id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :query integer sport_id: sport id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					    :statuscode 404:
 | 
				
			||||||
 | 
					        - User does not exist.
 | 
				
			||||||
 | 
					        - Sport does not exist.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    return get_activities(user_id, 'by_sport')
 | 
					    return get_activities(user_id, 'by_sport')
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,8 +16,23 @@ def test_ping(app):
 | 
				
			|||||||
def test_single_user(app, user_1):
 | 
					def test_single_user(app, user_1):
 | 
				
			||||||
    """=> Get single user details"""
 | 
					    """=> Get single user details"""
 | 
				
			||||||
    client = app.test_client()
 | 
					    client = app.test_client()
 | 
				
			||||||
 | 
					    resp_login = client.post(
 | 
				
			||||||
    response = client.get(f'/api/users/{user_1.id}')
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        f'/api/users/{user_1.id}',
 | 
				
			||||||
 | 
					        content_type='application/json',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    data = json.loads(response.data.decode())
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert response.status_code == 200
 | 
					    assert response.status_code == 200
 | 
				
			||||||
@@ -45,8 +60,23 @@ def test_single_user_with_activities(
 | 
				
			|||||||
):
 | 
					):
 | 
				
			||||||
    """=> Get single user details"""
 | 
					    """=> Get single user details"""
 | 
				
			||||||
    client = app.test_client()
 | 
					    client = app.test_client()
 | 
				
			||||||
 | 
					    resp_login = client.post(
 | 
				
			||||||
    response = client.get(f'/api/users/{user_1.id}')
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        f'/api/users/{user_1.id}',
 | 
				
			||||||
 | 
					        content_type='application/json',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    data = json.loads(response.data.decode())
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert response.status_code == 200
 | 
					    assert response.status_code == 200
 | 
				
			||||||
@@ -68,33 +98,80 @@ def test_single_user_with_activities(
 | 
				
			|||||||
    assert data['data']['total_duration'] == '1:57:04'
 | 
					    assert data['data']['total_duration'] == '1:57:04'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_single_user_no_id(app):
 | 
					def test_single_user_no_id(app, user_1):
 | 
				
			||||||
    """=> Ensure error is thrown if an id is not provided."""
 | 
					    """=> Ensure error is thrown if an id is not provided."""
 | 
				
			||||||
    client = app.test_client()
 | 
					    client = app.test_client()
 | 
				
			||||||
    response = client.get(f'/api/users/blah')
 | 
					    resp_login = client.post(
 | 
				
			||||||
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        '/api/users/blah',
 | 
				
			||||||
 | 
					        content_type='application/json',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    data = json.loads(response.data.decode())
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert response.status_code == 404
 | 
					    assert response.status_code == 404
 | 
				
			||||||
    assert 'fail' in data['status']
 | 
					    assert 'fail' in data['status']
 | 
				
			||||||
    assert 'User does not exist' in data['message']
 | 
					    assert 'User does not exist.' in data['message']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_single_user_wrong_id(app):
 | 
					def test_single_user_wrong_id(app, user_1):
 | 
				
			||||||
    """=> Ensure error is thrown if the id does not exist."""
 | 
					    """=> Ensure error is thrown if the id does not exist."""
 | 
				
			||||||
    client = app.test_client()
 | 
					    client = app.test_client()
 | 
				
			||||||
    response = client.get(f'/api/users/99999999999')
 | 
					    resp_login = client.post(
 | 
				
			||||||
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        '/api/users/99999999999',
 | 
				
			||||||
 | 
					        content_type='application/json',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    data = json.loads(response.data.decode())
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert response.status_code == 404
 | 
					    assert response.status_code == 404
 | 
				
			||||||
    assert 'fail' in data['status']
 | 
					    assert 'fail' in data['status']
 | 
				
			||||||
    assert 'User does not exist' in data['message']
 | 
					    assert 'User does not exist.' in data['message']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_users_list(app, user_1, user_2):
 | 
					def test_users_list(app, user_1, user_2):
 | 
				
			||||||
    """=> Ensure get single user behaves correctly."""
 | 
					    """=> Ensure get single user behaves correctly."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    client = app.test_client()
 | 
					    client = app.test_client()
 | 
				
			||||||
    response = client.get('/api/users')
 | 
					    resp_login = client.post(
 | 
				
			||||||
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        '/api/users',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
    data = json.loads(response.data.decode())
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert response.status_code == 200
 | 
					    assert response.status_code == 200
 | 
				
			||||||
@@ -129,3 +206,53 @@ def test_decode_auth_token(app, user_1):
 | 
				
			|||||||
    auth_token = user_1.encode_auth_token(user_1.id)
 | 
					    auth_token = user_1.encode_auth_token(user_1.id)
 | 
				
			||||||
    assert isinstance(auth_token, bytes)
 | 
					    assert isinstance(auth_token, bytes)
 | 
				
			||||||
    assert User.decode_auth_token(auth_token) == user_1.id
 | 
					    assert User.decode_auth_token(auth_token) == user_1.id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_user_no_picture(app, user_1):
 | 
				
			||||||
 | 
					    client = app.test_client()
 | 
				
			||||||
 | 
					    resp_login = client.post(
 | 
				
			||||||
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        '/api/users/1/picture',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert response.status_code == 404
 | 
				
			||||||
 | 
					    assert 'not found' in data['status']
 | 
				
			||||||
 | 
					    assert 'No picture.' in data['message']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def test_user_picture_no_user(app, user_1):
 | 
				
			||||||
 | 
					    client = app.test_client()
 | 
				
			||||||
 | 
					    resp_login = client.post(
 | 
				
			||||||
 | 
					        '/api/auth/login',
 | 
				
			||||||
 | 
					        data=json.dumps(dict(
 | 
				
			||||||
 | 
					            email='test@test.com',
 | 
				
			||||||
 | 
					            password='12345678'
 | 
				
			||||||
 | 
					        )),
 | 
				
			||||||
 | 
					        content_type='application/json'
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    response = client.get(
 | 
				
			||||||
 | 
					        '/api/users/2/picture',
 | 
				
			||||||
 | 
					        headers=dict(
 | 
				
			||||||
 | 
					            Authorization='Bearer ' + json.loads(
 | 
				
			||||||
 | 
					                resp_login.data.decode()
 | 
				
			||||||
 | 
					            )['auth_token']
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    data = json.loads(response.data.decode())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    assert response.status_code == 404
 | 
				
			||||||
 | 
					    assert 'fail' in data['status']
 | 
				
			||||||
 | 
					    assert 'User does not exist.' in data['message']
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ def register_user():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      POST /auth/register HTTP/1.1
 | 
					      POST /api/auth/register HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example responses**:
 | 
					    **Example responses**:
 | 
				
			||||||
@@ -153,7 +153,7 @@ def login_user():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      POST /auth/login HTTP/1.1
 | 
					      POST /api/auth/login HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example responses**:
 | 
					    **Example responses**:
 | 
				
			||||||
@@ -240,7 +240,7 @@ def logout_user(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      GET /auth/logout HTTP/1.1
 | 
					      GET /api/auth/logout HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example responses**:
 | 
					    **Example responses**:
 | 
				
			||||||
@@ -310,7 +310,7 @@ def get_user_status(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      GET /auth/profile HTTP/1.1
 | 
					      GET /api/auth/profile HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example response**:
 | 
					    **Example response**:
 | 
				
			||||||
@@ -345,7 +345,10 @@ def get_user_status(user_id):
 | 
				
			|||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 200: success.
 | 
					    :statuscode 200: success.
 | 
				
			||||||
    :statuscode 401: Provide a valid auth token.
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    user = User.query.filter_by(id=user_id).first()
 | 
					    user = User.query.filter_by(id=user_id).first()
 | 
				
			||||||
@@ -366,7 +369,7 @@ def edit_user(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      POST /auth/profile/edit HTTP/1.1
 | 
					      POST /api/auth/profile/edit HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example response**:
 | 
					    **Example response**:
 | 
				
			||||||
@@ -413,7 +416,10 @@ def edit_user(user_id):
 | 
				
			|||||||
    :statuscode 400:
 | 
					    :statuscode 400:
 | 
				
			||||||
        - Invalid payload.
 | 
					        - Invalid payload.
 | 
				
			||||||
        - Password and password confirmation don't match.
 | 
					        - Password and password confirmation don't match.
 | 
				
			||||||
    :statuscode 401: Provide a valid auth token.
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500: Error. Please try again or contact the administrator.
 | 
					    :statuscode 500: Error. Please try again or contact the administrator.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -489,7 +495,7 @@ def edit_picture(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      POST /auth/picture HTTP/1.1
 | 
					      POST /api/auth/picture HTTP/1.1
 | 
				
			||||||
      Content-Type: multipart/form-data
 | 
					      Content-Type: multipart/form-data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example response**:
 | 
					    **Example response**:
 | 
				
			||||||
@@ -531,7 +537,10 @@ def edit_picture(user_id):
 | 
				
			|||||||
        - No file part.
 | 
					        - No file part.
 | 
				
			||||||
        - No selected file.
 | 
					        - No selected file.
 | 
				
			||||||
        - File extension not allowed.
 | 
					        - File extension not allowed.
 | 
				
			||||||
    :statuscode 401: Provide a valid auth token.
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500: Error during picture update.
 | 
					    :statuscode 500: Error during picture update.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
@@ -592,7 +601,7 @@ def del_picture(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    .. sourcecode:: http
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      DELETE /auth/picture HTTP/1.1
 | 
					      DELETE /api/auth/picture HTTP/1.1
 | 
				
			||||||
      Content-Type: application/json
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    **Example response**:
 | 
					    **Example response**:
 | 
				
			||||||
@@ -605,7 +614,10 @@ def del_picture(user_id):
 | 
				
			|||||||
    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :statuscode 204: picture deleted
 | 
					    :statuscode 204: picture deleted
 | 
				
			||||||
    :statuscode 401: Provide a valid auth token.
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
    :statuscode 500: Error during picture deletion.
 | 
					    :statuscode 500: Error during picture deletion.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,13 +2,86 @@ from flask import Blueprint, jsonify, send_file
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
from ..activities.utils_files import get_absolute_file_path
 | 
					from ..activities.utils_files import get_absolute_file_path
 | 
				
			||||||
from .models import User
 | 
					from .models import User
 | 
				
			||||||
 | 
					from .utils import authenticate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
users_blueprint = Blueprint('users', __name__)
 | 
					users_blueprint = Blueprint('users', __name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@users_blueprint.route('/users', methods=['GET'])
 | 
					@users_blueprint.route('/users', methods=['GET'])
 | 
				
			||||||
def get_users():
 | 
					@authenticate
 | 
				
			||||||
    """Get all users"""
 | 
					def get_users(auth_user_id):
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    Get all users
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/users HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "users": [
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "admin": true,
 | 
				
			||||||
 | 
					              "bio": null,
 | 
				
			||||||
 | 
					              "birth_date": null,
 | 
				
			||||||
 | 
					              "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
 | 
				
			||||||
 | 
					              "email": "admin@example.com",
 | 
				
			||||||
 | 
					              "first_name": null,
 | 
				
			||||||
 | 
					              "id": 1,
 | 
				
			||||||
 | 
					              "last_name": null,
 | 
				
			||||||
 | 
					              "location": null,
 | 
				
			||||||
 | 
					              "nb_activities": 6,
 | 
				
			||||||
 | 
					              "nb_sports": 3,
 | 
				
			||||||
 | 
					              "picture": false,
 | 
				
			||||||
 | 
					              "timezone": "Europe/Paris",
 | 
				
			||||||
 | 
					              "total_distance": 67.895,
 | 
				
			||||||
 | 
					              "total_duration": "6:50:27",
 | 
				
			||||||
 | 
					              "username": "admin"
 | 
				
			||||||
 | 
					            },
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					              "admin": false,
 | 
				
			||||||
 | 
					              "bio": null,
 | 
				
			||||||
 | 
					              "birth_date": null,
 | 
				
			||||||
 | 
					              "created_at": "Sat, 20 Jul 2019 11:27:03 GMT",
 | 
				
			||||||
 | 
					              "email": "sam@example.com",
 | 
				
			||||||
 | 
					              "first_name": null,
 | 
				
			||||||
 | 
					              "id": 2,
 | 
				
			||||||
 | 
					              "last_name": null,
 | 
				
			||||||
 | 
					              "location": null,
 | 
				
			||||||
 | 
					              "nb_activities": 0,
 | 
				
			||||||
 | 
					              "nb_sports": 0,
 | 
				
			||||||
 | 
					              "picture": false,
 | 
				
			||||||
 | 
					              "timezone": "Europe/Paris",
 | 
				
			||||||
 | 
					              "total_distance": 0,
 | 
				
			||||||
 | 
					              "total_duration": "0:00:00",
 | 
				
			||||||
 | 
					              "username": "sam"
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          ]
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    users = User.query.all()
 | 
					    users = User.query.all()
 | 
				
			||||||
    response_object = {
 | 
					    response_object = {
 | 
				
			||||||
        'status': 'success',
 | 
					        'status': 'success',
 | 
				
			||||||
@@ -20,11 +93,64 @@ def get_users():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@users_blueprint.route('/users/<user_id>', methods=['GET'])
 | 
					@users_blueprint.route('/users/<user_id>', methods=['GET'])
 | 
				
			||||||
def get_single_user(user_id):
 | 
					@authenticate
 | 
				
			||||||
    """Get single user details"""
 | 
					def get_single_user(auth_user_id, user_id):
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    Get single user details
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/users/1 HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "data": {
 | 
				
			||||||
 | 
					          "admin": true,
 | 
				
			||||||
 | 
					          "bio": null,
 | 
				
			||||||
 | 
					          "birth_date": null,
 | 
				
			||||||
 | 
					          "created_at": "Sun, 14 Jul 2019 14:09:58 GMT",
 | 
				
			||||||
 | 
					          "email": "admin@example.com",
 | 
				
			||||||
 | 
					          "first_name": null,
 | 
				
			||||||
 | 
					          "id": 1,
 | 
				
			||||||
 | 
					          "last_name": null,
 | 
				
			||||||
 | 
					          "location": null,
 | 
				
			||||||
 | 
					          "nb_activities": 6,
 | 
				
			||||||
 | 
					          "nb_sports": 3,
 | 
				
			||||||
 | 
					          "picture": false,
 | 
				
			||||||
 | 
					          "timezone": "Europe/Paris",
 | 
				
			||||||
 | 
					          "total_distance": 67.895,
 | 
				
			||||||
 | 
					          "total_duration": "6:50:27",
 | 
				
			||||||
 | 
					          "username": "admin"
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					    :param integer user_id: user id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :reqheader Authorization: OAuth 2.0 Bearer Token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					    :statuscode 404:
 | 
				
			||||||
 | 
					        - User does not exist
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    response_object = {
 | 
					    response_object = {
 | 
				
			||||||
        'status': 'fail',
 | 
					        'status': 'fail',
 | 
				
			||||||
        'message': 'User does not exist'
 | 
					        'message': 'User does not exist.'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        user = User.query.filter_by(id=int(user_id)).first()
 | 
					        user = User.query.filter_by(id=int(user_id)).first()
 | 
				
			||||||
@@ -41,26 +167,83 @@ def get_single_user(user_id):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@users_blueprint.route('/users/<user_id>/picture', methods=['GET'])
 | 
					@users_blueprint.route('/users/<user_id>/picture', methods=['GET'])
 | 
				
			||||||
def get_picture(user_id):
 | 
					@authenticate
 | 
				
			||||||
    """ get user picture """
 | 
					def get_picture(auth_user_id, user_id):
 | 
				
			||||||
 | 
					    """ get user picture
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/users/1/picture HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: image/jpeg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param integer auth_user_id: authenticate user id (from JSON Web Token)
 | 
				
			||||||
 | 
					    :param integer user_id: user id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					    :statuscode 401:
 | 
				
			||||||
 | 
					        - Provide a valid auth token.
 | 
				
			||||||
 | 
					        - Signature expired. Please log in again.
 | 
				
			||||||
 | 
					        - Invalid token. Please log in again.
 | 
				
			||||||
 | 
					    :statuscode 404:
 | 
				
			||||||
 | 
					        - User does not exist
 | 
				
			||||||
 | 
					        - No picture.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    response_object = {
 | 
					    response_object = {
 | 
				
			||||||
        'status': 'fail',
 | 
					        'status': 'not found',
 | 
				
			||||||
        'message': 'User does not exist'
 | 
					        'message': 'No picture.'
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        user = User.query.filter_by(id=int(user_id)).first()
 | 
					        user = User.query.filter_by(id=int(user_id)).first()
 | 
				
			||||||
        if not user:
 | 
					        if not user:
 | 
				
			||||||
 | 
					            response_object = {
 | 
				
			||||||
 | 
					                'status': 'fail',
 | 
				
			||||||
 | 
					                'message': 'User does not exist.'
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            return jsonify(response_object), 404
 | 
					            return jsonify(response_object), 404
 | 
				
			||||||
        else:
 | 
					        if user.picture is not None:
 | 
				
			||||||
            picture_path = get_absolute_file_path(user.picture)
 | 
					            picture_path = get_absolute_file_path(user.picture)
 | 
				
			||||||
            return send_file(picture_path)
 | 
					            return send_file(picture_path)
 | 
				
			||||||
    except ValueError:
 | 
					        return jsonify(response_object), 404
 | 
				
			||||||
 | 
					    except Exception:
 | 
				
			||||||
        return jsonify(response_object), 404
 | 
					        return jsonify(response_object), 404
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@users_blueprint.route('/ping', methods=['GET'])
 | 
					@users_blueprint.route('/ping', methods=['GET'])
 | 
				
			||||||
def ping_pong():
 | 
					def ping_pong():
 | 
				
			||||||
    """ health check endpoint """
 | 
					    """ health check endpoint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example request**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      GET /api/ping HTTP/1.1
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    **Example response**:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. sourcecode:: http
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      HTTP/1.1 200 OK
 | 
				
			||||||
 | 
					      Content-Type: application/json
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        "message": "pong!",
 | 
				
			||||||
 | 
					        "status": "success"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :statuscode 200: success
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
    return jsonify({
 | 
					    return jsonify({
 | 
				
			||||||
        'status': 'success',
 | 
					        'status': 'success',
 | 
				
			||||||
        'message': 'pong!'
 | 
					        'message': 'pong!'
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user