post
)HTTP POST request with a JSON-parsable return
Fetches a page from a URL via HTTP/S POST request.
post url -> <stdout>
<stdin> -> post url content-type -> <stdout>
» post google.com -> [ Status ]
{
"Code": 405,
"Message": "Method Not Allowed"
}
POST
returns a JSON object with the following fields:
{
"Status": {
"Code": integer,
"Message": string,
},
"Headers": {
string [
string...
]
},
"Body": string
}
The concept behind this is it provides and easier path for scripting eg pulling specific fields via the index, [
, function.
Running get
, post
or getfile
as a method will transmit the contents of stdin as part of the body of the HTTP request. When run as a method the Content-Type
HTTP header will automatically be set to the default MIME for the data type from stdin.
This is defined in config
, pre-defined by sensible defaults from each murex data type. For example:
» config get shell default-mimes -> [json]
application/json
You can override this at the global level via shell default-mimes, or at the local level via http headers:
config set http headers %{
api.example.com: {
Content-Type: application/foobar
}
}
post
has a number of behavioral options which can be configured via Murex’s standard config
tool:
config -> [ http ]
To change a default, for example the user agent string:
config set http user-agent "bob"
post google.com
This enables sane, repeatable and readable defaults. Read the documents on config
for more details about it’s usage and the rational behind the command.
getfile
): Makes a standard HTTP request and return the contents as Murex-aware data type for passing along Murex pipelines.[ Index ]
): Outputs an element from an array, map or table[[ Element ]]
): Outputs an element from a nested structureget
): Makes a standard HTTP request and returns the result as a JSON objectconfig
): Query or define Murex runtime settingsThis document was generated from builtins/core/httpclient/post_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master
branch. Downloadable murex binaries are also built with the website.
Last built on Tue Dec 10 22:56:57 UTC 2024 against commit 60f05a260f05a227caf73dd5b3478e3cb3f4bb24e46745b.
Current version is 6.4.1005 (develop) which has been verified against tests cases.