A loyalty member may upload a photo to use as their profile image.
The photo file size limit and required dimensions are configured in Loyalty and returned by GetMasterData endpoint:
- The
maximumFileSizeInKilobytesspecifies the upper-bound on the photo file size. - The
dimensionsare the exact width and height requirements for new member photos. - The
minimumDaysBetweenUpdatesindicates the minimum number of days a member must wait between photo updates.
The supported photo file formats are JPEG, BMP, PNG, HEIC, and WebP.
{
"photoRequirements": {
"dimensions": {
"width": 0,
"height": 0
},
"maximumFileSizeInKilobytes": 0,
"minimumDaysBetweenUpdates": 0
}
}Some properties have been omitted from the code snippet above for brevity.
As per the photo requirements, the minimumDaysBetweenUpdates restricts a member's ability to update their photo.
Preventing frequent photo updates can be used as a countermeasure to prevent misuse of member-only rewards, where photo identification is required.
To check if a member is currently eligible to update their photo, get their current member photo and check the member.photo.isUpdatable and member.photo.canBeUpdatedAt properties.
Use the GetCurrentMember endpoint to get the authenticated member's current photo.
{
"member": {
"id": "string",
"hash": "string",
"photo": {
"isUpdatable": true,
"canBeUpdatedAt": "2019-08-24T14:15:22Z",
"uriExpiresAt": "2019-08-24T14:15:22Z",
"uri": "http://example.com"
}
}
}Some properties have been omitted from the code snippet above for brevity.
The authenticated member's photo can be updated via the SetMemberPhoto endpoint. The photo file must meet the configured photo requirements.
The photo file must be uploaded using an HTTP PUT request, using the following format:
PUT /ocapi/v1/members/current/photo HTTP 1.1
Content-Disposition: form-data; name="MemberPhoto"; filename={fileName}
Content-Type: {contentType}
{imageData}