Skip to content

Commit 2d54a04

Browse files
committed
I think headings are consistant now.
1 parent ae387f9 commit 2d54a04

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

doc/rest.txt

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ REST API for Roundup
1616
:depth: 3
1717

1818
Introduction
19-
------------
19+
============
2020

2121
After the last 1.6.0 Release, a REST-API developed in 2015 during a
2222
Google Summer of Code (GSOC) by Chau Nguyen, supervised by Ezio
@@ -26,7 +26,7 @@ functions for a single page web application, e.g. etag support,
2626
pagination, field embedding among others.
2727

2828
Enabling the REST API
29-
---------------------
29+
=====================
3030

3131
The REST API can be disabled in the ``[web]`` section of ``config.ini``
3232
via the variable ``enable_rest`` which is ``yes`` by default.
@@ -66,7 +66,7 @@ explicitly set.)
6666
.. _upgrading directions: upgrading.html
6767

6868
Preventing CSRF Attacks
69-
=======================
69+
-----------------------
7070

7171
Clients should set the header X-REQUESTED-WITH to any value and the
7272
tracker's config.ini should have ``csrf_enforce_header_x-requested-with
@@ -78,7 +78,7 @@ the origin using the ``allowed_api_origins`` setting in
7878
``config.ini``.
7979

8080
Rate Limiting the API
81-
=====================
81+
---------------------
8282

8383
This is a work in progress. This version of roundup includes Rate
8484
Limiting for the API (which is different from rate limiting login
@@ -114,15 +114,15 @@ possible for it to miscount allowing more than burst count. Errors of
114114
up to 10% have been seen on slower hardware.
115115

116116
Client API
117-
----------
117+
==========
118118

119119
The top-level REST url ``/rest/`` will display the current version of
120120
the REST API (Version 1 as of this writing) and some links to relevant
121121
endpoints of the API. In the following the ``/rest`` prefix is omitted
122122
from relative REST-API links for brevity.
123123

124124
Headers
125-
=======
125+
-------
126126

127127
If rate limiting is enabled there are 3 "standard" headers:
128128

@@ -153,7 +153,7 @@ If the client has requested a deprecated API endpoint, the header:
153153
the sunset link type.
154154

155155
Hyperdb Stats
156-
=============
156+
-------------
157157

158158
Adding ``@stats=true`` as a GET query parameter or POST data item will
159159
augment the response with an ``@stats`` dictionary. Any value other
@@ -180,7 +180,7 @@ understanding of the code is recommended if you are going to use this
180180
info.
181181

182182
Versioning
183-
==========
183+
----------
184184

185185
Currently there is only one version of the API. Versions are simple
186186
integers. The current version is ``1``. Version selection is
@@ -199,7 +199,7 @@ The server default is reported by querying the ``/rest/`` endpoint as
199199
described above.
200200

201201
Input Formats
202-
=============
202+
-------------
203203

204204
For a GET or OPTIONS request, the Content-Type header should
205205
not be sent.
@@ -209,7 +209,7 @@ Otherwise Content-Type is allowed to be ``application/json`` or
209209
code 415.
210210

211211
CORS preflight requests
212-
^^^^^^^^^^^^^^^^^^^^^^^
212+
~~~~~~~~~~~~~~~~~~~~~~~
213213

214214
CORS preflight requests are done using the OPTIONS method. They
215215
require that REST be enabled. These requests do not make any changes
@@ -263,7 +263,7 @@ cause a problem. If it is an issue, you can see
263263
and craft a rate limiter that ignores anonymous OPTIONS requests.
264264

265265
Response Formats
266-
================
266+
----------------
267267

268268
The default response format is json.
269269

@@ -300,7 +300,7 @@ the accept header are available or if the accept header is invalid.
300300

301301

302302
General Guidelines
303-
==================
303+
------------------
304304

305305
Performing a ``GET`` on an item or property of an item will return an
306306
ETag header or an @etag property. This needs to be submitted with
@@ -405,21 +405,21 @@ properties). Example::
405405

406406

407407
Special Endpoints
408-
=================
408+
-----------------
409409

410410
There are a few special endpoints that provide some additional data.
411411
Tracker administrators can add new endpoints. See
412412
"Programming the REST API"_ below.
413413

414414
/summary
415-
^^^^^^^^
415+
~~~~~~~~
416416

417417
A Summary page can be reached via ``/summary`` via the ``GET`` method.
418418
This is currently hard-coded for the standard tracker schema shipped
419419
with roundup and will display a summary of open issues.
420420

421421
/data
422-
^^^^^
422+
~~~~~
423423

424424
This is the primary entry point for data from the tracker.
425425

@@ -439,7 +439,7 @@ dictionary with the entry ``data`` referring to the returned data.
439439
Details are in the sections below.
440440

