github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/get.md (about)

     1  # `get`
     2  
     3  > Makes a standard HTTP request and returns the result as a JSON object
     4  
     5  ## Description
     6  
     7  Fetches a page from a URL via HTTP/S GET request
     8  
     9  ## Usage
    10  
    11  ```
    12  get url -> <stdout>
    13  
    14  <stdin> -> get url -> <stdout>
    15  ```
    16  
    17  ## Examples
    18  
    19  ```
    20  ยป get google.com -> [ Status ]
    21  {
    22      "Code": 200,
    23      "Message": "OK"
    24  }
    25  ```
    26  
    27  ## Detail
    28  
    29  ### JSON return
    30  
    31  `get` returns a JSON object with the following fields:
    32  
    33  ```
    34  {
    35      "Status": {
    36          "Code": integer,
    37          "Message": string,
    38      },
    39      "Headers": {
    40          string [
    41              string...
    42          ]
    43      },
    44      "Body": string
    45  }
    46  
    47  The concept behind this is it provides and easier path for scripting eg pulling
    48  specific fields via the index, `[`, function.
    49  
    50  ### `get` as a method
    51  
    52  Running `get` as a method will transmit the contents of STDIN as part of the
    53  body of the HTTP GET request. When run as a method you have to include a second
    54  parameter specifying the Content-Type MIME.
    55  
    56  ### Configurable options
    57  
    58  `get` has a number of behavioral options which can be configured via Murex's
    59  standard `config` tool:
    60  
    61  ```
    62  config -> [ http ]
    63  ```
    64  
    65  To change a default, for example the user agent string:
    66  
    67  ```
    68  config set http user-agent "bob"
    69  get: google.com
    70  ```
    71  
    72  This enables sane, repeatable and readable defaults. Read the documents on
    73  `config` for more details about it's usage and the rational behind the command.
    74  
    75  ## See Also
    76  
    77  * [`[ Index ]`](../parser/item-index.md):
    78    Outputs an element from an array, map or table
    79  * [`[[ Element ]]`](../parser/element.md):
    80    Outputs an element from a nested structure
    81  * [`config`](../commands/config.md):
    82    Query or define Murex runtime settings
    83  * [`getfile`](../commands/getfile.md):
    84    Makes a standard HTTP request and return the contents as Murex-aware data type for passing along Murex pipelines.
    85  * [`post`](../commands/post.md):
    86    HTTP POST request with a JSON-parsable return
    87  
    88  <hr/>
    89  
    90  This document was generated from [builtins/core/httpclient/get_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/httpclient/get_doc.yaml).