Skip to content

Latest commit

 

History

History
97 lines (75 loc) · 2.29 KB

http-api.md

File metadata and controls

97 lines (75 loc) · 2.29 KB
description
Learn how to integrate Airstack Hubs HTTP API into your Farcaster app within minutes.

📠 HTTP API

Step 1: Install Dependencies

First, install the necessary dependencies to your project:

{% tabs %} {% tab title="npm" %}

npm i axios dotenv

{% endtab %}

{% tab title="yarn" %}

yarn add axios dotenv

{% endtab %}

{% tab title="pnpm" %}

pnpm install axios dotenv

{% endtab %}

{% tab title="bun" %}

bun install axios dotenv

{% endtab %} {% endtabs %}

Step 2: Connect to HTTP API

Then, you can connect and call to Airstack Hubs HTTP API by using library such as axios and provide the URL with the Airstack API key added to the headers field x-airstack-hubs:

{% tabs %} {% tab title="axios" %}

import axios from "axios";
import { config } from "dotenv";

config();

const main = async () => {
  const server = "https://hubs.airstack.xyz";
  try {
    const response = await axios.get(`${server}/v1/info?dbstats=1`, {
      headers: {
        "Content-Type": "application/json",
        // Provide API key here
        "x-airstack-hubs": process.env.AIRSTACK_API_KEY as string,
      },
    });
  
    console.log(response);
  
    console.log(json);
  } catch (e) {
    console.error(e);
  }
}

main();

{% endtab %} {% endtabs %}

Next Steps

Once you have the HTTP API integrated, you can start exploring all the APIs offered:

Developer Support

If you have any questions or need help regarding integrating Airstack HTTP API into your Farcaster app, please join our Airstack's Telegram group.

More Resources