Dariusz Kobylarz
unread,May 7, 2008, 1:06:30 PM5/7/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ASAPI Developers
Hello,
today I found a simple workaround for the problem with PUT request.
Originally PUT request in cURL library supports file streams in the
request body only.
The snippet below shows how to make put requests with a string
instead of a file stream:
$memeForm = "{\"meme\":{\"umis\":\"" . $createdMemeUMIS .... "\",\"name
\":\"UPDATE_MemeTest" ... //quite long meme representation
// Get the curl session object
$session = curl_init($updateMemeURL);
curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($session, CURLOPT_HEADER, true);
curl_setopt($session, CURLOPT_POSTFIELDS, $memeForm);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// USE CUSTOM EXEC
$response = execute($session);
curl_close($session);
In comparison with the example php script, the only difference is
using:
curl_setopt($session, CURLOPT_CUSTOMREQUEST, 'PUT');
instead of:
curl_setopt ($session, CURLOPT_PUT, true);
Another issue, not mentioned in asapi restful interface documentation,
is the "umis" field populated in the entity representation that is to
be updated. That field is obviously ignored when creating an entity of
any type (meme,annotation,etc.).
Dariusz Kobylarz