rembrembdocs

http: RESTful Client


The http extension allows you to call RESTful endpoints within Postgres.

Quick demo#

Overview#

Let's cover some basic concepts:

You can use the http extension to make these network requests from Postgres.

Usage#

Enable the extension#

  1. Go to the Database page in the Dashboard.
  2. Click on Extensions in the sidebar.
  3. Search for http and enable the extension.

Available functions#

While the main usage is http('http_request'), there are 5 wrapper functions for specific functionality:

Returned values#

A successful call to a web URL from the http extension returns a record with the following fields:

Examples#

Simple GET example#

1select2  "status", "content"::jsonb3from4  extensions.http_get('https://jsonplaceholder.typicode.com/todos/1');

Simple POST example#

1select2  "status", "content"::jsonb3from4  extensions.http_post(5    'https://jsonplaceholder.typicode.com/posts',6    '{ "title": "foo", "body": "bar", "userId": 1 }',7    'application/json'8  );

Resources#