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!

Profile Service (python)

Wrapper for the '/user/{userId}/profile' API. Cannot be used with the Management API. (OIDC Client only)

List of all options:

  • Get profile fields
  • Update profile fields

Profile management

from trivoreid.models.profile import Profile
from trivoreid.models.email import EmailAddress
from trivoreid.models.user import (Names, Mobile, Address)

profile = api.profile_service.get()

print('\nProfile fields : {} \n'.format(profile.serialize()))

profile.name.givenName = 'First Name'
profile.name.middleName = 'Middle Name'
profile.name.familyName = 'Last Name'

profile.addresses[0].country = 'FI'
profile.addresses.append(Address({'addressName' : 'address',
							   'name' : 'home',
							   'country' : 'Finland',
							   'locality' : 'fi',
							   'postalCode' : '20750',
							   'region' : 'Region',
							   'streetAddress' : 'Street Address 5C'
							   }))

profile.emails[0].name = 'home'
profile.emails.append(EmailAddress({'address' : 'example2@trivore.com',
						  			'name' : 'work'}))

mobile = Mobile()
mobile.number = '+358401234568'
mobile.name = 'work'
profile.mobiles.append(mobile)

api.profile_service.update(profile)

profile2 = api.profile_service.get()

print('\nProfile fields : {} \n'.format(profile2.serialize()))
 Output
INFO:root:Found profile with user id exampleId

Profile fields : {'dateOfBirth': None,
'nickName': None,
'emails': [],
'mobiles': [],
'name': {'givenName': None, 'middleName': None, 'familyName': None},
'locale': None,
'addresses': [],
'legalAddresses': []}

INFO:root:Successfully modified profile with the user id 5caaf19f3874e17d6ee45843

INFO:root:Found profile with user id exampleId

Profile fields : {'dateOfBirth': '1994-01-01',
'nickName': None,
'emails': [{'address': 'example1@trivore.com', 'verified': False},
{'address': 'example2@trivore.com', 'verified': False}],
'mobiles': [{'number': '+35840123654', 'verified': False},
{'number': '+35840123456', 'verified': False}],
'name': {'givenName': 'First Name',
'middleName': 'Middle Name',
'familyName': 'Last Name'},
'locale': None,
'addresses': [{'addressName': 'address',
'name': 'home',
'country': 'Finland',
'locality': 'fi',
'postalCode': '20750',
'region': 'Region',
'streetAddress': 'Street Address 5C'}],
'legalAddresses': []}

Profile Service Models

/wiki/spaces/TISpubdoc/pages/20515246

/wiki/spaces/TISpubdoc/pages/20515253

/wiki/spaces/TISpubdoc/pages/20515254

/wiki/spaces/TISpubdoc/pages/20515250

/wiki/spaces/TISpubdoc/pages/20515276

/wiki/spaces/TISpubdoc/pages/20515251

NOTE: Trivore ID Documentation has moved to https://trivoreid.com

The content on this site IS OUT OF DATE!

This space has been archived!