Skip to main content
This document describes how to upload attachments in AI Table. Uploading an attachment in AI Table works similarly to the action shown below. Uploading an attachment involves three steps:
  1. Get the upload information. For details, see the Get resource upload information API.
  2. Upload the local file to the uploadUrl returned in step 1. Use a PUT request to upload the local file. The following is an example using the cURL command (the @ symbol in the example is required).
    curl -X PUT -H "Content-Type: image/jpeg" --data-binary @/path/to/your/image.jpg {uploadUrl returned in step 1}
    
  3. Call the Insert records and Update multiple records APIs to write the attachment into AI Table. The format of the record value is as follows.
    [
      {
          "filename": "pikaqiu.jpg", // The resourceName passed in step 1
          "size": 200, // The size passed in step 1
          "type": "image/jpeg", // The mediaType passed in step 1
          "url": "xxx"// The resourceUrl returned in step 1. Note: this is not uploadUrl. For example, /core/api/resources/img/xxx
          "resourceId": "xxx" // The resourceId returned in step 1. For example, 9ee6c515-4ebd-47a0-b8c3-5383c4241d84
      }
    ]