> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sync.cdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# HTTP Operations

HTTP operations enable you to send HTTP requests.

The example below uses the `httpPost` operation in the post-job event to send a JSON payload to the specified URL:

```xml theme={null}
<api:info title="After Run" desc="This event is fired after running a job.">
  <input name="JobName"         required="true" desc="The name of the job being executed." />
  <input name="Source"          required="true" desc="The name of source connection." />
  <input name="Destination"     required="true" desc="The name of destination connection." />
  <input name="JobStatus"       required="true" desc="The status of the completed run."/>
  <input name="Query#"          required="true" desc="An array containing each query that was executed." />
  <input name="QueryStatus#"    required="true" desc="An array containing the status of each query that was executed." />
</api:info>

<api:set attr="http.url"  value="http://mysite.com/log/"/> 
<api:set attr="http.header:name#1"  value="Token"/>
<api:set attr="http.header:value#1"  value="MyToken"/>
<api:set attr="http.contenttype"  value="application/json"/>
<api:set attr="http.postdata">
{
	"JobName":"[_input.jobname]",
	"Status":"[_input.JobStatus]"
}
</api:set>

<api:call op="httpPost" in="http"/>
```

## Operations

* [Make an HTTP GET Request](#httpget)
* [Make an HTTP POST Request](#httppost)
* [Make an HTTP PUT Request](#httpput)

### httpGet

Obtain a document from the web by using the HTTP GET method.

| Required Input Attribute | Description          |
| :----------------------- | :------------------- |
| url                      | The URL to retrieve. |

| Optional Input Attribute | Description                                                                                                                                                      |
| :----------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| timeout                  | The timeout, in seconds, for the operation to complete. Zero (0) means no timeout. The default value is `60`.                                                    |
| cookie:\*                | Any cookies to add to the request.                                                                                                                               |
| user                     | The username to authenticate with if the Auth-scheme parameter is set to something other than `None`.                                                            |
| password                 | The password to authenticate with if the Auth-scheme parameter is set to something other than `None`.                                                            |
| authscheme               | The authorization mechanism to use. Only relevant if user and password are provided. The allowed values are 'BASIC, DIGEST, NTLM'. The default value is `BASIC`. |
| header:name#             | The name for each custom header to pass with the request.                                                                                                        |
| header:value#            | The value for each custom header to pass with the request.                                                                                                       |
| ifmodifiedsince          | The IF-MODIFIED-SINCE date and time to use as a filter for the results retrieved (for example: `Sat, 25 Feb 2006 04:11:47 GMT`).                                 |
| localfile                | If specified, the results of the GET method are written to this file.                                                                                            |
| logfile                  | The full path to a file to log request and response data. Must be used in conjuction with `verbosity`.                                                           |
| verbosity                | The verbosity of the log file, from `1` (least verbose) to `5` (most verbose).                                                                                   |

| Output Attribute | Description                                                        |
| :--------------- | :----------------------------------------------------------------- |
| ssl:issuer       | The issuer of the SSL/TLS certificate.                             |
| ssl:subject      | The subject of the SSL/TLS certificate.                            |
| http:statuscode  | The HTTP status code that is returned from the request.            |
| http:content     | The content of the HTTP response.                                  |
| cookie:\*        | The cookies that are returned with the response.                   |
| http:allcookies  | All of the cookies from the response, returned as a single string. |
| header:\*        | The headers returned with the response.                            |

### httpPost

Post data to a URL using the HTTP POST method.

| Required Input Attribute | Description          |
| :----------------------- | :------------------- |
| url                      | The destination URL. |

| Optional Input Attribute | Description                                                                                                                                                              |
| :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| timeout                  | The timeout, in seconds, for the operation to complete. Zero (0) means no timeout. The default value is `60`.                                                            |
| cookie:\*                | Any cookies to add to the request.                                                                                                                                       |
| user                     | The username to authenticate with if the authscheme parameter is set to something other than None.                                                                       |
| password                 | The password to authenticate with if the authscheme parameter is set to something other than None.                                                                       |
| authscheme               | The authorization mechanism to use. Only relevant if user and password are provided. The allowed values are `BASIC`, `DIGEST`, and `NTLM`. The default value is `BASIC`. |
| header:name#             | The name for each custom header to pass with the request.                                                                                                                |
| header:value#            | The value for each custom header to pass with the request.                                                                                                               |
| ifmodifiedsince          | The IF-MODIFIED-SINCE date and time to use as a filter for the results retrieved (for example: `Sat, 25 Feb 2006 04:11:47 GMT`).                                         |
| localfile                | If specified, the results of the GET method is written to this file.                                                                                                     |
| paramname#               | The name for each parameter to pass with the request.                                                                                                                    |
| paramvalue#              | The value for each parameter to pass with the request.                                                                                                                   |
| postdata                 | Data to include in the POST method. Use file:// followed by a file path to post the contents of a file.                                                                  |
| contenttype              | The content type for the POST method. The default value is `application/x-www-form-urlencoded`.                                                                          |
| logfile                  | The full path to a file to log request and response data. Must be used in conjuction with `verbosity`.                                                                   |
| verbosity                | The verbosity of the log file, from `1` (least verbose) to `5` (most verbose).                                                                                           |

| Output Attribute | Description                                                        |
| :--------------- | :----------------------------------------------------------------- |
| ssl:issuer       | The issuer of the SSL/TLS certificate.                             |
| ssl:subject      | The subject of the SSL/TLS certificate.                            |
| http:statuscode  | The HTTP status code that is returned from the request.            |
| http:content     | The content of the HTTP response.                                  |
| cookie:\*        | The cookies that are returned with the response.                   |
| http:allcookies  | All of the cookies from the response, returned as a single string. |
| header:\*        | The headers returned with the response.                            |

### httpPut

Put a web document using the HTTP PUT method.

| Required Input Attribute | Description          |
| :----------------------- | :------------------- |
| url                      | The destination URL. |

| Optional Input Attribute | Description                                                                                                                                                          |
| :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| timeout                  | The timeout, in seconds, for the operation to complete. Zero (0) means no timeout. The default value is `60`.                                                        |
| cookie:\*                | Any cookies to add to the request.                                                                                                                                   |
| user                     | The username to authenticate with if the authscheme parameter is set to something other than `None`.                                                                 |
| password                 | The password to authenticate with if the authscheme parameter is set to something other than `None`.                                                                 |
| authscheme               | The authorization mechanism to use. Only relevant if user and password are provided. The allowed values are `BASIC`, `DIGEST`, `NTLM`. The default value is `BASIC`. |
| header:name#             | The name for each custom header to pass with the request.                                                                                                            |
| header:value#            | The value for each custom header to pass with the request.                                                                                                           |
| ifmodifiedsince          | The if-modified-since date and time to use as a filter for the results retrieved (for example: `Sat, 25 Feb 2006 04:11:47 GMT`).                                     |
| localfile                | If specified, the results of the GET method is written to this file.                                                                                                 |
| paramname#               | The name for each parameter to pass with the request.                                                                                                                |
| paramvalue#              | The value for each parameter to pass with the request.                                                                                                               |
| putdata                  | Data to include in the PUT method. Use file:// followed by a file path to put the contents of a file.                                                                |
| contenttype              | The content type for the POST method. The default value is `text/html`.                                                                                              |
| logfile                  | The full path to a file to log request and response data. Must be used in conjuction with `verbosity`.                                                               |
| verbosity                | The verbosity of the log file, from `1` (least verbose) to `5` (most verbose).                                                                                       |

| Output Attribute | Description                                                        |
| :--------------- | :----------------------------------------------------------------- |
| ssl:issuer       | The issuer of the SSL/TLS certificate.                             |
| ssl:subject      | The subject of the SSL/TLS certificate.                            |
| http:statuscode  | The HTTP status code that is returned from the request.            |
| http:content     | The content of the HTTP response.                                  |
| cookie:\*        | The cookies that are returned with the response.                   |
| http:allcookies  | All of the cookies from the response, returned as a single string. |
| header:\*        | The headers returned with the response.                            |
