Skip to main content

Uploading Attachments

This text provides an example of how to call Upload attachments interface.

Example: Upload an attachment and bind to AITable

Suppose you have a picture, you want to upload the picture to AITable

Your action steps below:

  1. Get your API Token.(How to get it)

  2. Get the ID of the datasheet.(How to get it)

  3. Get your absolute path of your local picture.

  4. Open the terminal on your computer, execute the following code and send the query request to the server (assuming datasheetId is dstWUHwzTHd2YQaXEE, path of local pictures is /Users/coco/Documents/3.jpg):

    curl -X POST \
    https://aitable.ai/fusion/v1/datasheets/dstWUHwzTHd2YQaXEE/attachments \
    -H 'Authorization: Bearer {Your API Token}' \
    -H 'content-type: multipart/form-data' \
    -F 'file=@/Users/coco/Documents/3.jpg'
  5. The server returns the following JSON data, below the "data" is all upload successful attachment information:

    For the meaning of each parameter in the response, please check the API Reference.

        {
    "code": 200,
    "success": true,
    "data": {
    "token": "space/2021/06/30/d336232203054effb819231a3426d40d",
    "mimeType": "image/jpeg",
    "size": 229426,
    "height": 1024,
    "width": 1792,
    "name": "3.jpg",
    "url": "https://s1.aitable.ai/space/2021/06/30/d336232203054effb819231a3426d40d"
    },
    "message": "SUCCESS"
    }