# HTTP Module

Basic http(s) callout capability. Import

```
import http from 'http';
```

### Methods

[get/head/post/put/patch/delete(url, options)](https://docs.medable.com/reference#section-get-head-post-put-patch-delete-url-options-)\
[getCiphers()](https://docs.medable.com/reference#section-getciphers-)

### get/head/post/put/patch/delete(url, options)

**Arguments**

* `url` (String) endpoint url
* `options`
  * `buffer` (Boolean:false) If true, the result body is a Buffer object. Otherwise, the result body is a utf-8 encoded string.
  * `timeout` (Number) timeout in milliseconds.
  * `strictSSL` (Boolean:false) Only available in the development environment.
  * `headers` (Object) custom headers.
  * `body` (String) for POST, PUT, and PATCH only. Must be a string.
  * `sslOptions`
    * `pfx`
    * `key`
    * `cert`
    * `ca`
    * `passphrase`
    * `ciphers`
    * `rejectUnauthorized`
    * `servername`
    * `secureProtocol`
    * `minDHSize`

**Returns**

`Object`

* `headers` (Object) an object containing response headers
* `body` (String) the response body.
* `statusCode` (Number) http status code.
* `statusMessage` (String) http status message.

### getCiphers()

**Returns**

Returns the list of available ciphersHTTP Example

```
import http from 'http'
import xml from 'xml'
import request from 'request'
import response from 'response'

let data = http.get('http://www.xmlfiles.com/examples/simple.xml', {headers: {accept: 'text/xml'}}).body

if (request.getHeader('Accept') == 'text/xml') {
    response.setHeader('Content-Type', 'text/xml')
    response.write(data)
    return
}

return xml.toJs(data)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/scripting/modules-1/http-module.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
