/
Namespace Service (python)
NOTE: Trivore ID Documentation has moved to https://trivoreid.com
The content on this site IS OUT OF DATE!
This space has been archived!
Please go ahead to the new site!
Namespace Service (python)
Wrapper for '/namespace' API.
List of all options
Get list of namespaces
Create/get one/modify namespace
Get and filter list of namespaces
from trivoreid.utils.criteria import Filter
fil = Filter(Filter.CONTAINS, 'code', 'sdk')
ns = api.namespace_service.get_all(filter_fields=fil).resources
print(ns[0].serialize())
Namespace management
from trivoreid.models.namespace import UsernamePolicy, Namespace
ns_to_create = Namespace()
ns_to_create.code = 'examplecode'
ns_to_create.name = 'Example Name'
ns_to_create.shortName = 'Example Name'
ns_to_create.usernamePolicy = UsernamePolicy.EMAIL
namespace = api.namespace_service.create(ns_to_create)
namespace.usernamePolicy = UsernamePolicy.EIGHT_NUMBERS
# Disable sending SMS messages
namespace.smsSettings.enabled = False
api.namespace_service.update(namespace)
namespace2 = api.namespace_service.get(idOrCode='examplecode')