2
0

usage.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. Wagtail API Usage Guide
  2. =======================
  3. Listing views
  4. -------------
  5. Performing a ``GET`` request against one of the endpoints will get you a listing of objects in that endpoint. The response will look something like this:
  6. .. code-block:: text
  7. GET /api/v1/endpoint_name/
  8. HTTP 200 OK
  9. Content-Type: application/json
  10. {
  11. "meta": {
  12. "total_count": "total number of results"
  13. },
  14. "endpoint_name": [
  15. {
  16. "id": 1,
  17. "meta": {
  18. "type": "app_name.ModelName",
  19. "detail_url": "http://api.example.com/api/v1/endpoint_name/1/"
  20. },
  21. "field": "value"
  22. },
  23. {
  24. "id": 2,
  25. "meta": {
  26. "type": "app_name.ModelName",
  27. "detail_url": "http://api.example.com/api/v1/endpoint_name/2/"
  28. },
  29. "field": "different value"
  30. }
  31. ]
  32. }
  33. This is the basic structure of all of the listing views. They all have a ``meta`` section with a ``total_count`` variable and a listing of things.
  34. Detail views
  35. ------------
  36. All of the endpoints also contain a "detail" view which returns information on an individual object. This view is always accessed by appending the id of the object to the URL.
  37. The ``pages`` endpoint
  38. ----------------------
  39. This endpoint includes all live pages in your site that have not been put in a private section.
  40. The listing view (``/api/v1/pages/``)
  41. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  42. This is what a typical response from a ``GET`` request to this listing would look like:
  43. .. code-block:: text
  44. GET /api/v1/pages/
  45. HTTP 200 OK
  46. Content-Type: application/json
  47. {
  48. "meta": {
  49. "total_count": 2
  50. },
  51. "pages": [
  52. {
  53. "id": 2,
  54. "meta": {
  55. "type": "demo.HomePage",
  56. "detail_url": "http://api.example.com/api/v1/pages/2/"
  57. },
  58. "title": "Homepage"
  59. },
  60. {
  61. "id": 3,
  62. "meta": {
  63. "type": "demo.BlogIndexPage",
  64. "detail_url": "http://api.example.com/api/v1/pages/3/"
  65. },
  66. "title": "Blog"
  67. }
  68. ]
  69. }
  70. Each page object contains the ``id``, a ``meta`` section and the fields with their values.
  71. ``meta``
  72. ^^^^^^^^
  73. This section is used to hold "metadata" fields which aren't fields in the database. Wagtail API adds two by default:
  74. - ``type`` - The app label/model name of the object
  75. - ``detail_url`` - A URL linking to the detail view for this object
  76. Selecting a page type
  77. ^^^^^^^^^^^^^^^^^^^^^
  78. Most Wagtail sites are made up of multiple different types of page that each have their own specific fields. In order to view/filter/order on fields specific to one page type, you must select that page type using the ``type`` query parameter.
  79. The ``type`` query parameter must be set to the Pages model name in the format: ``app_label.ModelName``.
  80. .. code-block:: text
  81. GET /api/v1/pages/?type=demo.BlogPage
  82. HTTP 200 OK
  83. Content-Type: application/json
  84. {
  85. "meta": {
  86. "total_count": 3
  87. },
  88. "pages": [
  89. {
  90. "id": 4,
  91. "meta": {
  92. "type": "demo.BlogPage",
  93. "detail_url": "http://api.example.com/api/v1/pages/4/"
  94. },
  95. "title": "My blog 1"
  96. },
  97. {
  98. "id": 5,
  99. "meta": {
  100. "type": "demo.BlogPage",
  101. "detail_url": "http://api.example.com/api/v1/pages/5/"
  102. },
  103. "title": "My blog 2"
  104. },
  105. {
  106. "id": 6,
  107. "meta": {
  108. "type": "demo.BlogPage",
  109. "detail_url": "http://api.example.com/api/v1/pages/6/"
  110. },
  111. "title": "My blog 3"
  112. }
  113. ]
  114. }
  115. Specifying a list of fields to return
  116. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  117. As you can see, we still only get the ``title`` field, even though we have selected a type. That's because listing pages require you to explicitly tell it what extra fields you would like to see. You can do this with the ``fields`` query parameter.
  118. Just set ``fields`` to a command-separated list of field names that you would like to use.
  119. .. code-block:: text
  120. GET /api/v1/pages/?type=demo.BlogPage&fields=title,date_posted,feed_image
  121. HTTP 200 OK
  122. Content-Type: application/json
  123. {
  124. "meta": {
  125. "total_count": 3
  126. },
  127. "pages": [
  128. {
  129. "id": 4,
  130. "meta": {
  131. "type": "demo.BlogPage",
  132. "detail_url": "http://api.example.com/api/v1/pages/4/"
  133. },
  134. "title": "My blog 1",
  135. "date_posted": "2015-01-23",
  136. "feed_image": {
  137. "id": 1,
  138. "meta": {
  139. "type": "wagtailimages.Image",
  140. "detail_url": "http://api.example.com/api/v1/images/1/"
  141. }
  142. }
  143. },
  144. {
  145. "id": 5,
  146. "meta": {
  147. "type": "demo.BlogPage",
  148. "detail_url": "http://api.example.com/api/v1/pages/5/"
  149. },
  150. "title": "My blog 2",
  151. "date_posted": "2015-01-24",
  152. "feed_image": {
  153. "id": 2,
  154. "meta": {
  155. "type": "wagtailimages.Image",
  156. "detail_url": "http://api.example.com/api/v1/images/2/"
  157. }
  158. }
  159. },
  160. {
  161. "id": 6,
  162. "meta": {
  163. "type": "demo.BlogPage",
  164. "detail_url": "http://api.example.com/api/v1/pages/6/"
  165. },
  166. "title": "My blog 3",
  167. "date_posted": "2015-01-25",
  168. "feed_image": {
  169. "id": 3,
  170. "meta": {
  171. "type": "wagtailimages.Image",
  172. "detail_url": "http://api.example.com/api/v1/images/3/"
  173. }
  174. }
  175. }
  176. ]
  177. }
  178. We now have enough information to make a basic blog listing with a feed image and date that the blog was posted.
  179. Filtering on fields
  180. ^^^^^^^^^^^^^^^^^^^
  181. Exact matches on field values can be done by using a query parameter with the same name as the field. Any pages with the field that exactly matches the value of this parameter will be returned.
  182. .. code-block:: text
  183. GET /api/v1/pages/?type=demo.BlogPage&fields=title,date_posted&date_posted=2015-01-24
  184. HTTP 200 OK
  185. Content-Type: application/json
  186. {
  187. "meta": {
  188. "total_count": 1
  189. },
  190. "pages": [
  191. {
  192. "id": 5,
  193. "meta": {
  194. "type": "demo.BlogPage",
  195. "detail_url": "http://api.example.com/api/v1/pages/5/"
  196. },
  197. "title": "My blog 2",
  198. "date_posted": "2015-01-24",
  199. }
  200. ]
  201. }
  202. Filtering by section of the tree
  203. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  204. It is also possible to filter the listing to only include pages with a particular parent or ancestor. This is useful if you have multiple blogs on your site and only want to view the contents of one of them.
  205. **child_of**
  206. Filters the listing to only include direct children of the specified page.
  207. For example, to get all the pages that are direct children of page 7.
  208. .. code-block:: text
  209. GET /api/v1/pages/?child_of=7
  210. HTTP 200 OK
  211. Content-Type: application/json
  212. {
  213. "meta": {
  214. "total_count": 1
  215. },
  216. "pages": [
  217. {
  218. "id": 4,
  219. "meta": {
  220. "type": "demo.BlogPage",
  221. "detail_url": "http://api.example.com/api/v1/pages/4/"
  222. },
  223. "title": "Other blog 1"
  224. }
  225. ]
  226. }
  227. **descendant_of**
  228. Filters the listing to only include descendants of the specified page.
  229. For example, to get all pages underneath the homepage:
  230. .. code-block:: text
  231. GET /api/v1/pages/?descendant_of=2
  232. HTTP 200 OK
  233. Content-Type: application/json
  234. {
  235. "meta": {
  236. "total_count": 1
  237. },
  238. "pages": [
  239. {
  240. "id": 3,
  241. "meta": {
  242. "type": "demo.BlogIndexPage",
  243. "detail_url": "http://api.example.com/api/v1/pages/3/"
  244. },
  245. "title": "Blog"
  246. },
  247. {
  248. "id": 4,
  249. "meta": {
  250. "type": "demo.BlogPage",
  251. "detail_url": "http://api.example.com/api/v1/pages/4/"
  252. },
  253. "title": "My blog 1",
  254. },
  255. {
  256. "id": 5,
  257. "meta": {
  258. "type": "demo.BlogPage",
  259. "detail_url": "http://api.example.com/api/v1/pages/5/"
  260. },
  261. "title": "My blog 2",
  262. },
  263. {
  264. "id": 6,
  265. "meta": {
  266. "type": "demo.BlogPage",
  267. "detail_url": "http://api.example.com/api/v1/pages/6/"
  268. },
  269. "title": "My blog 3",
  270. }
  271. ]
  272. }
  273. Ordering
  274. ^^^^^^^^
  275. Like filtering, it is also possible to order on database fields. The endpoint accepts a query parameter called ``order`` which should be set to the field name to order by. Field names can be prefixed with a ``-`` to reverse the ordering. It is also possible to order randomly by setting this parameter to ``random``.
  276. .. code-block:: text
  277. GET /api/v1/pages/?type=demo.BlogPage&fields=title,date_posted,feed_image&order=-date_posted
  278. HTTP 200 OK
  279. Content-Type: application/json
  280. {
  281. "meta": {
  282. "total_count": 3
  283. },
  284. "pages": [
  285. {
  286. "id": 6,
  287. "meta": {
  288. "type": "demo.BlogPage",
  289. "detail_url": "http://api.example.com/api/v1/pages/6/"
  290. },
  291. "title": "My blog 3",
  292. "date_posted": "2015-01-25",
  293. "feed_image": {
  294. "id": 3,
  295. "meta": {
  296. "type": "wagtailimages.Image",
  297. "detail_url": "http://api.example.com/api/v1/images/3/"
  298. }
  299. }
  300. },
  301. {
  302. "id": 5,
  303. "meta": {
  304. "type": "demo.BlogPage",
  305. "detail_url": "http://api.example.com/api/v1/pages/5/"
  306. },
  307. "title": "My blog 2",
  308. "date_posted": "2015-01-24",
  309. "feed_image": {
  310. "id": 2,
  311. "meta": {
  312. "type": "wagtailimages.Image",
  313. "detail_url": "http://api.example.com/api/v1/images/2/"
  314. }
  315. }
  316. },
  317. {
  318. "id": 4,
  319. "meta": {
  320. "type": "demo.BlogPage",
  321. "detail_url": "http://api.example.com/api/v1/pages/4/"
  322. },
  323. "title": "My blog 1",
  324. "date_posted": "2015-01-23",
  325. "feed_image": {
  326. "id": 1,
  327. "meta": {
  328. "type": "wagtailimages.Image",
  329. "detail_url": "http://api.example.com/api/v1/images/1/"
  330. }
  331. }
  332. }
  333. ]
  334. }
  335. Pagination
  336. ^^^^^^^^^^
  337. Pagination is done using two query parameters called ``limit`` and ``offset``. ``limit`` sets the number of results to return and ``offset`` is the index of the first result to return. The default and maximum value for ``limit`` is ``20``. The maximum value can be changed using the ``WAGTAILAPI_LIMIT_MAX`` setting.
  338. .. code-block:: text
  339. GET /api/v1/pages/?limit=1&offset=1
  340. HTTP 200 OK
  341. Content-Type: application/json
  342. {
  343. "meta": {
  344. "total_count": 2
  345. },
  346. "pages": [
  347. {
  348. "id": 3,
  349. "meta": {
  350. "type": "demo.BlogIndexPage",
  351. "detail_url": "http://api.example.com/api/v1/pages/3/"
  352. },
  353. "title": "Blog"
  354. }
  355. ]
  356. }
  357. Pagination will not change the ``total_count`` value in the meta.
  358. Searching
  359. ^^^^^^^^^
  360. To perform a full-text search, set the ``search`` parameter to the query string you would like to search on.
  361. .. code-block:: text
  362. GET /api/v1/pages/?search=Blog
  363. HTTP 200 OK
  364. Content-Type: application/json
  365. {
  366. "meta": {
  367. "total_count": 3
  368. },
  369. "pages": [
  370. {
  371. "id": 3,
  372. "meta": {
  373. "type": "demo.BlogIndexPage",
  374. "detail_url": "http://api.example.com/api/v1/pages/3/"
  375. },
  376. "title": "Blog"
  377. },
  378. {
  379. "id": 4,
  380. "meta": {
  381. "type": "demo.BlogPage",
  382. "detail_url": "http://api.example.com/api/v1/pages/4/"
  383. },
  384. "title": "My blog 1",
  385. },
  386. {
  387. "id": 5,
  388. "meta": {
  389. "type": "demo.BlogPage",
  390. "detail_url": "http://api.example.com/api/v1/pages/5/"
  391. },
  392. "title": "My blog 2",
  393. },
  394. {
  395. "id": 6,
  396. "meta": {
  397. "type": "demo.BlogPage",
  398. "detail_url": "http://api.example.com/api/v1/pages/6/"
  399. },
  400. "title": "My blog 3",
  401. }
  402. ]
  403. }
  404. The results are ordered by relevance. It is not possible to use the ``order`` parameter with a search query.
  405. If your Wagtail site is using Elasticsearch, you do not need to select a type to access specific fields. This will search anything that's defined in the models' ``search_fields``.
  406. The detail view (``/api/v1/pages/{id}/``)
  407. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  408. This view gives you access to all of the details for a particular page.
  409. .. code-block:: text
  410. GET /api/v1/pages/6/
  411. HTTP 200 OK
  412. Content-Type: application/json
  413. {
  414. "id": 6,
  415. "meta": {
  416. "type": "demo.BlogPage",
  417. "detail_url": "http://api.example.com/api/v1/pages/6/"
  418. },
  419. "parent": {
  420. "id": 3,
  421. "meta": {
  422. "type": "demo.BlogIndexPage",
  423. "detail_url": "http://api.example.com/api/v1/pages/3/"
  424. }
  425. },
  426. "title": "My blog 3",
  427. "date_posted": "2015-01-25",
  428. "feed_image": {
  429. "id": 3,
  430. "meta": {
  431. "type": "wagtailimages.Image",
  432. "detail_url": "http://api.example.com/api/v1/images/3/"
  433. }
  434. },
  435. "related_links": [
  436. {
  437. "title": "Other blog page",
  438. "page": {
  439. "id": 5,
  440. "meta": {
  441. "type": "demo.BlogPage",
  442. "detail_url": "http://api.example.com/api/v1/pages/5/"
  443. }
  444. }
  445. }
  446. ]
  447. }
  448. The format is the same as that which is returned inside the listing view, with two additions:
  449. - All of the available fields are added to the detail page by default
  450. - A ``parent`` field has been included that contains information about the parent page
  451. The ``images`` endpoint
  452. -----------------------
  453. This endpoint gives access to all uploaded images. This will use the custom image model if one was specified. Otherwise, it falls back to ``wagtailimages.Image``.
  454. The listing view (``/api/v1/images/``)
  455. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  456. This is what a typical response from a ``GET`` request to this listing would look like:
  457. .. code-block:: text
  458. GET /api/v1/images/
  459. HTTP 200 OK
  460. Content-Type: application/json
  461. {
  462. "meta": {
  463. "total_count": 3
  464. },
  465. "images": [
  466. {
  467. "id": 4,
  468. "meta": {
  469. "type": "wagtailimages.Image",
  470. "detail_url": "http://api.example.com/api/v1/images/4/"
  471. },
  472. "title": "Wagtail by Mark Harkin"
  473. },
  474. {
  475. "id": 5,
  476. "meta": {
  477. "type": "wagtailimages.Image",
  478. "detail_url": "http://api.example.com/api/v1/images/5/"
  479. },
  480. "title": "James Joyce"
  481. },
  482. {
  483. "id": 6,
  484. "meta": {
  485. "type": "wagtailimages.Image",
  486. "detail_url": "http://api.example.com/api/v1/images/6/"
  487. },
  488. "title": "David Mitchell"
  489. }
  490. ]
  491. }
  492. Each image object contains the ``id`` and ``title`` of the image.
  493. Getting ``width``, ``height`` and other fields
  494. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  495. Like the pages endpoint, the images endpoint supports the ``fields`` query parameter.
  496. By default, this will allow you to add the ``width`` and ``height`` fields to your results. If your Wagtail site uses a custom image model, it is possible to have more.
  497. .. code-block:: text
  498. GET /api/v1/images/?fields=title,width,height
  499. HTTP 200 OK
  500. Content-Type: application/json
  501. {
  502. "meta": {
  503. "total_count": 3
  504. },
  505. "images": [
  506. {
  507. "id": 4,
  508. "meta": {
  509. "type": "wagtailimages.Image",
  510. "detail_url": "http://api.example.com/api/v1/images/4/"
  511. },
  512. "title": "Wagtail by Mark Harkin",
  513. "width": 640,
  514. "height": 427
  515. },
  516. {
  517. "id": 5,
  518. "meta": {
  519. "type": "wagtailimages.Image",
  520. "detail_url": "http://api.example.com/api/v1/images/5/"
  521. },
  522. "title": "James Joyce",
  523. "width": 500,
  524. "height": 392
  525. },
  526. {
  527. "id": 6,
  528. "meta": {
  529. "type": "wagtailimages.Image",
  530. "detail_url": "http://api.example.com/api/v1/images/6/"
  531. },
  532. "title": "David Mitchell",
  533. "width": 360,
  534. "height": 282
  535. }
  536. ]
  537. }
  538. Filtering on fields
  539. ^^^^^^^^^^^^^^^^^^^
  540. Exact matches on field values can be done by using a query parameter with the same name as the field. Any images with the field that exactly matches the value of this parameter will be returned.
  541. .. code-block:: text
  542. GET /api/v1/pages/?title=James Joyce
  543. HTTP 200 OK
  544. Content-Type: application/json
  545. {
  546. "meta": {
  547. "total_count": 3
  548. },
  549. "images": [
  550. {
  551. "id": 5,
  552. "meta": {
  553. "type": "wagtailimages.Image",
  554. "detail_url": "http://api.example.com/api/v1/images/5/"
  555. },
  556. "title": "James Joyce"
  557. }
  558. ]
  559. }
  560. Ordering
  561. ^^^^^^^^
  562. The images endpoint also accepts the ``order`` parameter which should be set to a field name to order by. Field names can be prefixed with a ``-`` to reverse the ordering. It is also possible to order randomly by setting this parameter to ``random``.
  563. .. code-block:: text
  564. GET /api/v1/images/?fields=title,width&order=width
  565. HTTP 200 OK
  566. Content-Type: application/json
  567. {
  568. "meta": {
  569. "total_count": 3
  570. },
  571. "images": [
  572. {
  573. "id": 6,
  574. "meta": {
  575. "type": "wagtailimages.Image",
  576. "detail_url": "http://api.example.com/api/v1/images/6/"
  577. },
  578. "title": "David Mitchell",
  579. "width": 360
  580. },
  581. {
  582. "id": 5,
  583. "meta": {
  584. "type": "wagtailimages.Image",
  585. "detail_url": "http://api.example.com/api/v1/images/5/"
  586. },
  587. "title": "James Joyce",
  588. "width": 500
  589. },
  590. {
  591. "id": 4,
  592. "meta": {
  593. "type": "wagtailimages.Image",
  594. "detail_url": "http://api.example.com/api/v1/images/4/"
  595. },
  596. "title": "Wagtail by Mark Harkin",
  597. "width": 640
  598. }
  599. ]
  600. }
  601. Pagination
  602. ^^^^^^^^^^
  603. Pagination is done using two query parameters called ``limit`` and ``offset``. ``limit`` sets the number of results to return and ``offset`` is the index of the first result to return. The default and maximum value for ``limit`` is ``20``. The maximum value can be changed using the ``WAGTAILAPI_LIMIT_MAX`` setting.
  604. .. code-block:: text
  605. GET /api/v1/images/?limit=1&offset=1
  606. HTTP 200 OK
  607. Content-Type: application/json
  608. {
  609. "meta": {
  610. "total_count": 3
  611. },
  612. "images": [
  613. {
  614. "id": 5,
  615. "meta": {
  616. "type": "wagtailimages.Image",
  617. "detail_url": "http://api.example.com/api/v1/images/5/"
  618. },
  619. "title": "James Joyce",
  620. "width": 500,
  621. "height": 392
  622. }
  623. ]
  624. }
  625. Pagination will not change the ``total_count`` value in the meta.
  626. Searching
  627. ^^^^^^^^^
  628. To perform a full-text search, set the ``search`` parameter to the query string you would like to search on.
  629. .. code-block:: text
  630. GET /api/v1/images/?search=James
  631. HTTP 200 OK
  632. Content-Type: application/json
  633. {
  634. "meta": {
  635. "total_count": 1
  636. },
  637. "pages": [
  638. {
  639. "id": 5,
  640. "meta": {
  641. "type": "wagtailimages.Image",
  642. "detail_url": "http://api.example.com/api/v1/images/5/"
  643. },
  644. "title": "James Joyce",
  645. "width": 500,
  646. "height": 392
  647. }
  648. ]
  649. }
  650. Like the pages endpoint, the results are ordered by relevance and it is not possible to use the ``order`` parameter with a search query.
  651. The detail view (``/api/v1/images/{id}/``)
  652. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  653. This view gives you access to all of the details for a particular image.
  654. .. code-block:: text
  655. GET /api/v1/images/5/
  656. HTTP 200 OK
  657. Content-Type: application/json
  658. {
  659. "id": 5,
  660. "meta": {
  661. "type": "wagtailimages.Image",
  662. "detail_url": "http://api.example.com/api/v1/images/5/"
  663. },
  664. "title": "James Joyce",
  665. "width": 500,
  666. "height": 392
  667. }
  668. The ``documents`` endpoint
  669. --------------------------
  670. This endpoint gives access to all uploaded documents.
  671. The listing view (``/api/v1/documents/``)
  672. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  673. The documents listing supports the same features as the images listing (documented above) but works with Documents instead.
  674. The detail view (``/api/v1/documents/{id}/``)
  675. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  676. This view gives you access to all of the details for a particular document.
  677. .. code-block:: text
  678. GET /api/v1/documents/1/
  679. HTTP 200 OK
  680. Content-Type: application/json
  681. {
  682. "id": 1,
  683. "meta": {
  684. "type": "wagtaildocs.Document",
  685. "detail_url": "http://api.example.com/api/v1/documents/1/",
  686. "download_url": "http://api.example.com/documents/1/usage.md"
  687. },
  688. "title": "Wagtail API usage"
  689. }