Add objects (bulk)
Adds objects to a collection. The request must include all the non-nullable properties for each object, as defined by the collection schema. Use the list collection properties operation to check the collection schema.
When adding objects from an external system that uses UUID IDs, you can include the object IDs in the request to set the IDs in Vault. For example, "id","463a83d0-a816-4902-abba-2486e0c0a0bb"
. Vault normalizes the IDs to lowercase.
If the objects to add are exported from an external system or Vault:
- set
import
totrue
to import values for the built-in properties_creation_time
,_modification_time
, and_expiration_time
. - if the data is encrypted, to decrypt the data provide the encryption key in
export_key
.
If any object add fails, the operation fails and no objects are added.
The maximum number of objects that can be added in one operation is determined by the PVAULT_SERVICE_MAX_PAGE_SIZE
environment variable.
See the add object operation to add an object to a collection.
The role performing this operation must have both of the following:
- The
CapDataWriter
or theCapDataCreator
capability. - For each object in the request, at least one allowing policy and no denying policies for the
write
operation for each object property.
See identity and access management for more information about how capabilities are used to control access to operations and policies are used to control access to data.
Request
Header parameters
X-Tenant-Id
- array of stringsList of tenant IDs to enforce on the request.
Path parameters
collection
- string required*The name of a collection.
Query parameters
adhoc_reason
- stringAn ad-hoc reason for accessing the Vault data. Required when
reason
is set toOther
.reason
- string required*Details of the reason for requesting the property. The default is set when no access reason is provided and PVAULT_SERVICE_FORCE_ACCESS_REASON is false.
custom_audit
- stringCustom audit information to be included in the audit log.
reload_cache
- booleanReloads the cache before the action.
expiration_secs
- stringObject expiration time in seconds, cannot be set to 0. If not set, the default value is used. See the
PVAULT_EXPIRATION_ASSOCIATED_OBJECTS
andPVAULT_EXPIRATION_UNASSOCIATED_OBJECTS
environment variables. If set to an empty value, the objects will be marked to not expire.import
- booleanWhether to write built-in property values.
export_key
- stringThe encrypted copy of the key used to encrypt exported data. The key is encrypted using the export KMS key defined by the
PVAULT_KMS_EXPORT_URI
orPVAULT_KMS_EXPORT_SEED
environment variables. When importing data, the key is decrypted by the KMS, then used to decrypt the data. This parameter is not intended to be used manually, but through the CLI commandpvault import
.
Request body
List of objects to add. The order of the objects in this array is preserved in the response.
- application/json
List of objects to add.
Each object:A list of maps of object properties and their values.
{
"date_of_birth": "1993-02-22",
"email": "patfar@example.com",
"first_name": "Pat",
"last_name": "Far",
"phone_number": "+11011010101"
}
[
{
"date_of_birth": "1993-02-22",
"email": "patfar@example.com",
"first_name": "Pat",
"last_name": "Far",
"phone_number": "+11011010101"
},
{
"date_of_birth": "1994-12-03",
"email": "ronfar@example.com",
"first_name": "Ron",
"last_name": "Far",
"phone_number": "+19099090909"
}
]
[
{
"date_of_birth": "1993-02-22",
"email": "patfar@example.com",
"first_name": "Pat",
"last_name": "Far",
"phone_number": "+11011010101"
},
{
"date_of_birth": "1994-12-03",
"email": "ronfar@example.com",
"first_name": "Ron",
"last_name": "Far",
"phone_number": "+19099090909"
}
]
Possible responses
- 200
- 400
- 401
- 403
- 404
- 405
- 409
- 410
- 500
- 503
The bulk operation is successful. This status doesn't indicate that the operation is successful for all objects. Check the response body for details of the status of each object.
- application/json
ok
- boolean required*Indicates whether the operation was completed successfully for all objects in the bulk operation. If the operation failed for one or more of the provided objects, this property will be set to
false
.results
- array of objects required*An array of objects representing the processing result of each item in the bulk operation. The order of the objects in the array will match the order of the objects in the request.
Each object:A result object representing the processing result of a single object in the bulk operation. Each result object includes the following fields:
ok
field is a boolean that indicates whether the operation completed successfully for the object.id
field is the unique identifier for the processed object. This field might be omitted if the operation failed before anid
was assigned to the object.error
field is present whenok
isfalse
and provides more information about the error that occurred. Theerror
field follows the same structure as the error objects returned in single object operations.
id
- stringThe unique identifier for the object.
ok
- boolean required*Indicates whether the operation was completed successfully for this object. If
true
, the operation completed successfully. Iffalse
, the operation failed and theerror
field will contain more information.error
- objectcontext
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"ok": false,
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ok": false,
"error": {
"context": {
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
},
"error_code": "PVxxxx",
"message": "The object is not found.",
"error_url": "https://docs.piiano.com/api/error-codes#PV1005"
}
}
]
}
The request is invalid.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1001",
"message": "The access reason is missing.",
"context": {
"reason": null
}
}
Authentication credentials are incorrect or missing.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1005",
"message": "The request is unauthorized.",
"context": {}
}
The caller doesn't have the required access rights.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1007",
"message": "The operation is forbidden due to missing capabilities.",
"context": {
"username": "WebServer"
}
}
The collection or properties is not found.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"context": {
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
},
"error_code": "PVxxxx",
"message": "The object is not found.",
"error_url": "https://docs.piiano.com/api/error-codes#PV1005"
}
The operation is not allowed.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1026",
"message": "The operation is not allowed in in-memory mode.",
"context": {}
}
A conflict occurs.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV3218",
"message": "Concurrent conflicting updates to the same object.",
"context": {}
}
Access to a resource that is no longer available occurs.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1033",
"message": "The resource is gone.",
"context": {}
}
An error occurs on the server.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1000",
"message": "Something went wrong",
"context": {}
}
The service is unavailable.
- application/json
context
- object required*The error context.
Values of additional properties are stringsExample{
"objectid": "b56dd6aa-35f0-11ed-a261-0242ac120002"
}error_code
- string required*The error code.
message
- string required*The error message.
error_url
- stringThe URL to the error documentation.
{
"error_code": "PV1009",
"message": "The operation timed out on the server.",
"context": {}
}
Path parameters
Query parameters
Headers
Request body
Code examples