@@ -1257,6 +1257,7 @@ with a REST API supporting JSON encoding::
12571257 >>> import requests
12581258 >>> u = 'http://user:
[email protected] /demo/rest/data/'
12591259 >>> s = requests.session()
1260+ >>> session.auth = ('admin', 'admin')
12601261 >>> r = s.get(u + 'issue/42/title')
12611262 >>> if r.status_code != 200:
12621263 ... print("Failed: %s: %s" % (r.status_code, r.reason))
@@ -1293,6 +1294,37 @@ allows the request to pass the CSRF protection mechanism. You may need
12931294to add an Origin header if this check is enabled in your tracker's
12941295config.ini (look for csrf_enforce_header_origin).
12951296
1297+ A similar curl based retire example is to use:
1298+
1299+ curl -s -u admin:admin \
1300+ -H "Referer: https://tracker.example.com/demo/" \
1301+ -H "X-requested-with: rest" \
1302+ -H "Content-Type: application/json" \
1303+ https://tracker.example.com/demo/rest/data/status/1
1304+
1305+ to get the etag manually. Then insert the etag in the If-Match header
1306+ for this retire example::
1307+
1308+ curl -s -u admin:admin \
1309+ -H "Referer: https://tracker.example.com/demo/" \
1310+ -H "X-requested-with: rest" \
1311+ -H "Content-Type: application/json" \
1312+ -H 'If-Match: "a502faf4d6b8e3897c4ecd66b5597571"' \
1313+ --data-raw '{ "@op":"action", "@action_name": "retire" }'\
1314+ -X PATCH \
1315+ https://tracker.example.com/demo/rest/data/status/1
1316+
1317+ and restore::
1318+
1319+ curl -s -u admin:admin \
1320+ -H "Referer: https://tracker.example.com/demo/" \
1321+ -H "X-requested-with: rest" \
1322+ -H "Content-Type: application/json" \
1323+ -H 'If-Match: "a502faf4d6b8e3897c4ecd66b5597571"' \
1324+ --data-raw '{ "@op":"action", "@action_name": "restore" }'\
1325+ -X PATCH \
1326+ https://tracker.example.com/demo/rest/data/status/1
1327+
12961328
12971329Searches and selection
12981330======================
0 commit comments