Manage users using Graph API
Query a logged-in user
See also how to use /user/info
under OAuth 2.0 / OpenID Connect. It’s a limited but “standard” approach to query a logged-in user’s information.
URL | Description |
---|---|
/graph/me() |
The preconfigured version of the logged-in user query using a flat/compact response JSON. |
/graph/me |
The generic version of the logged-in user query using the default 10Duke SDK2 JSON format. |
/graph/me.jwt |
A variant that queries the logged-in user and the response is a signed JSON web token (JWT). |
Query a user profile
A graph query to retrieve a user profile by id.
GET /graph/Profile[@id='profile id']
Query a user by preconfigured id query
Includes the contact information and response in a flat compact form.
GET /graph/profile('profile id')
Query a user with related information
Reads the user profile with related person and contact information.
GET /graph/Profile[@id='profileid']?/~ManyToOne/Person&/~OneToMany/ContactInformation/~OneToMany/EmailAddress
Note: We recommend using this type of a call variant when the client application is in a CRUD cycle. The client application may want to include more related objects depending on the case.
Preconfigured named query to request a user profile by email address
GET /graph/emailAndProfile('email address')
Query a user with “most” related objects
This query asks for a user profile including Person, all ContactInformation and Recovery EmailAddress objects as relations.
GET /graph/me?/~ManyToOne/Person&/~OneToMany/ContactInformation/~OneToMany/EmailAddress&/~OneToMany/ContactInformation/~OneToMany/TelephoneNumber&/~OneToMany/ContactInformation/~OneToMany/PostalAddress&/~OneToMany/RecoveryEmailAddress
Query a user’s recovery email addresses
GET /graph/me/~OneToMany/RecoveryEmailAddress
Register a user
POST /graph?operation=RegisterUser
Content-Type: application/json
{
"__objType": "Profile",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PERSON_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Person_id"
}
}]
},
"nickname": "${NICK_NAME}",
"id": "${PROFILE_ID}",
"rel_Relations": [{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "MANY_TO_ONE",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.identity.Person"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "Person",
"lastName": "${LAST_NAME}",
"firstName": "${FIRST_NAME}",
"id": "${PERSON_ID}",
"rel_Relations": [{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.credential.EmailAndPassword"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "EmailAndPassword",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PERSON_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Person_id"
}
}]
},
"userName": "${EMAIL}",
"id": "${CREDENTIAL_ID}",
"passwordPlain": "${PASSWORD}"
}]
}
}]
}]
}
},{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.identity.Account"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "Account",
"accountType": "personal",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PROFILE_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Profile_id"
}
}]
},
"accountIdentifier": "${ACCOUNT_ID}",
"id": "${ACCOUNT_ID}"
}]
}
}, {
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.ContactInformation"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "ContactInformation",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PROFILE_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Profile_id"
}
}]
},
"id": "${CONTACT_INFO_ID}",
"rel_Relations": [{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.PostalAddress"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "PostalAddress",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${CONTACT_INFO_ID}"
},
"key": {
"__objType": "String",
"value": "ref_ContactInformation_id"
}
}]
},
"countryCode": "$COUNTRY_CODE",
"streetAddress2": "street 2",
"streetAddress3": "street 2",
"streetAddress": "street 1",
"city": "Vantaa",
"postalCode": "007",
"id": "${POSTAL_ADDRESS_ID}"
}]
}
}, {
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.EmailAddress"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "EmailAddress",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${CONTACT_INFO_ID}"
},
"key": {
"__objType": "String",
"value": "ref_ContactInformation_id"
}
}]
},
"id": "${EMAIL_ID}",
"value": "${EMAIL}"
}]
}
}]
}]
}
}]
}
Update a user
(If you missed it, check out the introduction to updating objects.)
Note: Make sure to retain object and reference identifiers logically, so that updating data doesn’t introduce duplicate objects into a graph (or switch a reference from an existing object to a new one, creating “ghost” objects). Look for the pattern
${..._ID}
in the JSON below.
PUT /graph
Content-Type: application/json
{
"__objType": "Profile",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PERSON_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Person_id"
}
}]
},
"nickname": "${NICK_NAME}",
"id": "${PROFILE_ID}",
"rel_Relations": [{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "MANY_TO_ONE",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.identity.Person"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "Person",
"lastName": "${LAST_NAME}",
"firstName": "${FIRST_NAME}",
"id": "${PERSON_ID}",
"rel_Relations": []
}]
}
}, {
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.ContactInformation"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "ContactInformation",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${PROFILE_ID}"
},
"key": {
"__objType": "String",
"value": "ref_Profile_id"
}
}]
},
"id": "${CONTACT_INFO_ID}",
"rel_Relations": [{
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.PostalAddress"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "PostalAddress",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${CONTACT_INFO_ID}"
},
"key": {
"__objType": "String",
"value": "ref_ContactInformation_id"
}
}]
},
"countryCode": "$COUNTRY_CODE",
"id": "${POSTAL_ADDRESS_ID}"
}]
}
}, {
"rel_Relation": {
"__objType": "ObjectRelation",
"multiplicity": "ONE_TO_MANY",
"relatedObjectType": "com.tenduke.sdk2.objectmodel.contact.EmailAddress"
},
"rel_RelatedObjectList": {
"__objType": "RelatedObjectList",
"rel_RelatedObjects": [{
"__objType": "EmailAddress",
"referenceFields": {
"__objType": "HashMap",
"Entries": [{
"__objType": "KeyValue",
"value": {
"__objType": "UUID",
"value": "${CONTACT_INFO_ID}"
},
"key": {
"__objType": "String",
"value": "ref_ContactInformation_id"
}
}]
},
"id": "${EMAIL_ID}",
"value": "${EMAIL}"
}]
}
}]
}]
}
}]
}
Change login email
POST /graph
Content-Type: application/x-www-form-urlencoded
operation=ChangeLoginEmail&profileId=[PROFILE_ID]&recoveryEmailId=[EMAIL_ID]
Response:
{
"__objType": "ChangeLoginEmailResult",
"resultCode": "Success"
}
Change contact email
POST /graph
Content-Type: application/x-www-form-urlencoded
operation=ChangeContactInfoEmail&profileId=[PROFILE_ID]&recoveryEmailId=[EMAIL_ID]
Response:
{
"__objType": "ChangeContactInfoEmailResult",
"resultCode": "Success"
}