Skip to main content

Update Records

We will show you how to Update records.

Example: updates the two records of the specified datasheet

Assuming you have a datasheet, you would like to update two of these records.

tip

The "id" attribute in the member field may be deprecated in the future. If you need to fill in the member field when creating or updating a record, please use the "unitId" attribute to add members.

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 the ID of the 2 records you want to update.(How to get it)

  4. Open the terminal on your computer, execute the following code and send the query request to the server (assuming datasheetId is dstWUHwzTHd2YQaXEE,prior record Id is recbaKEuZ9gDC and rec0dm5nsmS6):

    curl -X PATCH \
    https://aitable.ai/fusion/v1/datasheets/dstWUHwzTHd2YQaXEE/records \
    -H 'Authorization: Bearer {Your API Token}' \
    -H 'Content-Type: application/json' \
    -d '{
    "records": [
    {
    "recordId": "recbaKEuZ9gDC",
    "fields": {
    "Nickname": "An An",
    "Weight": "90kg"
    }
    },
    {
    "recordId": "rec09dm5nsmS6",
    "fields": {
    "Nickname": "Jia Jia",
    "Weight": "89kg"
    }
    }
    ]
    }'
  5. The server returns the following JSON data, below the "records" is updated data:

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

        {
    "code": 200,
    "success": true,
    "data": {
    "records": [
    {
    "recordId": "recbaKEuZ9gDC",
    "createdAt": 1600431195000,
    "fields": {
    "weight": "90kg",
    "shoulderHeight": "65cm",
    "registration_date": "2020/09/15 17:14",
    "Chest": "87cm",
    "body length": "1.2m",
    "Photo": [
    {
    "id": "atcPtxnvqti5M",
    "name": "6.gif",
    "size": 33914,
    "mimeType": "image/gif",
    "token": "space/2020/09/22/01ee7202922d48688f61e34f12da5abc",
    "width": 240,
    "height": 240,
    "url": "https://s1.aitable.ai/space/2020/09/22/01ee7202922d48688f61e34f12da5abc"
    }
    ],
    "registrar": [
    {
    "id": "1286184164530659329",
    "unitId": "*********",
    "type": "Member",
    "name": "Bruce - K",
    "avatar": "https://s1.aitable.ai/public/2020/08/03/574bcee4cfc54f6fbb7d686bb237f6f3"
    }
    ],
    "gender": "boy",
    "nickname": "Anon",
    "age": "5 years old"
    }
    },
    {
    "recordId": "rec09dm5nsmS6",
    "createdAt": 1600431195000,
    "fields": {
    "weight": "89kg",
    "shoulderHeight": "66cm",
    "registration_date": "2020/09/15 17:14",
    "Chest": "89cm",
    "body length": "1.4m",
    "Photo": [
    {
    "id": "atcPtxnvqti5M",
    "name": "6.gif",
    "size": 33914,
    "mimeType": "image/gif",
    "token": "space/2020/09/22/01ee7202922d48688f61e34f12da5abc",
    "width": 240,
    "height": 240,
    "url": "https://s1.aitable.ai/space/2020/09/22/01ee7202922d48688f61e34f12da5abc"
    }
    ],
    "registrar": [
    {
    "id": "1291258301781176321",
    "unitId": "*********",
    "type": "Member",
    "name": "Aoi🌻",
    "avatar": "https://s1.aitable.ai/public/2020/09/07/dbfe6ceccbdb4d5bbc1fd129566dea89"
    }
    ],
    "gender": "girl",
    "nickname": "Jiajia",
    "age": "6 years old"
    }
    }
    ]
    },
    "message": "SUCCESS"
    }