REST endpoints » History » Version 2
Luke Murphey, 03/04/2021 06:18 PM
| 1 | 1 | Luke Murphey | h1. REST endpoints |
|---|---|---|---|
| 2 | 1 | Luke Murphey | |
| 3 | 2 | Luke Murphey | The lookup Editor includes custom REST endpoints for editing lookup files. You can see examples of these endpoints being used here: https://github.com/LukeMurphey/lookup-editor/blob/master/src/appserver/static/js/views/LookupEditView.js |
| 4 | 1 | Luke Murphey | |
| 5 | 1 | Luke Murphey | h2. Reading and Writing Lookup Contents |
| 6 | 1 | Luke Murphey | |
| 7 | 1 | Luke Murphey | *URL:* /splunkd/__raw/services/data/lookup_edit/lookup_contents |
| 8 | 1 | Luke Murphey | *Parameters:* |
| 9 | 1 | Luke Murphey | * lookup_file: the name of the lookup file |
| 10 | 1 | Luke Murphey | * namespace: the app where the lookup is stored |
| 11 | 1 | Luke Murphey | * owner: the user name who owns the lookup in case you want to load a lookup that exists only for a particular user |
| 12 | 1 | Luke Murphey | * header_only: Only return the header row (defaults to false, return the entire lookup) |
| 13 | 1 | Luke Murphey | * version: the ID of the older version in case you want an older revision of the lookup (defaults to empty indicating that you want the latest version) |
| 14 | 1 | Luke Murphey | * lookup_type: the type of the lookup file (either "kv" or "csv") |
| 15 | 1 | Luke Murphey | |
| 16 | 1 | Luke Murphey | The endpoint at /splunkd/__raw/services/data/lookup_edit/lookup_contents is used for editing and loading the contents of lookup files. A "GET" will retrieve the lookup and a "POST" will modify it. See https://github.com/LukeMurphey/lookup-editor/blob/master/src/bin/lookup_editor_rest_handler.py |
| 17 | 1 | Luke Murphey | |
| 18 | 1 | Luke Murphey | This endpoint will return HTTP/420 if the lookup is larger than 10 MB. |
| 19 | 1 | Luke Murphey | |
| 20 | 1 | Luke Murphey | h2. Downloading a Lookup as a File |
| 21 | 1 | Luke Murphey | |
| 22 | 1 | Luke Murphey | *URL:* /splunkd/__raw/services/data/lookup_edit/lookup_as_file |
| 23 | 1 | Luke Murphey | *Parameters:* |
| 24 | 1 | Luke Murphey | * lookup_file: the name of the lookup file |
| 25 | 1 | Luke Murphey | * namespace: the app where the lookup is stored |
| 26 | 1 | Luke Murphey | * owner: the user name who owns the lookup in case you want to load a lookup that exists only for a particular user |
| 27 | 1 | Luke Murphey | * header_only: Only return the header row (defaults to false, return the entire lookup) |
| 28 | 1 | Luke Murphey | * version: the ID of the older version in case you want an older revision of the lookup (defaults to empty indicating that you want the latest version) |
| 29 | 1 | Luke Murphey | * lookup_type: the type of the lookup file (either "kv" or "csv") |
| 30 | 1 | Luke Murphey | |
| 31 | 1 | Luke Murphey | The endpoint at /splunkd/__raw/services/data/lookup_edit/lookup_as_file is to download the lookup as a file by including the headers that will cause a browser to download the file. |