본문으로 건너뛰기
버전: 1.0.0

Update multiple documents

정보
  • 데이터 추가, 읽기, 변경, 삭제를 위해서는 client write secret이 필요합니다.

Overview

Path
PUT / PATCH/v1/collections/{collectionName}/documents

  • 여러 document를 한 번에 업데이트합니다.
  • PUT method
    • PUT method는 upsert 기능을 수행합니다.
    • Collection에 있는 Document를 업데이트하는 경우 Destructive 업데이트를 수행하여 지정되지 않은 모든 셀 값을 지웁니다.
  • PATCH method
    • PATCH method는 존재하지 않는 Document를 업데이트할 수 없습니다.
    • 지정한 필드만 업데이트하고, 나머지 필드는 그대로 유지합니다.

Example


curl -X PUT https://api.invector.co/v1/collections/{collectionName}/documents \
     -H "Content-Type: application/json" \
     -H "Authorization: Basic base64({CLIENT_ID}:{CLIENT_WRITE_SECRET})" \
     -d '{
       "documents": [
         {
           "_id": "unique_document_id_123",
           "title": "Description of Philip",
           "name": "Philip",
           "age": 22,
           "department": "Engineering",
           "role": "Software Engineer",
           "email": "philipchoi@togglecampus.com"
         }
       ]
     }'
curl -X PATCH https://api.invector.co/v1/collections/{collectionName}/documents \
     -H "Content-Type: application/json" \
     -H "Authorization: Basic base64({CLIENT_ID}:{CLIENT_WRITE_SECRET})" \
     -d '{
       "documents": [
         {
           "_id": "unique_document_id_123",
           "name": "Philips",
           "age": 23,
           "email": "philip@togglecampus.com"
         }
       ]
     }'

Authorization


Authorization
BasicBasic authorization at Header. Base64 encoding required
client_id
string
client_secret
string
example

 curl -X PUT https://api.invector.co/v1/collections/{collectionName}/documents \
      -H "Content-Type: application/json" \
      -H "Authorization: Basic base64({CLIENT_ID}:{CLIENT_WRITE_SECRET})" \
     ...

Path Parameters


collectionName
string

Request Body


documents
array of objectArray of documents to be created.
_id
stringUnique Document ID.
title
string (required if PUT)Title of the document.
[other fields …]
anyOther fields of the document.
example
{
  "documents": [
    {
      "_id": "unique_document_id_123",
      "title": "Description of Philip",
      "name": "Philip",
      "age": 22,
      "department": "Engineering",
      "role": "Software Engineer",
      "email": "philipchoi@togglecampus.com"
    }
  ]
}

Response Body


documents
array of objectArray of documents updated.
_id
stringUnique Document ID.
title
stringTitle of the document.
[other fields …]
anyOther fields of the document.
example
{
  "documents": [
    {
      "_id": "unique_document_id_123",
      "title": "Description of Philip",
      "name": "Philip",
      "age": 22,
      "department": "Engineering",
      "role": "Software Engineer",
      "email": "philipchoi@togglecampus.com"
    }
  ]
}