Tucia API > Callback Instructions


Assign a callback URL when you generate Tucia API keys, so that we will send you important notifications, e.g., when your photo is edited for review. Callbacks are the most efficient way to get the latest information about your orders.

Callback notifications are sent when:

  1. a photo is edited for review
  2. a new comment is posted to a photo from our staff

Parameters to callbacks are formatted in JSON and submitted with a POST call.

When a photo is edited for review, a JSONed parameter named "order_update" will be POSTed as if it was a response. This is an example of how to process the parameter in PHP:

<?php
    if (isset($_POST['order_update'])) {
        $json_data = $_POST['order_update']; 
    } else {
        $json_data = false;
    }

    if ($json_data) {
        $data = json_decode($json_data, true);
        if(is_array($data))
        {
            $order_id = $data['order_id'];
            $status = $data['status'];
            $credits = $data['credits'];
            $edited_photos = $data['edited_photos']; //array()
            
            // do stuff ...
        }
    }
?>

When a new comment is posted to a photo from our staff, a JSONed parameter named "new_comment" will be POSTed as if it was a response. This is an example of how to process the parameter in PHP:

<?php
    if (isset($_POST['new_comment'])) {
        $json_data = $_POST['new_comment']; 
    } else {
        $json_data = false;
    }

    if ($json_data) {
        $data = json_decode($json_data, true);

        if(is_array($data))
        {
            $order_id = $data['order_id'];
            $comment_body = $data['comment_body'];
            $comment_time = $data['comment_time'];
            $comment_from = $data['comment_from'];

            // do stuff ...
        }
    }
?>