List collections
Learn how to list the collections in Piiano Vault
Almost all Vault operations require a collection name in their input. To discover what collections are in a vault, list the collections using the CLI or the REST API.
Overview
To list all collections, you:
- Determine the level and type of detail you want in your list.
- Use the CLI list collections command or the REST API list collections operation.
List collection names using the CLI
You request a list of all collections using the CLI like this:
pvault collection list
You get a response similar to this:
+-------------------------------+-------------------------------+--------------+---------+
| creation_time | modification_time | name | type |
+-------------------------------+-------------------------------+--------------+---------+
| Wed, 20 Mar 2024 01:46:04 UTC | Wed, 20 Mar 2024 01:46:04 UTC | buyers | PERSONS |
| Wed, 20 Mar 2024 01:57:18 UTC | Wed, 20 Mar 2024 01:57:18 UTC | credit_cards | DATA |
+-------------------------------+-------------------------------+--------------+---------+
List collections and their properties using the CLI
You can request a list of all collections with details of all the properties in each collection using the CLI. You have two choices: obtain the result in JSON or PVSchema format using the --json
and --pvschema
flags. For example, as JSON output is the default, you retrieve the details in PVSchema format like this:
pvault collection list --pvschema
You get a response similar to this:
buyers PERSONS (
address ADDRESS,
email EMAIL UNIQUE,
name NAME,
phone_number PHONE_NUMBER NULL
);
credit_cards DATA (
cvv CC_CVV,
expiration CC_EXPIRATION_STRING,
holder_name CC_HOLDER_NAME,
number CC_NUMBER
);
List all collections with the REST API
You can also get the collections list with property details in JSON or PVSchema format using the REST API. Use the format
query parameter with the values pvschema
or json
to determine your desired output. For example, you retrieve the details in JSON format like this:
curl --request GET \
--silent \
--url "http://localhost:8123/api/pvlt/1.0/ctl/collections?reason=Maintenance" \
--header 'Authorization: Bearer pvaultauth' \
--header 'Content-Type: application/json'
You get a response similar to this:
[
{
"type": "PERSONS",
"name": "buyers",
"properties": [
{
"description": "",
"name": "address",
"data_type_name": "ADDRESS",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "email",
"data_type_name": "EMAIL",
"is_unique": true,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "name",
"data_type_name": "NAME",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "phone_number",
"data_type_name": "PHONE_NUMBER",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": true,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
}
],
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"type": "DATA",
"name": "credit_cards",
"properties": [
{
"description": "",
"name": "cvv",
"data_type_name": "CC_CVV",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "expiration",
"data_type_name": "CC_EXPIRATION_STRING",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "holder_name",
"data_type_name": "CC_HOLDER_NAME",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
},
{
"description": "",
"name": "number",
"data_type_name": "CC_NUMBER",
"is_unique": false,
"is_index": false,
"is_substring_index": false,
"is_encrypted": true,
"is_nullable": false,
"is_builtin": false,
"is_readonly": false,
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
}
],
"creation_time": "2022-07-16T16:28:37.182702796Z",
"modification_time": "2022-07-16T16:28:37.182702796Z"
}
]