update activities endpoints documentation
This commit is contained in:
parent
0701cd43da
commit
1247e2253a
@ -265,7 +265,7 @@
|
||||
</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> – no error</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.5.1">500 Internal Server Error</a> – </p></li>
|
||||
</ul>
|
||||
@ -281,7 +281,10 @@
|
||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">GET</span> <span class="nn">/api/activities/3</span> <span class="kr">HTTP</span><span class="o">/</span><span class="m">1.1</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><strong>Example response</strong>:</p>
|
||||
<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>
|
||||
|
||||
@ -323,6 +326,20 @@
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>acitivity 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>
|
||||
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"data"</span><span class="p">:</span> <span class="p">{</span>
|
||||
<span class="nt">"activities"</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">"not found"</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">
|
||||
@ -337,10 +354,10 @@
|
||||
</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> – No error</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.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>
|
||||
</dd>
|
||||
</dl>
|
||||
@ -561,7 +578,7 @@
|
||||
<li><p><strong>activity_date</strong> (<em>string</em>) – activity date (format: <code class="docutils literal notranslate"><span class="pre">%Y-%m-%d</span> <span class="pre">%H:%M</span></code>)</p></li>
|
||||
<li><p><strong>distance</strong> (<em>float</em>) – activity distance in km</p></li>
|
||||
<li><p><strong>duration</strong> (<em>integer</em>) – activity duration in seconds</p></li>
|
||||
<li><p><strong>notes</strong> (<em>string</em>) – notes</p></li>
|
||||
<li><p><strong>notes</strong> (<em>string</em>) – notes (not mandatory)</p></li>
|
||||
<li><p><strong>sport_id</strong> (<em>integer</em>) – activity sport id</p></li>
|
||||
<li><p><strong>title</strong> (<em>string</em>) – activity title</p></li>
|
||||
</ul>
|
||||
@ -586,24 +603,307 @@
|
||||
<dt id="patch--api-activities-(int-activity_id)">
|
||||
<code class="sig-name descname">PATCH </code><code class="sig-name descname">/api/activities/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">activity_id</em><span class="sig-paren">)</span><a class="headerlink" href="#patch--api-activities-(int-activity_id)" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Update an activity</p>
|
||||
<p><strong>Example request</strong>:</p>
|
||||
<div class="highlight-http notranslate"><div class="highlight"><pre><span></span><span class="nf">PATCH</span> <span class="nn">/api/activities/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">"activities"</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">"Mon, 01 Jan 2018 00:00:00 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"ascent"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"ave_speed"</span><span class="p">:</span> <span class="mf">10.0</span><span class="p">,</span>
|
||||
<span class="nt">"bounds"</span><span class="p">:</span> <span class="p">[],</span>
|
||||
<span class="nt">"creation_date"</span><span class="p">:</span> <span class="s2">"Sun, 14 Jul 2019 13:51:01 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"descent"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"distance"</span><span class="p">:</span> <span class="mf">10.0</span><span class="p">,</span>
|
||||
<span class="nt">"duration"</span><span class="p">:</span> <span class="s2">"0:17:04"</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">"map"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"max_alt"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"max_speed"</span><span class="p">:</span> <span class="mf">10.0</span><span class="p">,</span>
|
||||
<span class="nt">"min_alt"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"modification_date"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"moving"</span><span class="p">:</span> <span class="s2">"0:17:04"</span><span class="p">,</span>
|
||||
<span class="nt">"next_activity"</span><span class="p">:</span> <span class="mi">3</span><span class="p">,</span>
|
||||
<span class="nt">"notes"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"pauses"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"previous_activity"</span><span class="p">:</span> <span class="kc">null</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">"Mon, 01 Jan 2018 00:00:00 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">1</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">"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="mf">10.0</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Mon, 01 Jan 2018 00:00:00 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">1</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">"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">"0:17:04"</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Mon, 01 Jan 2018 00:00:00 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">1</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">"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="mf">10.0</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"activity_date"</span><span class="p">:</span> <span class="s2">"Mon, 01 Jan 2018 00:00:00 GMT"</span><span class="p">,</span>
|
||||
<span class="nt">"activity_id"</span><span class="p">:</span> <span class="mi">1</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">"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="mf">10.0</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">],</span>
|
||||
<span class="nt">"segments"</span><span class="p">:</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">"title"</span><span class="p">:</span> <span class="kc">null</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">"weather_end"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"weather_start"</span><span class="p">:</span> <span class="kc">null</span><span class="p">,</span>
|
||||
<span class="nt">"with_gpx"</span><span class="p">:</span> <span class="kc">false</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</p></li>
|
||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity id</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Request JSON Object</dt>
|
||||
<dd class="field-even"><ul class="simple">
|
||||
<li><p><strong>activity_date</strong> (<em>string</em>) – activity date (format: <code class="docutils literal notranslate"><span class="pre">%Y-%m-%d</span> <span class="pre">%H:%M</span></code>)
|
||||
(only for activity without gpx)</p></li>
|
||||
<li><p><strong>distance</strong> (<em>float</em>) – activity distance in km
|
||||
(only for activity without gpx)</p></li>
|
||||
<li><p><strong>duration</strong> (<em>integer</em>) – activity duration in seconds
|
||||
(only for activity without gpx)</p></li>
|
||||
<li><p><strong>notes</strong> (<em>string</em>) – notes</p></li>
|
||||
<li><p><strong>sport_id</strong> (<em>integer</em>) – activity sport id</p></li>
|
||||
<li><p><strong>title</strong> (<em>string</em>) – activity title</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> – 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.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.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>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="delete">
|
||||
<dt id="delete--api-activities-(int-activity_id)">
|
||||
<code class="sig-name descname">DELETE </code><code class="sig-name descname">/api/activities/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">activity_id</em><span class="sig-paren">)</span><a class="headerlink" href="#delete--api-activities-(int-activity_id)" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Delete an activity</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">/api/activities/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">204</span> <span class="ne">NO CONTENT</span>
|
||||
<span class="na">Content-Type</span><span class="o">:</span> <span class="l">application/json</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</p></li>
|
||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity 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.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.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>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="get">
|
||||
<dt id="get--api-activities-map-(map_id)">
|
||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/activities/map/</code><span class="sig-paren">(</span><em class="sig-param">map_id</em><span class="sig-paren">)</span><a class="headerlink" href="#get--api-activities-map-(map_id)" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get map image for activities with gpx</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/activities/map/fa33f4d996844a5c73ecd1ae24456ab8?1563529507772</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/png</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</p></li>
|
||||
<li><p><strong>map_id</strong> (<em>string</em>) – activity map 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> – invalid token</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>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="get">
|
||||
<dt id="get--api-activities-(int-activity_id)-gpx">
|
||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/activities/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">activity_id</em><span class="sig-paren">)</span><code class="sig-name descname">/gpx</code><a class="headerlink" href="#get--api-activities-(int-activity_id)-gpx" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get gpx file for an activity</p>
|
||||
<dd><p>Get gpx file for an activity displayed on map with Leaflet</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/activities/3/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>
|
||||
</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">"gpx"</span><span class="p">:</span> <span class="s2">"gpx file content"</span>
|
||||
<span class="p">},</span>
|
||||
<span class="nt">"message"</span><span class="p">:</span> <span class="s2">""</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</p></li>
|
||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity 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.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.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>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="get">
|
||||
<dt id="get--api-activities-(int-activity_id)-chart_data">
|
||||
<code class="sig-name descname">GET </code><code class="sig-name descname">/api/activities/</code><span class="sig-paren">(</span><em class="property">int: </em><em class="sig-param">activity_id</em><span class="sig-paren">)</span><code class="sig-name descname">/chart_data</code><a class="headerlink" href="#get--api-activities-(int-activity_id)-chart_data" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get chart data from an activity gpx file</p>
|
||||
<dd><p>Get chart data from an activity gpx file, to display it with Recharts</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/activities/3/chart</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">"chart_data"</span><span class="p">:</span> <span class="p">[</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"distance"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||||
<span class="nt">"duration"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||||
<span class="nt">"elevation"</span><span class="p">:</span> <span class="mf">279.4</span><span class="p">,</span>
|
||||
<span class="nt">"speed"</span><span class="p">:</span> <span class="mf">8.63</span><span class="p">,</span>
|
||||
<span class="nt">"time"</span><span class="p">:</span> <span class="s2">"Fri, 14 Jul 2017 13:44:03 GMT"</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nt">"distance"</span><span class="p">:</span> <span class="mf">7.5</span><span class="p">,</span>
|
||||
<span class="nt">"duration"</span><span class="p">:</span> <span class="mi">7380</span><span class="p">,</span>
|
||||
<span class="nt">"elevation"</span><span class="p">:</span> <span class="mi">280</span><span class="p">,</span>
|
||||
<span class="nt">"speed"</span><span class="p">:</span> <span class="mf">6.39</span><span class="p">,</span>
|
||||
<span class="nt">"time"</span><span class="p">:</span> <span class="s2">"Fri, 14 Jul 2017 15:47:03 GMT"</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">]</span>
|
||||
<span class="p">},</span>
|
||||
<span class="nt">"message"</span><span class="p">:</span> <span class="s2">""</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</p></li>
|
||||
<li><p><strong>activity_id</strong> (<em>integer</em>) – activity 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.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.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>
|
||||
</ul>
|
||||
</dd>
|
||||
</dl>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
|
@ -140,6 +140,11 @@
|
||||
<td>
|
||||
<a href="api/activities.html#get--api-activities-(int-activity_id)-gpx"><code class="xref">GET /api/activities/(int:activity_id)/gpx</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<a href="api/activities.html#get--api-activities-map-(map_id)"><code class="xref">GET /api/activities/map/(map_id)</code></a></td><td>
|
||||
<em></em></td></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
|
BIN
docs/objects.inv
BIN
docs/objects.inv
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -156,7 +156,7 @@ def get_activities(auth_user_id):
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: no error
|
||||
:statuscode 200: success
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 500:
|
||||
|
||||
@ -242,7 +242,9 @@ def get_activity(auth_user_id, activity_id):
|
||||
|
||||
GET /api/activities/3 HTTP/1.1
|
||||
|
||||
**Example response**:
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -286,15 +288,29 @@ def get_activity(auth_user_id, activity_id):
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- acitivity not found:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 404 NOT FOUND
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data": {
|
||||
"activities": []
|
||||
},
|
||||
"status": "not found"
|
||||
}
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param integer activity_id: activity id
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: No error
|
||||
:statuscode 200: success
|
||||
:statuscode 401: Provide a valid auth token
|
||||
:statuscode 403: You do not have permissions
|
||||
:statuscode 404: Activity not found
|
||||
:statuscode 404: activity not found
|
||||
|
||||
"""
|
||||
activity = Activity.query.filter_by(id=activity_id).first()
|
||||
@ -323,7 +339,7 @@ def get_activity(auth_user_id, activity_id):
|
||||
|
||||
|
||||
def get_activity_data(auth_user_id, activity_id, data_type):
|
||||
"""Get chart data from an activity gpx file"""
|
||||
"""Get data from an activity gpx file"""
|
||||
activity = Activity.query.filter_by(id=activity_id).first()
|
||||
content = ''
|
||||
if activity:
|
||||
@ -375,7 +391,43 @@ def get_activity_data(auth_user_id, activity_id, data_type):
|
||||
)
|
||||
@authenticate
|
||||
def get_activity_gpx(auth_user_id, activity_id):
|
||||
"""Get gpx file for an activity"""
|
||||
"""
|
||||
Get gpx file for an activity displayed on map with Leaflet
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/activities/3/gpx HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
**Example response**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data": {
|
||||
"gpx": "gpx file content"
|
||||
},
|
||||
"message": "",
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param integer activity_id: activity id
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400: no gpx file for this activity
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 404: activity not found
|
||||
:statuscode 500:
|
||||
|
||||
"""
|
||||
return get_activity_data(auth_user_id, activity_id, 'gpx')
|
||||
|
||||
|
||||
@ -384,12 +436,92 @@ def get_activity_gpx(auth_user_id, activity_id):
|
||||
)
|
||||
@authenticate
|
||||
def get_activity_chart_data(auth_user_id, activity_id):
|
||||
"""Get chart data from an activity gpx file"""
|
||||
"""
|
||||
Get chart data from an activity gpx file, to display it with Recharts
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/activities/3/chart HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
**Example response**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data": {
|
||||
"chart_data": [
|
||||
{
|
||||
"distance": 0,
|
||||
"duration": 0,
|
||||
"elevation": 279.4,
|
||||
"speed": 8.63,
|
||||
"time": "Fri, 14 Jul 2017 13:44:03 GMT"
|
||||
},
|
||||
{
|
||||
"distance": 7.5,
|
||||
"duration": 7380,
|
||||
"elevation": 280,
|
||||
"speed": 6.39,
|
||||
"time": "Fri, 14 Jul 2017 15:47:03 GMT"
|
||||
}
|
||||
]
|
||||
},
|
||||
"message": "",
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param integer activity_id: activity id
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400: no gpx file for this activity
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 404: activity not found
|
||||
:statuscode 500:
|
||||
|
||||
"""
|
||||
return get_activity_data(auth_user_id, activity_id, 'chart')
|
||||
|
||||
|
||||
@activities_blueprint.route('/activities/map/<map_id>', methods=['GET'])
|
||||
def get_map(map_id):
|
||||
"""
|
||||
Get map image for activities with gpx
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/activities/map/fa33f4d996844a5c73ecd1ae24456ab8?1563529507772
|
||||
HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
**Example response**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: image/png
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param string map_id: activity map id
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 404: map does not exist
|
||||
:statuscode 500:
|
||||
|
||||
"""
|
||||
try:
|
||||
activity = Activity.query.filter_by(map_id=map_id).first()
|
||||
if not activity:
|
||||
@ -674,7 +806,7 @@ def post_activity_no_gpx(auth_user_id):
|
||||
:<json string activity_date: activity date (format: ``%Y-%m-%d %H:%M``)
|
||||
:<json float distance: activity distance in km
|
||||
:<json integer duration: activity duration in seconds
|
||||
:<json string notes: notes
|
||||
:<json string notes: notes (not mandatory)
|
||||
:<json integer sport_id: activity sport id
|
||||
:<json string title: activity title
|
||||
|
||||
@ -724,7 +856,119 @@ def post_activity_no_gpx(auth_user_id):
|
||||
@activities_blueprint.route('/activities/<int:activity_id>', methods=['PATCH'])
|
||||
@authenticate
|
||||
def update_activity(auth_user_id, activity_id):
|
||||
"""Update an activity"""
|
||||
"""
|
||||
Update an activity
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
PATCH /api/activities/1 HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
**Example response**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data": {
|
||||
"activities": [
|
||||
{
|
||||
"activity_date": "Mon, 01 Jan 2018 00:00:00 GMT",
|
||||
"ascent": null,
|
||||
"ave_speed": 10.0,
|
||||
"bounds": [],
|
||||
"creation_date": "Sun, 14 Jul 2019 13:51:01 GMT",
|
||||
"descent": null,
|
||||
"distance": 10.0,
|
||||
"duration": "0:17:04",
|
||||
"id": 1,
|
||||
"map": null,
|
||||
"max_alt": null,
|
||||
"max_speed": 10.0,
|
||||
"min_alt": null,
|
||||
"modification_date": null,
|
||||
"moving": "0:17:04",
|
||||
"next_activity": 3,
|
||||
"notes": null,
|
||||
"pauses": null,
|
||||
"previous_activity": null,
|
||||
"records": [
|
||||
{
|
||||
"activity_date": "Mon, 01 Jan 2018 00:00:00 GMT",
|
||||
"activity_id": 1,
|
||||
"id": 4,
|
||||
"record_type": "MS",
|
||||
"sport_id": 1,
|
||||
"user_id": 1,
|
||||
"value": 10.0
|
||||
},
|
||||
{
|
||||
"activity_date": "Mon, 01 Jan 2018 00:00:00 GMT",
|
||||
"activity_id": 1,
|
||||
"id": 3,
|
||||
"record_type": "LD",
|
||||
"sport_id": 1,
|
||||
"user_id": 1,
|
||||
"value": "0:17:04"
|
||||
},
|
||||
{
|
||||
"activity_date": "Mon, 01 Jan 2018 00:00:00 GMT",
|
||||
"activity_id": 1,
|
||||
"id": 2,
|
||||
"record_type": "FD",
|
||||
"sport_id": 1,
|
||||
"user_id": 1,
|
||||
"value": 10.0
|
||||
},
|
||||
{
|
||||
"activity_date": "Mon, 01 Jan 2018 00:00:00 GMT",
|
||||
"activity_id": 1,
|
||||
"id": 1,
|
||||
"record_type": "AS",
|
||||
"sport_id": 1,
|
||||
"user_id": 1,
|
||||
"value": 10.0
|
||||
}
|
||||
],
|
||||
"segments": [],
|
||||
"sport_id": 1,
|
||||
"title": null,
|
||||
"user_id": 1,
|
||||
"weather_end": null,
|
||||
"weather_start": null,
|
||||
"with_gpx": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param integer activity_id: activity id
|
||||
|
||||
:<json string activity_date: activity date (format: ``%Y-%m-%d %H:%M``)
|
||||
(only for activity without gpx)
|
||||
:<json float distance: activity distance in km
|
||||
(only for activity without gpx)
|
||||
:<json integer duration: activity duration in seconds
|
||||
(only for activity without gpx)
|
||||
:<json string notes: notes
|
||||
:<json integer sport_id: activity sport id
|
||||
:<json string title: activity title
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: activity updated
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 404: activity not found
|
||||
:statuscode 500:
|
||||
|
||||
"""
|
||||
activity_data = request.get_json()
|
||||
if not activity_data:
|
||||
response_object = {
|
||||
@ -774,7 +1018,35 @@ def update_activity(auth_user_id, activity_id):
|
||||
)
|
||||
@authenticate
|
||||
def delete_activity(auth_user_id, activity_id):
|
||||
"""Delete an activity"""
|
||||
"""
|
||||
Delete an activity
|
||||
|
||||
**Example request**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
DELETE /api/activities/1 HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
**Example response**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
HTTP/1.1 204 NO CONTENT
|
||||
Content-Type: application/json
|
||||
|
||||
:param integer auth_user_id: authenticate user id
|
||||
:param integer activity_id: activity id
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 204: activity deleted
|
||||
:statuscode 401: invalid token
|
||||
:statuscode 404: activity not found
|
||||
:statuscode 500:
|
||||
|
||||
"""
|
||||
|
||||
try:
|
||||
activity = Activity.query.filter_by(id=activity_id).first()
|
||||
if activity:
|
||||
|
Loading…
Reference in New Issue
Block a user