A Python
REST client library for accessing VisualVault
.
pip3 install vvrest
- The
Vault
class handlesauthentication
. - Services mapping to the different
endpoints
live in theservices
namespace. For example if one wishes to interact with the/api/v1/documents
endpoint, then importDocumentService
or for/api/v1/files
importFileService
, etc. - Now credentials need to be defined so
VisualVault
knows who one is. url
is the base url for the instance ofVisualVault
(example below). NOTE: do not leave a trailing '/' at the end of theurl
.customer_alias
anddatabase_alias
are the customer and database one wishes to connect to.client_id
andclient_secret
can be found on the users page in thecentral admin
section ofVisualVault
. The firstAPIKEY
isclient_id
and the secondAPIKEY
is theclient_secret
.- Each service class in
services
takes an instance ofVault
as a required parameter. - The
code example
below demonstrates requestingdocuments
.
from vvrest.vault import Vault
from vvrest.services.document_service import DocumentService
# define credentials
url = 'https://demo.visualvault.com'
customer_alias = 'test_customer'
database_alias = 'test_database'
client_id = '12344b69-cd52-4444-815a-1234ec0fb5ef'
client_secret = 'PouE/GLZ7pjFoqRRyu9L8K3EjTXXdf56sY/FxPaaxxU='
# get vault object (authenticate)
vault = Vault(url, customer_alias, database_alias, client_id, client_secret)
document_service = DocumentService(vault) # instantiate a service class (DocumentService)
documents = document_service.get_documents("folderPath='/test'") # request documents
- documentation coming soon.
- refer to the
VVRestTestSuite
in thetests
directory for more examples.
For more information on any of the endpoints, data types, or anything referring to the
VisualVault
REST API please refer to the HTTP API
section at http://developer.visualvault.com
where each endpoint and there parameters are covered in great detail.
..........................................................
----------------------------------------------------------------------
Ran 58 tests in 72.792s
OK
Name Stmts Miss Cover Missing
----------------------------------------------------------------------
vvrest/__init__.py 0 0 100%
vvrest/constants.py 33 0 100%
vvrest/services/__init__.py 0 0 100%
vvrest/services/auth_service.py 27 0 100%
vvrest/services/document_service.py 93 0 100%
vvrest/services/email_service.py 11 0 100%
vvrest/services/file_service.py 32 5 84% 31-36
vvrest/services/folder_service.py 73 11 85% 99-104, 192-205
vvrest/services/form_service.py 119 16 87% 178-183, 220-225, 234-238, 250, 268
vvrest/services/group_service.py 49 1 98% 17
vvrest/services/index_field_service.py 30 0 100%
vvrest/services/site_service.py 35 0 100%
vvrest/services/user_service.py 46 1 98% 17
vvrest/token.py 5 0 100%
vvrest/utilities.py 8 0 100%
vvrest/vault.py 39 0 100%
----------------------------------------------------------------------
TOTAL 600 34 94% 594 34 94%