get-guest-photos

Use this API to get all photos of a guest from an event

Use this API to get all photos of a guest from an event

POST https://api.memzo.ai/v1/get-guest-photos/

Headers

Name
Type
Description

Authorization *

YOUR_SECRET_KEY

x-api-key*

String

YOUR_API_KEY

Request Body

Name
Type
Description

event_id*

String

4296

guest_image*

File

{
  "error": false,
  "message": "success",
  "data": [
    {
      "event_id": "4296",
      "event_name": "WhiteLabel-Test-Event5449",
      "event_title": "Whitelabel Event",
      "event_image_url": "https://snapwrap.io/default.png",
      "p90": "al0_20210817_124554.jpg,al0_IMG_20190825_085015.jpg",
      "all_photos_count": "2"
    }
  ],
  "collection_object": [
    {
      "thumb_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/thumbnail/WhiteLabel-Test-Event5449/al0_20210817_124554.jpg",
      "large_image": "https://snapwrap.s3.ap-south-1.amazonaws.com/WhiteLabel-Test-Event5449/al0_20210817_124554.jpg",
      "highres_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/highres/WhiteLabel-Test-Event5449/al0_20210817_124554.jpg",
      "image_name": "al0_20210817_124554.jpg"
    },
    {
      "thumb_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/thumbnail/WhiteLabel-Test-Event5449/al0_IMG_20190825_085015.jpg",
      "large_image": "https://snapwrap.s3.ap-south-1.amazonaws.com/WhiteLabel-Test-Event5449/al0_IMG_20190825_085015.jpg",
      "highres_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/highres/WhiteLabel-Test-Event5449/al0_IMG_20190825_085015.jpg",
      "image_name": "al0_IMG_20190825_085015.jpg"
    }
  ],
  "collection_count": 2,
  "index_id": 0
}
Sample Request
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.memzo.ai/v1/get-guest-photos',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS => array('event_id' => '4296','guest_image'=> new CURLFILE('cmynsG-zO/1640686506553454.jpg')),
  CURLOPT_HTTPHEADER => array(
    'Authorization: YOUR_SECRET_KEY',
    'x-api-key: YOUR_API_KEY'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Best Practices

1. Error Handling

  • Always check the error field in the API response:

    • Ensure it is false before processing the data.

    • If error is true, handle the error by reviewing the message field for detailed information.

  • Implement retry logic to handle network-related errors like timeouts, server unavailability, or connectivity issues.

2. Response Handling

  • Parse the API response carefully to ensure it matches the expected structure:

    • Verify that the data and collection_object fields are present.

    • Check the collection_count field to confirm how many images were retrieved.

  • Use image URLs appropriately based on the user's needs:

    • thumb_image for previews and thumbnails.

    • large_image or highres_image for full-resolution or downloads, depending on bandwidth and device capability.

3. Data Storage and Caching

  • To optimize performance and reduce API call frequency, store the response data in your database after the first successful call.

  • For subsequent user requests, retrieve the stored data from your database instead of making additional API requests.

  • Implement cache invalidation or refreshing logic based on data freshness requirements.

4. Data Validation

  • Validate input parameters like event_id and ensure the guest image file is valid and correctly uploaded using CURLFILE before sending the request.

  • Validate that the API response contains properly structured data and valid URLs.

5. File Upload Handling

  • When integrating with the API, ensure the guest image file (guest_image) is correctly referenced and uploaded as a file in the POST request.

  • Ensure the file is sent in a format that API supports, typically using multipart form-data.

  • Handle any potential file upload errors and provide clear feedback to the user if the upload fails.

6. Pagination Support

  • The API supports pagination using the index_id field; each page contains 20 items. Implement the logic to request additional images in sequence, using the index_id from the API response to retrieve the next set of images.

  • Ensure that the logic accommodates the page_size of 20 items per request. Implement functionality to retrieve further data or resume from a specific session using the index_id.

For more detailed information, please refer to the full Postman documentation here.

Last updated