changeset 5933:0bac8b9a0ecc

Added curl based examples for retire and restore.
author John Rouillard <rouilj@ieee.org>
date Sat, 19 Oct 2019 09:02:22 -0400
parents df279b4e34a5
children db9bd45d50ad
files doc/rest.txt
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/rest.txt	Sat Oct 19 07:45:36 2019 -0400
+++ b/doc/rest.txt	Sat Oct 19 09:02:22 2019 -0400
@@ -1257,6 +1257,7 @@
         >>> import requests
         >>> u = 'http://user:password@tracker.example.com/demo/rest/data/'
         >>> s = requests.session()
+	>>> session.auth = ('admin', 'admin')
         >>> r = s.get(u + 'issue/42/title')
         >>> if r.status_code != 200:
         ...     print("Failed: %s: %s" % (r.status_code, r.reason))
@@ -1293,6 +1294,37 @@
 to add an Origin header if this check is enabled in your tracker's
 config.ini (look for csrf_enforce_header_origin).
 
+A similar curl based retire example is to use:
+
+       curl -s -u admin:admin \
+        -H "Referer: https://tracker.example.com/demo/" \
+	-H "X-requested-with: rest"  \
+	-H "Content-Type: application/json" \
+	https://tracker.example.com/demo/rest/data/status/1
+
+to get the etag manually. Then insert the etag in the If-Match header
+for this retire example::
+
+     curl -s -u admin:admin \
+        -H "Referer: https://tracker.example.com/demo/" \
+	-H "X-requested-with: rest"  \
+	-H "Content-Type: application/json" \
+	-H 'If-Match: "a502faf4d6b8e3897c4ecd66b5597571"' \
+	--data-raw '{ "@op":"action", "@action_name": "retire" }'\
+	-X PATCH \
+	https://tracker.example.com/demo/rest/data/status/1
+
+and restore::
+
+     curl -s -u admin:admin \
+        -H "Referer: https://tracker.example.com/demo/" \
+	-H "X-requested-with: rest"  \
+	-H "Content-Type: application/json" \
+	-H 'If-Match: "a502faf4d6b8e3897c4ecd66b5597571"' \
+	--data-raw '{ "@op":"action", "@action_name": "restore" }'\
+	-X PATCH \
+	https://tracker.example.com/demo/rest/data/status/1
+
 
 Searches and selection
 ======================

Roundup Issue Tracker: http://roundup-tracker.org/