Graphql
Alfresco API
Alfresco people search and file uploads via GraphQL
Alfresco has the possibility to search for known users. Those users may be synchronized from a LDAP directory.
retrieve a single person via the Alfresco API
graphql
query FindAlfrescoPerson {
alfrescoPerson(id: "mmustermann") {
id
cn
firstName
lastName
fullName
email
organizationalUnit
enabled
emailNotificationsEnabled
avatarId
absent
}
}
retrieve multiple persons via the Alfresco API
graphql
query SearchAlfrescoPersons {
alfrescoPersons(where: { q: "mustermann" }, paging: { limit: 5 }, sort: { by: lastName }) {
nodes {
id
cn
firstName
lastName
fullName
email
organizationalUnit
enabled
emailNotificationsEnabled
avatarId
absent
}
}
}
Profile avatar upload (@alfrescoWebscript, multipart)
Uploads hit the Alfresco repository webscript with the usual ticket (alf_ticket), not Alfresco Share in the browser. On the field definition, set bodyType: multipart.
Requirements
- Valid ticket for the user who owns the avatar.
usernamein the payload = Alfresco person id (cm:userName); must match the ticket user (the webscript enforces this).
Example (schema extension name may differ, e.g. Aquanet uploadAvatar):
graphql
mutation UploadAvatar {
uploadAvatar(
payload: {
fileBase64: "<base64 or data:image/jpeg;base64,...>"
filename: "photo.jpg"
username: "mmustermann"
}
) {
fileName
nodeRef
status {
code
name
}
}
}
Other upload webscripts: Declare a mutation with @alfrescoWebscript(endpoint: "…", method: post, bodyType: multipart) and a payload that matches your script (see internal Technical doc: file uploads / Alfresco multipart).