Mercurial > p > roundup > code
comparison doc/rest.txt @ 5863:e0df29c18be8
Merge changes
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Mon, 26 Aug 2019 08:13:46 +0200 |
| parents | a0eaae3f638b d5aed7106ee6 |
| children | 04deafac71ab |
comparison
equal
deleted
inserted
replaced
| 5862:a0eaae3f638b | 5863:e0df29c18be8 |
|---|---|
| 140 well as a ``collections`` list of objects:: | 140 well as a ``collections`` list of objects:: |
| 141 | 141 |
| 142 { "data": { | 142 { "data": { |
| 143 "meta data field1": "value", | 143 "meta data field1": "value", |
| 144 "meta data field2": "value", | 144 "meta data field2": "value", |
| 145 "collecton": [ | 145 "collection": [ |
| 146 { "link": "url to item", | 146 { "link": "url to item", |
| 147 "id": "internal identifier for item" }, | 147 "id": "internal identifier for item" }, |
| 148 { "link": "url to second item", | 148 { "link": "url to second item", |
| 149 "id": "id item 2" }, | 149 "id": "id item 2" }, |
| 150 ... ] | 150 ... ] |
| 157 "relation2": [ {...} ], ... | 157 "relation2": [ {...} ], ... |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 available meta data is described in the documention for the | 162 available meta data is described in the documentation for the |
| 163 collections endpoint. | 163 collections endpoint. |
| 164 | 164 |
| 165 The ``link`` fields implement HATEOS by supplying a url for the | 165 The ``link`` fields implement HATEOS by supplying a url for the |
| 166 resource represented by that object. The "link" parameter with the | 166 resource represented by that object. The "link" parameter with the |
| 167 value of a url is a special case of the @links parameter. | 167 value of a url is a special case of the @links parameter. |
| 187 the issue. Example:: | 187 the issue. Example:: |
| 188 | 188 |
| 189 { "data": { | 189 { "data": { |
| 190 "meta data field1": "value", | 190 "meta data field1": "value", |
| 191 "type": "type of item, issue, user ..." | 191 "type": "type of item, issue, user ..." |
| 192 "link": "link to retreive item", | 192 "link": "link to retrieve item", |
| 193 "attributes": { | 193 "attributes": { |
| 194 "title": "title of issue", | 194 "title": "title of issue", |
| 195 "nosy": [ | 195 "nosy": [ |
| 196 { "link": "url for user4", | 196 { "link": "url for user4", |
| 197 "id": "4" } | 197 "id": "4" } |
| 202 } | 202 } |
| 203 | 203 |
| 204 Using a property endpoint (e.g. title or nosy list for an issue) the | 204 Using a property endpoint (e.g. title or nosy list for an issue) the |
| 205 ``data`` wrapper has a ``data`` subfield that represents the value of | 205 ``data`` wrapper has a ``data`` subfield that represents the value of |
| 206 the property. This ``data`` subfield may be a simple string (all types | 206 the property. This ``data`` subfield may be a simple string (all types |
| 207 except mutlilink) or a list of strings (multilink | 207 except multilink) or a list of strings (multilink |
| 208 properties). Example:: | 208 properties). Example:: |
| 209 | 209 |
| 210 { "data": { | 210 { "data": { |
| 211 "type": "description of class", | 211 "type": "description of class", |
| 212 "@etag": "\"f15e6942f00a41960de45f9413684591\"", | 212 "@etag": "\"f15e6942f00a41960de45f9413684591\"", |
| 213 "link": "link to retreive property", | 213 "link": "link to retrieve property", |
| 214 "id": "id for object with this property", | 214 "id": "id for object with this property", |
| 215 "data": "value of property" | 215 "data": "value of property" |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 336 ``https://.../rest/data/keyword?name=foo`` (note searching keyword | 336 ``https://.../rest/data/keyword?name=foo`` (note searching keyword |
| 337 class not issue class) will return matches for ``foo``, ``foobar``, | 337 class not issue class) will return matches for ``foo``, ``foobar``, |
| 338 ``foo taz`` etc. | 338 ``foo taz`` etc. |
| 339 | 339 |
| 340 In all cases the field ``@total_size`` is reported which is the total | 340 In all cases the field ``@total_size`` is reported which is the total |
| 341 number of items available if you were to retreive all of them. | 341 number of items available if you were to retrieve all of them. |
| 342 | 342 |
| 343 Other data types: Date, Interval Integer, Number need examples and may | 343 Other data types: Date, Interval Integer, Number need examples and may |
| 344 need work to allow range searches. Full text search (e.g. over the | 344 need work to allow range searches. Full text search (e.g. over the |
| 345 body of msgs) is a work in progress. | 345 body of msgs) is a work in progress. |
| 346 | 346 |
| 362 ``@page_size`` is specified, all matching items are returned. | 362 ``@page_size`` is specified, all matching items are returned. |
| 363 * - ``@page_index`` | 363 * - ``@page_index`` |
| 364 - (which defaults to 1 if not given) specifies which page number | 364 - (which defaults to 1 if not given) specifies which page number |
| 365 of ``@page_size`` items is displayed. | 365 of ``@page_size`` items is displayed. |
| 366 | 366 |
| 367 Also when pagenation is enabled the returned data include pagenation | 367 Also when pagination is enabled the returned data include pagination |
| 368 links along side the collection data. This looks like:: | 368 links along side the collection data. This looks like:: |
| 369 | 369 |
| 370 { "data": | 370 { "data": |
| 371 { | 371 { |
| 372 "collection": { ... }, | 372 "collection": { ... }, |
| 413 | 413 |
| 414 * - Query parameter | 414 * - Query parameter |
| 415 - Explanation | 415 - Explanation |
| 416 * - ``@verbose=0`` | 416 * - ``@verbose=0`` |
| 417 - each item in the collection has its "id" property displayed | 417 - each item in the collection has its "id" property displayed |
| 418 and a link with the URL to retreive the item. | 418 and a link with the URL to retrieve the item. |
| 419 * - ``@verbose=1`` | 419 * - ``@verbose=1`` |
| 420 - for collections this output is the same as ``@verbose=0``. This | 420 - for collections this output is the same as ``@verbose=0``. This |
| 421 is the default. | 421 is the default. |
| 422 * - ``@verbose=2`` | 422 * - ``@verbose=2`` |
| 423 - each item in the collection includes the "label" property in | 423 - each item in the collection includes the "label" property in |
| 482 Note that the ``link`` field that is returned doesn't exist in the | 482 Note that the ``link`` field that is returned doesn't exist in the |
| 483 database. It is a construct of the rest interface. This means that you | 483 database. It is a construct of the rest interface. This means that you |
| 484 can not set ``@fields=link`` and get the link property included in the | 484 can not set ``@fields=link`` and get the link property included in the |
| 485 output. | 485 output. |
| 486 | 486 |
| 487 Also using ``@fields=@etag`` will not work to retreive the etag for | 487 Also using ``@fields=@etag`` will not work to retrieve the etag for |
| 488 items in the collection. | 488 items in the collection. |
| 489 | 489 |
| 490 See the `Searches and selection`_ section for the use cases supported | 490 See the `Searches and selection`_ section for the use cases supported |
| 491 by these features. | 491 by these features. |
| 492 | 492 |
| 660 the fields you are interested in reducing network load as well as | 660 the fields you are interested in reducing network load as well as |
| 661 memory and parsing time on the client side. By default protected | 661 memory and parsing time on the client side. By default protected |
| 662 properties (read only in the database) are not listed. Th | 662 properties (read only in the database) are not listed. Th |
| 663 is makes it easier to submit the attributes from a | 663 is makes it easier to submit the attributes from a |
| 664 ``@verbose=0`` query using PUT. To include protected properties | 664 ``@verbose=0`` query using PUT. To include protected properties |
| 665 in the output og a GET add the query parameter | 665 in the output of a GET add the query parameter |
| 666 ``@protected=true`` to the query and attributes like: actor, | 666 ``@protected=true`` to the query and attributes like: actor, |
| 667 created, creator and activity will be include in the result. | 667 created, creator and activity will be include in the result. |
| 668 | 668 |
| 669 Link and Multilink properties are displayed as a dictionary with a | 669 Link and Multilink properties are displayed as a dictionary with a |
| 670 ``link`` and an ``id`` property by default. This is controlled by the | 670 ``link`` and an ``id`` property by default. This is controlled by the |
| 959 The ``PATCH`` method can be applied to properties, e.g., | 959 The ``PATCH`` method can be applied to properties, e.g., |
| 960 ``/data/issue/42/title``. This method gets an operator | 960 ``/data/issue/42/title``. This method gets an operator |
| 961 ``@op=<method>`` where ``<method>`` is one of ``add``, ``replace``, | 961 ``@op=<method>`` where ``<method>`` is one of ``add``, ``replace``, |
| 962 ``remove``. If no operator is specified, the default is ``replace`` | 962 ``remove``. If no operator is specified, the default is ``replace`` |
| 963 which is the same as performing a PUT on the field url. ``add`` and | 963 which is the same as performing a PUT on the field url. ``add`` and |
| 964 ``remove`` allow ading and removing values from MultiLink | 964 ``remove`` allow adding and removing values from MultiLink |
| 965 properties. This is easier than having to rewrite the entire value for | 965 properties. This is easier than having to rewrite the entire value for |
| 966 the field using the ``replace`` operator or doing a PUT to the field. | 966 the field using the ``replace`` operator or doing a PUT to the field. |
| 967 On success the returned value is the same as the respective ``GET`` | 967 On success the returned value is the same as the respective ``GET`` |
| 968 method. | 968 method. |
| 969 | 969 |
| 978 Tunneling Methods via POST | 978 Tunneling Methods via POST |
| 979 ========================== | 979 ========================== |
| 980 | 980 |
| 981 If you are working through a proxy and unable to use http method like | 981 If you are working through a proxy and unable to use http method like |
| 982 PUT, PATCH or DELETE you can use POST to perform the action. To tunnel | 982 PUT, PATCH or DELETE you can use POST to perform the action. To tunnel |
| 983 an action throught POST, send the ``X-HTTP-METHOD-OVERRIDE`` header | 983 an action through POST, send the ``X-HTTP-METHOD-OVERRIDE`` header |
| 984 with a value of DELETE or other capitalized HTTP verb. The body of the | 984 with a value of DELETE or other capitalized HTTP verb. The body of the |
| 985 POST should be what you would send if you were using the method | 985 POST should be what you would send if you were using the method |
| 986 without tunneling. | 986 without tunneling. |
| 987 | 987 |
| 988 Examples and Use Cases | 988 Examples and Use Cases |
