github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/httpclient/post_doc.yaml (about) 1 - DocumentID: post 2 Title: >+ 3 `post` 4 CategoryID: commands 5 Summary: >- 6 HTTP POST request with a JSON-parsable return 7 Description: |- 8 Fetches a page from a URL via HTTP/S POST request. 9 Usage: |- 10 ``` 11 post url -> <stdout> 12 13 <stdin> -> post url content-type -> <stdout> 14 ``` 15 Examples: |- 16 ``` 17 ยป post google.com -> [ Status ] 18 { 19 "Code": 405, 20 "Message": "Method Not Allowed" 21 } 22 ``` 23 Detail: |- 24 ### JSON return 25 26 `POST` returns a JSON object with the following fields: 27 28 ``` 29 { 30 "Status": { 31 "Code": integer, 32 "Message": string, 33 }, 34 "Headers": { 35 string [ 36 string... 37 ] 38 }, 39 "Body": string 40 } 41 ``` 42 43 The concept behind this is it provides and easier path for scripting eg pulling 44 specific fields via the index, `[`, function. 45 46 ### `post` as a method 47 48 Running `post` as a method will transmit the contents of STDIN as part of the 49 body of the HTTP POST request. When run as a method you have to include a second 50 parameter specifying the Content-Type MIME. 51 52 ### Configurable options 53 54 `post` has a number of behavioral options which can be configured via Murex's 55 standard `config` tool: 56 57 ``` 58 config -> [ http ] 59 ``` 60 61 To change a default, for example the user agent string: 62 63 ``` 64 config set http user-agent "bob" 65 post google.com 66 ``` 67 68 This enables sane, repeatable and readable defaults. Read the documents on 69 `config` for more details about it's usage and the rational behind the command. 70 Synonyms: 71 Related: 72 - get 73 - item-index 74 - element 75 - getfile 76 - config 77