441441
/data/\ *class* Collection
442-
==========================
442+
--------------------------
443443

444444
When performing the ``GET`` method on a class (e.g. ``/data/issue``),
445445
the ``data`` object includes the number of items available in
@@ -474,7 +474,7 @@ decorations in the response. See the section on pagination below for
474474
details.
475475

476476
Searching
477-
^^^^^^^^^
477+
~~~~~~~~~
478478

479479
Searching is done by adding roundup field names and values as query
480480
parameters. Using: https://.../rest/data/issue you can search using:
@@ -549,7 +549,7 @@ body of a msg) is a work in progress.
549549
.. _URL Encoding: https://en.wikipedia.org/wiki/Percent-encoding
550550

551551
Transitive Searching
552-
~~~~~~~~~~~~~~~~~~~~
552+
^^^^^^^^^^^^^^^^^^^^
553553

554554
In addition to searching an issue by its properties, you can search
555555
for issues where linked items have a certain property. For example
@@ -572,7 +572,7 @@ it. However they may be able to use searches to discover the value of
572572
the field even if they can't view it.
573573

574574
Sorting
575-
^^^^^^^
575+
~~~~~~~
576576

577577
Collection endpoints support sorting. This is controlled by specifying a
578578
``@sort`` parameter with a list of properties of the searched class.
@@ -586,7 +586,7 @@ and then by id of an issue::
586586

587587

588588
Pagination
589-
^^^^^^^^^^
589+
~~~~~~~~~~
590590

591591
Collection endpoints support pagination. This is controlled by query
592592
parameters ``@page_size`` and ``@page_index`` (Note the use of the
@@ -645,7 +645,7 @@ clients must be prepared to handle the incomplete response and request
645645
the next URL to retrieve all of the entries.
646646

647647
Field embedding and verbose output
648-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
648+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
649649

650650
In collections, you can specify what fields should be embedded in the
651651
returned data. There are some shortcuts provided using the
@@ -738,7 +738,7 @@ See the `Searches and selection`_ section for the use cases supported
738738
by these features.
739739

740740
Getting Message and Files Content
741-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
741+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
742742

743743
You can retreive a message with a url like
744744
``https://.../demo/rest/data/msg/11``. This returns something like::
@@ -850,7 +850,7 @@ You can use the `binary_content property`_ described below to
850850
retrieve an encoded copy of the data.
851851

852852
Other query params
853-
^^^^^^^^^^^^^^^^^^
853+
~~~~~~~~~~~~~~~~~~
854854

855855
This table lists other supported parameters:
856856

@@ -869,7 +869,7 @@ This table lists other supported parameters:
869869
this time.
870870

871871
Using the POST method
872-
^^^^^^^^^^^^^^^^^^^^^
872+
~~~~~~~~~~~~~~~~~~~~~
873873

874874
Only class links support the ``POST`` method for creation of new items
875875
of a class, e.g., a new issue via the ``/data/issue`` link. The post
@@ -992,15 +992,15 @@ mechanism.
992992
response was lost.
993993

994994
Other Supported Methods for Collections
995-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
995+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
996996

997997
Supports the ``OPTIONS`` method for determining which methods are
998998
allowed on a given endpoint.
999999

10001000
Does not support PUT, DELETE or PATCH.
10011001

10021002
/data/\ *class*/\ *id* item
1003-
===========================
1003+
---------------------------
10041004

10051005
When performing the ``GET`` method on an item
10061006
(e.g. ``/data/issue/42``), a ``link`` attribute contains the link to
@@ -1083,7 +1083,7 @@ An example of returned values::
10831083
}
10841084

10851085
Retrieve item using key value
1086-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1086+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10871087

10881088
If the class has a key attribute, e.g. the 'status' class in the
10891089
classic tracker, it can be used to retrieve the item.
@@ -1103,7 +1103,7 @@ The long-form (with ``=``) is different from a query-parameter like
11031103
that have ``closed`` as a substring.
11041104

11051105
Dealing with Messages and Files
1106-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1106+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11071107

11081108
Using the requests library you can upload a file using::
11091109

@@ -1147,7 +1147,7 @@ return something like::
11471147

11481148

11491149
Other Supported Methods for Items
1150-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1150+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11511151

11521152
The method ``PUT`` is allowed on individual items, e.g.
11531153
``/data/issue/42`` On success it returns the same parameters as the
@@ -1302,7 +1302,7 @@ payload. When modifying a property via ``PUT`` or ``PATCH`` or
13021302
``If-Match`` header.
13031303

13041304
/data/\ *class*/\ *id*/\ *property* field
1305-
=========================================
1305+
-----------------------------------------
13061306

