update api usage

Do you want to create a native client or integrate with third party applications: webservices are the solution.

Moderators: car031, car031, car031

Posts: 2
Joined: Mon Nov 09, 2015 12:48 am

update api usage

Post by vanmark » Fri Dec 04, 2015 1:14 am

I am new to LogicalDOC.

I am trying to follow the UPDATE function in the DocumentService API using the PHP template.

I don't understand how you are updating a specific document. Isn't the UPDATE function supposed to be a stand alone process. If you are using the 'sid' number, how does the function know which document to update. In the example, there is no 'docid' found.

* ***************/
print_r ( "UPDATE\r\n" );

// Maybe we want to change some metadata informations
$udoc ['title'] = 'PHP Changed Title';
$udoc ['source'] = 'PHP-SOAP';
$udoc ['sourceAuthor'] = 'myself';
$udoc ['sourceDate'] = '2009-06-10';
$udoc ['sourceType'] = 'sourceType';
$udoc ['coverage'] = 'coverage';
$udoc ['language'] = 'en';
$udoc ['tags'] = array ('PHP', 'SOAP', 'webservice' );
$udoc ['sourceId'] = 'sourceId';
$udoc ['object'] = 'object';
$udoc ['recipient'] = 'recipient';
$udoc ['templateName'] = '';
$udoc ['templateFields'] = null;

$cdp = array ('sid' => $sid, 'document' => $udoc ); <---- you are only using the 'sid', which is session id. How do you know what document is being updated?

$result = $documentClient->update ( $cdp );
print_r ( $result );

Maybe I am not understanding how the update works; do you have to read the document first, or, does this only work on a newly created document? The example shows how to create first, then flows down.


Posts: 493
Joined: Tue Apr 20, 2010 8:24 am

Re: update api usage

Post by agaspa » Wed Dec 09, 2015 10:25 am

Hi vanmark,

your are referring to the example Document_CRUD.php in PHP examples.

As you see in the $cdp array there are 2 parameters: $sid and $udoc
$cdp = array ('sid' => $sid, 'document' => $udoc );

The last one is a key value array (a Map)
in which there are all the fields of the document we are updating.

In that particular example there are no errors, what you see in the point you evidenced are just the fields
we want to update, the field id ($udoc['id']) was populated before when we retrieved the document from the repository

Code: Select all

     // We save the document info in order to be able to update it subsequently
    $udoc = (array) $result->document; // convert a stdClass to array
See also the documentation
http://wiki.logicaldoc.com/wiki/Documen ... ocument.29

Posts: 493
Joined: Tue Apr 20, 2010 8:24 am

Re: update api usage

Post by agaspa » Mon Dec 14, 2015 9:29 am

There is an update about this.
Last week we published a new version of the PHP web-service examples for LogicalDOC 7.4.
You can download it from the project on SourceForge https://sourceforge.net/projects/logica ... 0CE%207.4/
Here below I report the direct link
http://sourceforge.net/projects/logical ... p/download


Who is online

Users browsing this forum: No registered users and 1 guest