How to Add a Comment
AnsweredIve been at this for too long with no success ... hence the messy code ...
Im trying to add a comment to the item with "ref_id" produced from the below code of an item creation:
$item->save();
return $item; <<------ Products my ref_id
my code for adding:
function createComment($refid,$comment,$emailFrom,$vbDate)
{
$comment = new PodioComment('item',$refid,array('value'=> $emailFrom.' wrote on '.$vbdate.':'.ltrim($comment,400)));
}
Im definitely doing something wrong..this is the last part of my code i cant get right..
thanks
-
PodioComment objects does not currently have a save method, so you have to use the static method for sending values to the API. Merely creating an object does not send any data to the API. Some details around making API requests: http://podio.github.io/podio-php/api-requests/
To create a comment:
PodioComment::create('item', $item_id, array('value'=> $emailFrom.' wrote on '.$vbdate.':'.ltrim($comment,400)));
-
Using that method i got the following error.
Fatal error: Uncaught PodioForbiddenError: "The user with id #### does not have the right comment on item with id 173019127" Request URL: http://api.podio.com/comment/item/##### Stack Trace: #0 /home/public_html/podiophp/lib/Podio.php(293): Podio::request('POST', '/comment/item/1...', Array, Array) #1 /home/public_html/podiophp/models/PodioComment.php(52): Podio::post('/comment/item/1...', Array) #2 /home/public_html/podiophp/emailtoticket.php(94): PodioComment::create('item', '173019127', Array) #3 /home/public_html/podiophp/emailtoticket.php(33): createComment('######', 'Yes i will be w...', '*@*...', '2014-07-06 12:0...') #4 {main} thrown in /home/public_html/podiophp/lib/Podio.php on line 260
-
Check carefully if the comment is incorrect. If the comment is incorrect, revise it.cheap women's briefs provide。
Please sign in to leave a comment.
Comments
7 comments