Mercurial > p > roundup > code
comparison doc/rest.txt @ 5929:0368d75de544
issue2551067 corrections/cleanup.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 17 Oct 2019 20:27:19 -0400 |
| parents | fa661043fc5b |
| children | cc6891ea1f01 |
comparison
equal
deleted
inserted
replaced
| 5928:fa661043fc5b | 5929:0368d75de544 |
|---|---|
| 622 ... | 622 ... |
| 623 | 623 |
| 624 Lines are wrapped for display, content value is one really long | 624 Lines are wrapped for display, content value is one really long |
| 625 line. If the data is not utf-8 compatible, you will get a link. | 625 line. If the data is not utf-8 compatible, you will get a link. |
| 626 | 626 |
| 627 Retrieving the contents of a file is slightly different. Performing a | 627 Retrieving the contents of a file is similar. Performing a |
| 628 get on a file returns:: | 628 get on ``https://.../demo/rest/data/file/11`` returns:: |
| 629 | 629 |
| 630 { | 630 { |
| 631 "data": { | 631 "data": { |
| 632 "id": "11", | 632 "id": "11", |
| 633 "type": "file", | 633 "type": "file", |
| 646 }, | 646 }, |
| 647 "@etag": "\"74276f75ef71a30a0cce62dc6a8aa1bb\"" | 647 "@etag": "\"74276f75ef71a30a0cce62dc6a8aa1bb\"" |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 | 650 |
| 651 To get the file contents in binary form, you currently have to go | 651 To download the file contents for this example you would |
| 652 outside of the rest interface. You can use the name and content link | 652 perform an http GET using: ``https://.../demo/file11/``. The trailing |
| 653 to download the binary data stream. Perform a get on: the link value | 653 / is required. You will receive a response of type |
| 654 with the name appended. So for this example you would get: | |
| 655 ``https://.../demo/file11/afile``. You will receive a response of type | |
| 656 application/octet-stream. | 654 application/octet-stream. |
| 657 | 655 |
| 658 using ``@verbose=3`` the content is displayed as (wrapped for display):: | 656 If you perform a get on |
| 657 ``https://.../demo/rest/data/file/11?@verbose=3`` the content field | |
| 658 above is displayed as (wrapped for display):: | |
| 659 | 659 |
| 660 "content": "file11 is not text, retrieve using binary_content | 660 "content": "file11 is not text, retrieve using binary_content |
| 661 property. mdsum: bd990c0f8833dd991daf610b81b62316", | 661 property. mdsum: bd990c0f8833dd991daf610b81b62316", |
| 662 | 662 |
| 663 | 663 |
| 664 You can then use the `binary_content property`_ described below to | 664 You can use the `binary_content property`_ described below to |
| 665 retrieve an encoded copy of the data. | 665 retrieve an encoded copy of the data. |
| 666 | 666 |
| 667 Other query params | 667 Other query params |
| 668 ^^^^^^^^^^^^^^^^^^ | 668 ^^^^^^^^^^^^^^^^^^ |
| 669 | 669 |
| 1168 { | 1168 { |
| 1169 "data": { | 1169 "data": { |
| 1170 "id": "11", | 1170 "id": "11", |
| 1171 "type": "<class 'bytes'>", | 1171 "type": "<class 'bytes'>", |
| 1172 "link": "https://.../demo/rest/data/file/11/binary_content", | 1172 "link": "https://.../demo/rest/data/file/11/binary_content", |
| 1173 "data": "b'\\x00\\x00\\x01\\x00\\x01...\xec?\\x00\\x00'", | 1173 "data": "b'\\x00\\x00\\x01\\x00\\x01...\\xec?\\x00\\x00'", |
| 1174 "@etag": "\"74276f75ef71a30a0cce62dc6a8aa1bb\"" | 1174 "@etag": "\"74276f75ef71a30a0cce62dc6a8aa1bb\"" |
| 1175 } | 1175 } |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 (data field elided for display). You can also receive the file content | 1178 (data field elided for display). You can also receive the file content |
| 1179 as a data stream rather than encoded. See `Getting Message and Files | 1179 as a data stream rather than encoded. See `Getting Message and Files |
| 1180 Content`_. | 1180 Content`_. |
| 1181 | |
| 1182 The data is a json encoded hexidecimal representation of the data. | |
| 1181 | 1183 |
| 1182 | 1184 |
| 1183 Other Supported Methods for fields | 1185 Other Supported Methods for fields |
| 1184 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | 1186 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 1185 | 1187 |
