|
| 1 | +NAME |
| 2 | + cdata - https://instructure.com/canvas |
| 3 | + |
| 4 | +SYNOPSIS |
| 5 | + cdata [options] method |
| 6 | + |
| 7 | +DESCRIPTION |
| 8 | + canvas-data-cli is a secure curl wrapper designed to simplify interacting |
| 9 | + with the canvas data JSON/REST API. |
| 10 | + |
| 11 | + canvas-data-cli automatically authenticates users based on credentials stored |
| 12 | + in the config file or on values passed at runtime. |
| 13 | + |
| 14 | +OPTIONS |
| 15 | + Options start with a single dash and many options require |
| 16 | + a value after them. |
| 17 | + |
| 18 | + All of the options are optional, however, some require |
| 19 | + that other options be set as well for example |
| 20 | + -d <domain> also requires -t <token> and vice versa. |
| 21 | + |
| 22 | + All options must be included before the API method. |
| 23 | + |
| 24 | + -a |
| 25 | + This option retrieves dumps only after the specified |
| 26 | + sequence number. |
| 27 | + |
| 28 | + -c |
| 29 | + This option runs the canvas data configuration and stores the |
| 30 | + key, and secret in the preference file located at ~/.inst |
| 31 | + |
| 32 | + If no preference file is detected on first run, the |
| 33 | + configuration process will automatically run. This option |
| 34 | + is mainly for adding canvas if other Instructure APIs have |
| 35 | + already been used, such as studio or canvas. |
| 36 | + |
| 37 | + cdata config stores the following values in ~/.inst: |
| 38 | + data_secret="<secret>" |
| 39 | + data_key="<key>" |
| 40 | + |
| 41 | + -d |
| 42 | + Download referenced dumps in the response. |
| 43 | + |
| 44 | + -d also requires that -o <path> be included in the query. |
| 45 | + |
| 46 | + -h |
| 47 | + Usage help. This lists all the available options with |
| 48 | + descriptions and examples. |
| 49 | + |
| 50 | + -k |
| 51 | + This option allows you to pass a canvas data key instead of |
| 52 | + using one stored in the config file. |
| 53 | + |
| 54 | + -k also requires that -m <secret> be included in the query. |
| 55 | + cdata will not allow you to pass one authentication parameter |
| 56 | + and read the others from config. |
| 57 | + |
| 58 | + -l |
| 59 | + License information. |
| 60 | + |
| 61 | + -m |
| 62 | + This option allows you to pass a canvas data secret instead of |
| 63 | + using one stored in the config file. |
| 64 | + |
| 65 | + -m also requires that -k <key> be included in the query. |
| 66 | + cdata will not allow you to pass one authentication parameter |
| 67 | + and read the others from config. |
| 68 | + |
| 69 | + -o <path> |
| 70 | + This option outputs the return to a specified path and/or file. |
| 71 | + |
| 72 | + When used with -d the path must be a directory. |
| 73 | + |
| 74 | + When an output is specified, cdata will always set the output |
| 75 | + rendered to "plain", even if it is explicitly specified. |
| 76 | + |
| 77 | + -q <quantity> |
| 78 | + This option allows you to set the limit value of the number |
| 79 | + of dumps to retrieve. The default is 50 if this is not set. |
| 80 | + |
| 81 | + When performing multiple queries it is recommended to set -q <quantity> |
| 82 | + to a higher value to avoid being rate limited. |
| 83 | + |
| 84 | + -r <renderer> |
| 85 | + This option allows you to specify the render method of the |
| 86 | + the return from canvas. Available options are: |
| 87 | + |
| 88 | + "color" (default) This will use json (npm) to format the |
| 89 | + return and will use pygmentize (pip) to color the return. |
| 90 | + |
| 91 | + "plain" This option will return the raw JSON object unformatted. |
| 92 | + |
| 93 | + Plain is always used when when -o <path> is used, even if color |
| 94 | + is explicitly specified in the command. |
| 95 | + |
| 96 | + -s |
| 97 | + This command will output the complete curl command in a readable |
| 98 | + format. It will not execute the command. |
| 99 | + |
| 100 | + -v |
| 101 | + Version information. |
| 102 | + |
| 103 | +METHOD |
| 104 | + The method is the URL path to be queried, excluding the |
| 105 | + domain, subdomain and, /api/account/self/ path. |
| 106 | + |
| 107 | + For example if the desired query is: |
| 108 | + https://portal.inshosteddata.com/api/account/self/dump |
| 109 | + The method is simply: |
| 110 | + dump |
| 111 | + |
| 112 | + The method can be quoted without issue in the event that |
| 113 | + the current shell has issues with query parameters. |
| 114 | + For example when filtering dumps you can use: |
| 115 | + |
| 116 | + cdata "dump?after=<integer>&limit=<integer>" |
| 117 | + |
| 118 | +EXAMPLES |
| 119 | + Get the latest schema |
| 120 | + cdata schema/latest |
| 121 | + |
| 122 | + Get plain format list of files for a specified table |
| 123 | + cdata -r plain file/byTable/wiki_page_fact |
| 124 | + |
| 125 | + Save output of dumps for a specified quantity |
| 126 | + cdata -o ~/dumps.json -q 2 dump |
| 127 | + |
| 128 | + Authenticate to cdata without using .inst config file |
| 129 | + cdata -m <secret> -k <key> files/latest |
| 130 | + |
| 131 | + Download the latest dump files |
| 132 | + cdata -o <path> -d files/latest |
| 133 | + |
| 134 | +FILES |
| 135 | + ~/.inst |
| 136 | + Config file, see -c for details. |
| 137 | + |
| 138 | +EXIT CODES |
| 139 | + 1 Unable to overwrite specified output file |
| 140 | + (or user canceled overwrite) |
| 141 | + |
| 142 | + 2 Invalid option or missing argument |
| 143 | + |
| 144 | + 127 Missing dependency |
| 145 | + |
| 146 | + Unspecified exit codes, or an exit code of 0 represent |
| 147 | + a successful command. |
| 148 | + |
| 149 | +WWW |
| 150 | + https://www.instructure.com/canvas |
| 151 | + Instructure home page for the canvas application. |
| 152 | + |
| 153 | + https://portal.inshosteddata.com/docs/api |
| 154 | + API documentation for the canvas data application. |
| 155 | + |
| 156 | + https://github.com/thedannywahl/inst-api |
| 157 | + Software repository for canvas-data-cli. |
0 commit comments