You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/shortcut-methods.md
+7-44Lines changed: 7 additions & 44 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,55 +41,18 @@ Intermediate positional parameters that are not used should be set to <code>''</
41
41
</table>
42
42
43
43
### `GetJSON` - issue a request to a JSON-based web service
44
-
`GetJSON` is used to interact with web services that use JSON for their request and response payloads. It was originally developed as a convenient way to interact with [Jarvis](https://githib.com/dyalog/Jarvis), Dyalog's JSON and REST Service framework. Conveniently, it turns out that there are many web services, including GitHub and Twitter, that use JSON as well.
44
+
`GetJSON` is used to interact with web services that use JSON for their request and response payloads. It was originally developed as a convenient way to interact with [Jarvis](https://github.com/dyalog/Jarvis), Dyalog's JSON and REST Service framework. Conveniently, it turns out that there are many web services, including GitHub and Twitter, that use JSON as well.
45
45
46
46
When `Command` is something other than `GET` or `HEAD`, `GetJSON` will automatically convert APL `Params` into JSON format. For `GET` and `HEAD`, `HttpCommand` will URLEncode `Params` in the query string of the `URL`. The rationale behind this is that `GET` and `HEAD` requests should not have content; therefore `Params` should be included in the query string of `URL` and it doesn't make a lot of sense to include JSON in the query string. If you really need JSON in the query string, you can use `⎕JSON` to convert `Params`.
47
47
48
48
`GetJSON` will attempt to convert any JSON response payload into its equivalent APL representation.
Intermediate positional parameters that are not used should be set to <code>''</code></li>
64
-
<li>A namespace containing named variables for the settings for the request.<br/>
65
-
</li></ul></td></tr>
66
-
<tr><td><code>RequestOnly</code></td>
67
-
<td>(optional) A Boolean indicating:<ul>
68
-
<li><code>0</code> - (default) send the HTTP request and return the response result.
69
-
<li><code>1</code> - return the formatted HTTP request that HttpCommand <i>would</i> send if <code>RequestOnly</code> was <code>0</code>.</li></ul></td></tr>
70
-
<tr><td><code>r</code></td>
71
-
<td>If RequestOnly is<ul><li><code>0</code> - a namespace containing the request response.</li>
72
-
<li><code>1</code> - the formatted HTTP request that <code>HttpCommand</code> would send if <code>RequestOnly</code> was <code>0</code>.</td></tr>
73
-
<tr><td>Example(s)</td>
74
-
<td>These examples assume you have a <ahref="https://github.com/dyalog/Jarvis"><code>Jarvis</code></a> service running at <code>http://localhost:8080</code> and a endpoint of <code>#.sum ← {+/⍵}</code>.<br/><br/>
|`args`| One of:<ul><li>a simple character vector [`URL`](./request-settings.md#url)</li><li>a vector of positional settings (`Command` and `URL` are required.)<br/>[`Command`](./request-settings#command)<br/>[`URL`](./request-settings#url)<br/> [`Params`](./request-settings#params)<br/> [`Headers`](./request-settings#headers)<br/> [`Cert`](./conga-settings#cert)<br/>[`SSLFlags`](./conga-settings#sslflags)<br/>[`Priority`](./conga-settings#priority)<br/>Intermediate positional parameters that are not used should be set to `''`</li><li>A namespace containing named variables for the settings for the request.</li></ul>|
53
+
|`RequestOnly`| (optional) A Boolean indicating:<ul><li>`0` - (default) send the HTTP request and return the response result.<li>`1` - return the formatted HTTP request that HttpCommand *would* send if `RequestOnly` was `0`.</li></ul>|
54
+
|`r`| If `RequestOnly` is<ul><li>`0` - a namespace containing the request response.</li><li>`1` - the formatted HTTP request that `HttpCommand` would send if `RequestOnly` was `0`.</li></ul>|
55
+
| Example(s) | These examples assume you have a [`Jarvis`](https://github.com/dyalog/Jarvis) service running at `http://localhost:8080` and a endpoint of `#.sum ← {+/⍵}`.<br/>      `args ← ⎕NS ''`<br/>      `args.Command ← 'post'`<br/>      `args.URL ← 'localhost:8080/sum'`<br>      `args.Params ← ⍳1000`<br/>      `⊢r ← HttpCommand.GetJSON args`<br/>`[rc: 0 | msg: | HTTP Status: 200 "OK" | ⍴Data: ⍬]`<br/>      `r.Data`<br/>`500500`<br/><br/>      `Params ← ('per_page' '3')('page' '1')('sort' 'full_name')`<br/>      `URL ← 'https://api.github.com/orgs/dyalog/repos'`<br/>      `⊢r ← HttpCommand.GetJSON 'get' URL Params`<br/>`[rc: 0 | msg: | HTTP Status: 200 "OK" | ⍴Data: 3]`<br/><br/>      `r.Data.full_name`<br/>` Dyalog/a3s-Linux Dyalog/APLCourse Dyalog/aplssh`|
93
56
94
57
### `Do` - issue a generic HTTP request
95
58
`Do` is essentially the same as `Get` except that you specify the HTTP method (`Command`) to use.
0 commit comments