Skip to main content

Quick Start

This paper describes how to quickly start viewing the AITable API in 5 minutes.

Step 1: Get API Token

API Token is the user authentication token.When sending API requests to AITable server, you must take Authorization: Bearer {Your API Token}at the head of the request to facilitate server authentication.

When authenticated successfully, the API request will have the same permissions as the user has to operate on the APITAble interface, that is, what data the user can do on the interface, and what data can be used in the request.

Get API Token as follows::

  1. Sign in to AITable and tap the profile of the lower left corner, enter the User Center and go to the Developer Configuration.

  2. Click "+" to generate an API Token.Note: You need to bind your email when you generate it for the first time.

  3. Copy API Token.

Note:

  • Please secure your API Token, if API Token leaks, others may tamper with data in your datasheet.
  • If the API Token is leaked, you can regenerate the Token in the Developer Configuration screen to ensure data security.

Step 2: Calling the API interface to implement data additions and deletions

Select the programming language you are familiar with (e.g. Javascript) and make sure you need to call the AITable API interface you can choose either of the following ways to send requests to the API server.

Method 1: Send HTTPS request directly

Example HTTPS request in some common languages using the Access API interface:

Note: Before executing the following code, you need to replace the {datasheetid} and {your API Token} to the real datasheetId and API token.

curl "https://aitable.ai/fusion/v1/datasheets/{datasheetId}/records" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {Your API Token}"

You can also send HTTPS requests by selecting any other language or library.

Method 2: Use officially provided SDK

The SDK (Sofware Development Kit, Software Development Toolkit) provides a cover for network requests and authentications, handles details on many API requests and helps you quickly start to experience AITable API. AITable SDK is officially provided on GitHub. Before using SDK, you need to execute the following commands on the terminal of the computer to install and initialize the SDK

  1. Install the Javascript SDK by either of the following methods.

    # You need to install npm in advance
    npm install apitable@latest
  1. Initialize the Javascript SDK.

    import { APITable } from "apitable";
    const apitable = new APITable({ token: "_Your_API_Token_"});

    When instantiating the SDK client you have the option to configure the following global parameters.

    OptionsTypeDefault valueDescription
    tokenstringRequired, representing the incoming API Token
    fieldKeystringnameThe key used to query and return fields.By default use name(field name).\n When specified as id, fieldId will be used as the query and return method (using id can avoid code failure caused by modifying the field name)
    requestTimeoutnumber60000Request expiration time, milliseconds, default value is 6000000 (i. e. 10 seconds)
    hoststringhttps://aitable.ai/fusion/v1Destination server
    adapteranyIf it needs to be used in the WeChat Miniprogram, a request adapter needs to be added, see Using Vika JS SDK in the WeChat Miniprogram

Once the request is determined, you can write the code, calling the corresponding APItable API interface.