Example Application: REST 101 Use Key Authentication
Your public VOV key must be registered with vovserver before running applications that use key based authentication.
A REST request can be programmed from Python by using method functions for the
VOVRestV3 class in the vov_rest_v3.py module included in
$VOVDIR. Use the authorizeWithKey()
function to authenticate, followed by the submitRequest()
function to issue the REST request.
#
# nc_rest_101_vov_keys.py
#
import os, sys
import vov_rest_v3
url = os.environ['NC_URL']
secret_key = os.environ['MY_SECRET_KEY']
sp_key = os.environ['NC_SERVER_PUBLIC_KEY']
user = os.environ['USER']
vrest2 = vov_rest_v3.VOVRestV3()
vrest2.authorizeWithKey(url, secret_key, sp_key, username=user)
r = vrest2.submitRequest("GET", url + "/api/v3/project/1/project")
print (r)