13071307
A ``GET`` method on a property (e.g. ``/data/issue/42/title``) returns the
13081308
link, an ``@etag``, the type of the property (e.g. "<type str>") the id
@@ -1325,7 +1325,7 @@ All endpoints support an ``OPTIONS`` method for determining which
13251325
methods are allowed on a given endpoint.
13261326

13271327
Message and File Content
1328-
^^^^^^^^^^^^^^^^^^^^^^^^
1328+
~~~~~~~~~~~~~~~~~~~~~~~~
13291329

13301330
Messages and files have content properties. If the data is utf-8
13311331
compatible (e.g. an email message) you can retrieve it with
@@ -1369,7 +1369,7 @@ The data is a json encoded hexidecimal representation of the data.
13691369

13701370

13711371
Other Supported Methods for fields
1372-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1372+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13731373

13741374
The method ``PUT`` is allowed on a property e.g.,
13751375
``/data/issue/42/title``. On success it returns the same parameters as
@@ -1421,7 +1421,7 @@ payload. When modifying a property via ``PUT`` or ``PATCH`` or
14211421
``If-Match`` header.
14221422

14231423
Tunneling Methods via POST
1424-
==========================
1424+
--------------------------
14251425

14261426
If you are working through a proxy and unable to use http methods like
14271427
PUT, PATCH, or DELETE, you can use POST to perform the action. To tunnel
@@ -1431,10 +1431,10 @@ POST should be what you would send if you were using the method
14311431
without tunneling.
14321432

14331433
Examples and Use Cases
1434-
----------------------
1434+
======================
14351435

14361436
sample python client
1437-
====================
1437+
--------------------
14381438

14391439
The client uses the python ``requests`` library for easier interaction
14401440
with a REST API supporting JSON encoding::
@@ -1516,7 +1516,7 @@ and restore::
15161516

15171517

15181518
Searches and selection
1519-
======================
1519+
----------------------
15201520

15211521
One difficult interface issue is selection of items from a long list.
15221522
Using multi-item selects requires loading a lot of data (e.g. consider
@@ -1611,14 +1611,14 @@ fields can be used for subsearch and sorting.
16111611

16121612

16131613
Programming the REST API
1614-
------------------------
1614+
========================
16151615

16161616
You can extend the rest api for a tracker. This describes how to add
16171617
new rest end points. At some point it will also describe the rest.py
16181618
structure and implementation.
16191619

16201620
Adding new rest endpoints
1621-
=========================
1621+
-------------------------
16221622

16231623
Add or edit the file `interfaces.py`_ at the root of the tracker
16241624
directory.
@@ -1692,7 +1692,7 @@ Adding other endpoints (e.g. to allow an OPTIONS query against
16921692
``/data/issue/@schema``) is left as an exercise for the reader.
16931693

16941694
Redefine/move rest endpoints
1695-
============================
1695+
----------------------------
16961696

16971697
In addition to adding new endpoints, you can redefine existing
16981698
endpoints. Adding this as described above::
@@ -1734,7 +1734,7 @@ normally at /rest/data/<class>.
17341734

17351735

17361736
Controlling Access to Backend Data
1737-
==================================
1737+
----------------------------------
17381738

17391739
Roundup's schema is the primary access control mechanism. Roles and
17401740
Permissions provide the ability to carefully control what data can be
@@ -1846,7 +1846,7 @@ the url passes the ``roles=User`` filter option which is silently
18461846
ignored.
18471847

18481848
Changing Access Roles with JSON Web Tokens
1849-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1849+
------------------------------------------
18501850

18511851
As discussed above Roundup's schema is the access control mechanism.
18521852
However you may want to integrate a third party system with roundup.
@@ -2110,7 +2110,7 @@ for ideas or add your own.
21102110
.. _thoughts on JWT credentials: https://issues.roundup-tracker.org/issue2551064
21112111

21122112
Final steps
2113-
^^^^^^^^^^^
2113+
~~~~~~~~~~~
21142114

21152115
See the `upgrading directions`_ on how to use the ``updateconfig``
21162116
command to generate an updated copy of config.ini using
@@ -2133,7 +2133,7 @@ subscribing and for archives of the lists.
21332133

21342134

21352135
Creating Custom Rate Limits
2136-
===========================
2136+
---------------------------
21372137

21382138
You can replace the default rate limiter that is configured using
21392139
the tracker's ``config.ini``. You can return different rate
@@ -2177,7 +2177,7 @@ and period that are specific to a user. If either is set to 0,
21772177
the defaults from ``config.ini`` file are used.
21782178

21792179
Test Examples
2180-
^^^^^^^^^^^^^
2180+
~~~~~~~~~~~~~
21812181

21822182
Rate limit tests::
21832183

0 commit comments

Comments
 (0)