<http>

HTTP plugin for making HTTP/HTTPS requests

Core v2.2.0

Overview

This plugin performs GET and POST requests with full support for: headers, parameters, authentication, redirects, proper URL encoding, and binary content.

Usage Examples

Example 1: Simple GET Request

example-1.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://org.webharvest/schema/2.1/core">
<def var="url">https://httpbin.org/get</def>
<def var="response">
    <http url="${url}"/>
</def>
<file action="write" path="target/http_output.txt">
    <get var="response"/>
</file>
</config>

Example 2: POST with JSON

example-2.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://org.webharvest/schema/2.1/core">
<http url="https://api.example.com/users" method="POST">
  <http-header name="Content-Type">application/json</http-header>
  <http-header name="Authorization">Bearer ${apiToken}</http-header>
  <http-param name="data">{"name": "John", "age": 30}</http-param>
</http>
</config>

Example 3: Binary Content (Images, PDFs)

example-3.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://org.webharvest/schema/2.1/core">
<http url="http://example.com/image.jpg"/>
<file action="write" path="downloaded_image.jpg" type="binary">${http}</file>
</config>

Example 4: URL with Special Characters

example-4.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://org.webharvest/schema/2.1/core">
<!-- Color parameter #FF0000 is automatically encoded as %23FF0000 -->
<http url="http://example.com/api?color=#FF0000&amp;size=large"/>
</config>

Parameters

Important Notes

Related Processors