1

I am Trying to Submit/Create new Leads[data] in Vtiger via Web service in Laravel 5. For that I use WSClient in Laravel.

My Code is in Controller is :

$url = http://xxxx.com;
        $config = [
            'auth' => [
                'username' => 'xxxx',
                'accesskey' => 'xxxx'
            ],
            'testing' => []
        ];
        $wsclient = new WSClient($url, $config);
        $create = $wsclient->createObject('Leads', array(
            'firstname' => 'My Firstname',
            'lastname'=>'My Lastname',
            'phone'=>'MyPhone',
            'email'=>'email@email.com',
            'description'=> 'abcdabcd123',
            'assigned_user_id'=>1,
        ));

It Works Fine when I just Create Leads. But Now I need to Submit File in Leads Document So I use follow Code But Not Works

$create = $wsclient->createObject('Documents', array(
            'notes_title' => 'Leads Pdf File',
            'file'=>'http://website/pdffile.pdf',
            'assigned_user_id'=>1,
        ));

It Works But File not Uploads

How can I Submit File in Leads Document in Vtiger by Web services from Laravel by WSClinet ?

Mojilo
  • 335
  • 1
  • 3
  • 7

1 Answers1

1

Your code is correct but currently Vtiger web services do not offer the possibility to upload the file on the server.

If you have the file hosted on your server you can create the document as:

$create = $wsclient->createObject('Documents', array(
        'notes_title' => 'Leads Pdf File',
        'file'=>'http://website/pdffile.pdf',
        'filelocationtype' => 'External', //This will create a link to your server from the crm
        'assigned_user_id'=>1,
    ));

Or you can extend Vtiger webservices code so it's download and import the file.

Conrado
  • 11
  • 1