LESS_THAN_MIN_OCCURANCE

LESS_THAN_MIN_OCCURANCE

Hi everyone,

I've been quite stuck using the Zoho Workdrive API and I was hoping anyone could help me out. Currently I keep getting a LESS_THAN_MIN_OCCURANCE error when trying to upload an image to the Zoho Workdrive API. I am really unsure what this entails and cannot find it anywhere in the documentation.

What I'm trying to do is send an image from the front-end ("logo") to my own API in the form of a request in Laravel. Then this image should be uploaded to a certain folder in Zoho Workdrive via their API. After which we should receive a URL of the newly uploaded image.

So the controller looks like this:
public function store(StoreCompanyRequest $request)
    {
        // Retrieve the uploaded logo file from the request
        $this -> companyService -> uploadLogoToWorkDrive(10, $request->file('logo'));
Where 10 is a companyId to test if we can upload an image in the folder of the company with id 10.

The service looks like this:
public function uploadLogoToWorkDrive($companyId, $image)
    {
        // Get the "Companies" folder from "Maxy"
        $companiesFolderId = $this -> crmRepository -> getEntityTypeFolderIdByRootId();

        // Get the right company id folder from "Companies"
        $companyFolderId = $this -> crmRepository -> getModelFolderIdByModelId($companiesFolderId, $companyId);

        $uploadedImageUrl = $this->crmRepository->uploadImageToWorkDrive($companyFolderId, $image);
        return $uploadedImageUrl;
    }

The repository looks like this:
public function getEntityTypeFolderIdByRootId()
    {
        return ZohoCRM::getFoldersByRootId()[(string)$this->crmEntityType];
    }

    public function getModelFolderIdByModelId($entityTypeFolderId, $modelId)
    {
        return ZohoCRM::getFoldersByRootId($entityTypeFolderId)[(string)$modelId];
    }

    public function uploadImageToWorkDrive($modelFolderId, $image)
    {
        return ZohoCRM::uploadImageToWorkDrive($modelFolderId, $image);
    }
where the entityType is Companies and the model is the specific company folder.

The Zoho Facade looks like this
public static function uploadImageToWorkDrive($modelFolderId, $image)
    {
        // Set the request headers
        $headers = self::getHeaders();

        // Set the URL for the Zoho Workdrive upload API endpoint

        // Prepare the multipart form data
        $postData = [
            'parent_id' => $modelFolderId,
            'content' => $image,
            'filename' => urlencode($image->getClientOriginalName()),
            'override-name-exist' => 'false',
        ];

        // Initialize a new cURL session
        $ch = curl_init();

        // Set the cURL options
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

        // Execute the cURL request
        $response = curl_exec($ch);

        // Get the HTTP status code
        $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

        // Close the cURL session
        curl_close($ch);
        dd($response . $statusCode);
        // Check if the request was successful
        if ($statusCode >= 200 && $statusCode < 300) {
            // Parse the response JSON into an object
            $responseData = json_decode($response, true);

            // Check if the response contains the uploaded file URL
            if (isset($responseData['data']['file_info']['url'])) {
                // Return the URL of the uploaded image
                return $responseData['data']['file_info']['url'];
            } else {
                // If the response does not contain the file URL, throw an exception
                throw new Exception('Error uploading image: Invalid response format');
            }
        } else {
            // If the request was not successful, throw an exception or handle the error accordingly
            throw new Exception('Error uploading image: ' . $response);
        }
    }

But this gives the following statusCode & response: {"errors":[{"id":"F000","title":"LESS_THAN_MIN_OCCURANCE"}]}
500. 

Does anyone know why this happens?