Zoho V2 API - Having problems with user not set in configuration map? (PHP-SDK)

Zoho V2 API - Having problems with user not set in configuration map? (PHP-SDK)

Hi Zoho,

I am relatively new to the useage of the API and I am trying to get my head around it.

I am currently running a test case to see whether I can get the api to behave the way I intended.

For the sake of simplicity I am an EU client and I am enrolled into my sandbox account at: https://crmsandbox.zoho.eu/crm/org20067752432/tab/Home/begin

I am getting 'Fatal error: Uncaught zcrmsdk\crm\exception\ZCRMException Caused by:'current user should either be set in ZCRMRestClient or in configuration map', if i'm right I've already set this information further down right?

Is there any help I can get? 

My code is below, Thankyou.

<?php
session_start();

require './sdk/vendor/autoload.php';

use zcrmsdk\oauth\ZohoOAuth;
use zcrmsdk\crm\crud\ZCRMInventoryLineItem;
use zcrmsdk\crm\crud\ZCRMJunctionRecord;
use zcrmsdk\crm\crud\ZCRMNote;
use zcrmsdk\crm\crud\ZCRMRecord;
use zcrmsdk\crm\crud\ZCRMTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\users\ZCRMUser;

class Api {

    public function __construct(){
        if(!isset($_SESSION['zoho'])){
            $grantToken = '1000.3e49260f5f48be3c435ba1946abd3dab.873b0b6ad49b2c0152170805f56eef14';
            $configuration = array('Content-Type: application/x-www-form-urlencoded');
            $configuration['code'] = ''.$grantToken.'';
            $configuration['redirect_uri'] = 'http://127.0.0.1/wordpress/0auth2callback';
            $configuration['client_id'] = 'OMITTED';
            $configuration['client_secret'] = 'OMITTED';
            $configuration['sandbox'] = true;
            $configuration['db_port'] = '3306';
            $configuration['db_username'] = 'root';
            $configuration['db_password'] = '';
            $configuration['accounts_url'] = 'https://accounts.zoho.eu';
            $configuration['currentUserEmail'] = 'OMITTED';
            ZCRMRestClient::initialize($configuration);
            $oAuthClient = ZohoOAuth::getClientInstance();
            $oAuthTokens = $oAuthClient->generateAccessToken($grantToken);
            $_SESSION['zoho'] = $oAuthTokens;
            var_dump($_SESSION['zoho']);
            exit;
            var_dump($oAuthTokens);
            header('Location: test.php');
            exit;
            }
    }

    public static function record(){
        $record = ZCRMRestClient::getInstance()->getRecordInstance("{module_api_name}"NULL); // To get record instance
        $record->setFieldValue("Subject""test2312"); // This function use to set FieldApiName and value similar to all other FieldApis and Custom field
        $record->setFieldValue("Account_Name""{account_id}"); // Account Name can be given for a new account, account_id is not mandatory in that case
        /**
         * Following methods are being used only by Inventory modules *
         */

        $lineItem = ZCRMInventoryLineItem::getInstance(null); // To get ZCRMInventoryLineItem instance
        $lineItem->setDescription("Product_description"); // To set line item description
        $lineItem->setDiscount(5); // To set line item discount
        $lineItem->setListPrice(100); // To set line item list price

        $taxInstance1 = ZCRMTax::getInstance("{tax_name}"); // To get ZCRMTax instance
        $taxInstance1->setPercentage(2); // To set tax percentage
        $taxInstance1->setValue(50); // To set tax value
        $lineItem->addLineTax($taxInstance1); // To set line tax to line item

        $taxInstance1 = ZCRMTax::getInstance("{tax_name}");
        $taxInstance1->setPercentage(12);
        $taxInstance1->setValue(50);
        $lineItem->addLineTax($taxInstance1);

        $lineItem->setProduct(ZCRMRecord::getInstance("{module_api_name}""{record_id}")); // To set product to line item
        $lineItem->setQuantity(100); // To set product quantity to this line item

        $record->addLineItem($lineItem);
        /**
         * photo can be uploaded only for certain modules *
         */
        // $record->uploadPhoto("/path/to/file");//to upload a photo of the record
        $trigger=array();//triggers to include
        $lar_id="lar_id";//lead assignment rule id
        $responseIns = $record->create($trigger,$lar_id);//$trigger , $larid optional
        echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
        echo "Status:" . $responseIns->getStatus(); // To get response status
        echo "Message:" . $responseIns->getMessage(); // To get response message
        echo "Code:" . $responseIns->getCode(); // To get status code
        echo "Details:" . json_encode($responseIns->getDetails());
    }

}

$api = new Api;

$_SERVER['user_email_id']= 'OMITTED';

$api->record();
?>

I do apologise if this is in the wrong section/category!