get-guest-photos-by-bib

Use this API to get all photos of a guest from a bib enabled event using bib number

Use this API to get all photos of a guest from a bib-enabled event using BIB

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

Headers

Name
Type
Description

Authorization *

YOUR_SECRET_KEY

x-api-key*

String

YOUR_API_KEY

Request Body

Name
Type
Description

event_id*

String

4296

bib_number*

String

A unique identifier assigned to each participant in the event. Typically displayed on a participant’s bib (race number) for easy identification during the event.

index_id

Integer

Used for pagination to retrieve the next set of images. Include the index_id from the previous API response to fetch the subsequent batch.

{
    "bib_session_id": 567748,
    "collection_object": [
        {
            "thumb_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/thumbnail/testPradInter904/al11444_al0_20210817_124308.jpg",
            "large_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/testPradInter904/al11444_al0_20210817_124308.jpg",
            "highres_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/testPradInter904/highres/al11444_al0_20210817_124308.jpg",
            "image_name": "al11444_al0_20210817_124308.jpg"
        },
        {
            "thumb_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/thumbnail/testPradInter904/al4220_20210817_124155.jpg",
            "large_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/testPradInter904/al4220_20210817_124155.jpg",
            "highres_image": "https://snapwrap-data.s3.ap-south-1.amazonaws.com/testPradInter904/highres/al4220_20210817_124155.jpg",
            "image_name": "al4220_20210817_124155.jpg"
        }
    ],
    "collection_count": 2,
    "index_id": 0,
    "error": false,
    "message": "success"
}
Sample Request
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api.memzo.ai/v1/get-guest-photos-by-bib',
  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' => '2287','bib_number' => '100'),
  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 it appropriately by checking the message field for details.

  • Implement retry logic for network-related errors such as timeouts or server unavailability. This ensures resilience in case of intermittent failures.

2. Response Handling

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

  • Verify the presence of key fields, such as:

    • collection_object for the list of images.

    • collection_count to confirm the number of images retrieved.

  • Use images according to user needs (e.g., thumbnails for previews, high-resolution images for full-screen or downloads).

3. Data Storage and Caching

  • To reduce redundant API calls and improve efficiency, store the API response in your database after the first successful call.

  • Subsequent user requests should fetch data from your local database instead of making repeated calls to the API.

  • Implement logic to periodically refresh the stored data or clear the cache based on the data lifecycle.

4. Data Validation

  • Validate input parameters like event_id and bib_number before making API requests.

  • Check that the API response contains valid data types and structures, ensuring that key fields are not missing or malformed.

5. 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