Mercurial > p > roundup > code
comparison doc/rest.txt @ 6765:b4bfbd768bc1
How to add dicttoxml at system or tracker level.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 10 Jul 2022 21:22:58 -0400 |
| parents | 32f52d14b496 |
| children | e7b4ad2c57ac |
comparison
equal
deleted
inserted
replaced
| 6764:32f52d14b496 | 6765:b4bfbd768bc1 |
|---|---|
| 256 The default response format is json. | 256 The default response format is json. |
| 257 | 257 |
| 258 If you add the ``dicttoxml.py`` module you can request XML formatted | 258 If you add the ``dicttoxml.py`` module you can request XML formatted |
| 259 data using the header ``Accept: application/xml`` in your | 259 data using the header ``Accept: application/xml`` in your |
| 260 request. Both output formats are similar in structure. | 260 request. Both output formats are similar in structure. |
| 261 | |
| 262 ``dicttoxml.py`` should be installed in the Python install directory, | |
| 263 or the file can be added to the Roundup installation directory long | |
| 264 ide ``rest.py``. It can also be enabled on a per tracker basis by | |
| 265 adding ``dicttoxml.py`` to the lib directory in your tracker home (you | |
| 266 may need to create the directory). Then this can be added to | |
| 267 `interfaces.py`_ to enable xml:: | |
| 268 | |
| 269 from roundup import rest | |
| 270 from dicttoxml import dicttoxml as dtox # from tracker_root/lib directory | |
| 271 | |
| 272 rest.dicttoxml = dtox | |
| 273 | |
| 274 .. _interfaces.py: customizing.html#interfaces-py-hooking-into-the-core-of-roundup | |
| 261 | 275 |
| 262 The rest interface accepts the http accept header and can include | 276 The rest interface accepts the http accept header and can include |
| 263 ``q`` values to specify the preferred mechanism. This is the preferred | 277 ``q`` values to specify the preferred mechanism. This is the preferred |
| 264 way to specify alternate acceptable response formats. | 278 way to specify alternate acceptable response formats. |
| 265 | 279 |
| 1592 structure and implementation. | 1606 structure and implementation. |
| 1593 | 1607 |
| 1594 Adding new rest endpoints | 1608 Adding new rest endpoints |
| 1595 ========================= | 1609 ========================= |
| 1596 | 1610 |
| 1597 Add or edit the file interfaces.py at the root of the tracker | 1611 Add or edit the file `interfaces.py`_ at the root of the tracker |
| 1598 directory. | 1612 directory. |
| 1599 | 1613 |
| 1600 In that file add:: | 1614 In that file add:: |
| 1601 | 1615 |
| 1602 from roundup.rest import Routing, RestfulInstance, _data_decorator | 1616 from roundup.rest import Routing, RestfulInstance, _data_decorator |
| 2152 Test Examples | 2166 Test Examples |
| 2153 ^^^^^^^^^^^^^ | 2167 ^^^^^^^^^^^^^ |
| 2154 | 2168 |
| 2155 Rate limit tests:: | 2169 Rate limit tests:: |
| 2156 | 2170 |
| 2157 seq 1 300 | xargs -P 20 -n 1 curl --head -si \ | 2171 seq 1 300 | xargs -P 20 -n 1 curl --head -u user:password -si \ |
| 2158 https://.../rest/data/status/new \# | grep Remaining | 2172 https://.../rest/data/status/new | grep Remaining |
| 2173 | |
| 2174 will show you the number of remaining requests to the REST interface | |
| 2175 for the user identified by password. |
