Retrieve a collection
Learn how to retrieve a collection
During development, you may need to change Vault collections to store new properties, remove properties that are no longer needed, or update properties’ attributes. You may need to know what properties are in the collection to construct queries or add objects.
You get the details of a collection using the REST API or CLI. The collection schema includes information such as the collection name, type, a list of properties, and metadata such as creation and modification time. The metadata includes built-in properties that are added as part of the schema prototype.
Get a collection schema
Overview
The steps you take to get the collection are:
- Determine the collection you want to retrieve.
- Use the CLI get a collection command or the REST API get collection operation, passing the collection name and type of output required.
Step-by-step
You want to get the details of the ‘buyers’ collection you created in Create a collection.
You have two choices of how the collection details are presented:
- PVSchema
- JSON
Get the collection with PVschema output
With the CLI, run this command:
pvault collection get --collection buyers
You get a response similar to this:
buyers PERSONS (
address ADDRESS,
email EMAIL UNIQUE,
name NAME SUBSTRING_INDEX,
phone_number PHONE_NUMBER NULL
);
Get the collection with JSON format output
To get the collection details in JSON format, with the CLI, run this command:
pvault collection get --collection buyers --json
You get a response similar to this:
{
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z",
"name": "buyers",
"properties": [
{
"creation_time": "2022-07-16T16:28:37.182702796Z",
"data_type_name": "ADDRESS",
"description": "",
"is_builtin": false,
"is_encrypted": true,
"is_index": false,
"is_nullable": false,
"is_readonly": false,
"is_substring_index": false,
"is_unique": false,
"modification_time": "2022-07-16T16:28:37.182702796Z",
"name": "address"
},
{
"creation_time": "2022-07-16T16:28:37.182702796Z",
"data_type_name": "EMAIL",
"description": "",
"is_builtin": false,
"is_encrypted": true,
"is_index": false,
"is_nullable": false,
"is_readonly": false,
"is_substring_index": false,
"is_unique": true,
"modification_time": "2022-07-16T16:28:37.182702796Z",
"name": "email"
},
{
"creation_time": "2022-07-16T16:28:37.182702796Z",
"data_type_name": "NAME",
"description": "",
"is_builtin": false,
"is_encrypted": true,
"is_index": false,
"is_nullable": false,
"is_readonly": false,
"is_substring_index": true,
"is_unique": false,
"modification_time": "2022-07-16T16:28:37.182702796Z",
"name": "name"
},
{
"creation_time": "2022-07-16T16:28:37.182702796Z",
"data_type_name": "PHONE_NUMBER",
"description": "",
"is_builtin": false,
"is_encrypted": true,
"is_index": false,
"is_nullable": true,
"is_readonly": false,
"is_substring_index": false,
"is_unique": false,
"modification_time": "2022-07-16T16:28:37.182702796Z",
"name": "phone_number"
}
],
"type": "PERSONS"
}