Member photos

A loyalty member may upload a photo to use as their profile image.

Member photo requirements

The photo file size limit and required dimensions are configured in Loyalty and returned by GetMasterData endpoint:

  • The maximumFileSizeInKilobytes specifies the upper-bound on the photo file size.
  • The dimensions are the exact width and height requirements for new member photos.
  • The minimumDaysBetweenUpdates indicates the minimum number of days a member must wait between photo updates.

The supported photo file formats are JPEG, BMP, PNG, HEIC, and WebP.

Copy
Copied
{
  "photoRequirements": {
    "dimensions": {
      "width": 0,
      "height": 0
    },
    "maximumFileSizeInKilobytes": 0,
    "minimumDaysBetweenUpdates": 0
  }
}
NOTE

Some properties have been omitted from the code snippet above for brevity.

Member photo update restrictions

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.

Get current member photo

Use the GetCurrentMember endpoint to get the authenticated member's current photo.

Copy
Copied
{
  "member": {
    "id": "string",
    "hash": "string",
    "photo": {
      "isUpdatable": true,
      "canBeUpdatedAt": "2019-08-24T14:15:22Z",
      "uriExpiresAt": "2019-08-24T14:15:22Z",
      "uri": "http://example.com"
    }
  }
}
NOTE

Some properties have been omitted from the code snippet above for brevity.

Update member photo

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:

Copy
Copied
PUT /ocapi/v1/members/current/photo HTTP 1.1

Content-Disposition: form-data; name="MemberPhoto"; filename={fileName}
Content-Type: {contentType}

{imageData}