Search Shortcut cmd + k | ctrl + k

- Overview
- Documentation
- Development
- Download Metrics
- FAQ
- Core Extensions
- List of Community Extensions

- tarfs
- open_prompt
- http_client
- scrooge
- duckpgq

http_client
Downloads 866this week

DuckDB HTTP Client Extension

Extension repository on GitHub
Extension descriptor (YAML)

### Installing and Loading

    INSTALL http_client FROM community;
    LOAD http_client;

### Example

    -- GET Request Example w/ JSON Parsing
    WITH __input AS (
      SELECT
        http_get(
            'https://httpbin.org/delay/0',
            headers => MAP {
              'accept': 'application/json',
            },
            params => MAP {
              'limit': 1
            }
        ) AS res
    ),
    __response AS (
      SELECT
        (res->>'status')::INT AS status,
        (res->>'reason') AS reason,
        unnest( from_json(((res->>'body')::JSON)->'headers', '{"Host": "VARCHAR"}') ) AS features
      FROM
        __input
    )
    SELECT
      __response.status,
      __response.reason,
      __response.Host AS host
    FROM
      __response
    ;
    ┌────────┬─────────┬─────────────┐
    │ status │ reason  │    host     │
    │ int32  │ varchar │   varchar   │
    ├────────┼─────────┼─────────────┤
    │    200 │ OK      │ httpbin.org │
    └────────┴─────────┴─────────────┘

    -- POST Request Example w/ Headers and Parameters
    WITH __input AS (
    SELECT
      http_post(
          'https://httpbin.org/delay/0',
          headers => MAP {
            'accept': 'application/json',
          },
          params => MAP {
            'limit': 1
          }
      ) AS res
    ),
    __response AS (
      SELECT
        (res->>'status')::INT AS status,
        (res->>'reason') AS reason,
        unnest( from_json(((res->>'body')::JSON)->'headers', '{"Host": "VARCHAR"}') ) AS features
      FROM
        __input
    )
    SELECT
      __response.status,
      __response.reason,
      __response.Host AS host,
    FROM
      __response
    ;
    ┌────────┬─────────┬─────────────┐
    │ status │ reason  │    host     │
    │ int32  │ varchar │   varchar   │
    ├────────┼─────────┼─────────────┤
    │    200 │ OK      │ httpbin.org │
    └────────┴─────────┴─────────────┘

### About http_client

The HTTP Client Extension is experimental, use at your own risk!

### Added Functions

function_name | function_type | description | comment | example
--- | --- | --- | --- | ---
http_get | scalar |  |  |
http_post | scalar |  |  |