How can I get a task and update with API php? - php

I'm using Podio API PHP to try to update some tasks, I'm using the method PodioTask::get($task_id); as the documentation says, but is not working, I'm receiving the following error message:
The user with id 4654583 does not have the right view on task with id
355
This is the code
$task_id = 355;
$items = PodioTask::get($task_id);
dump_var($items);
Does anybody has the same issue?
In advance, thank you for your help

Related

Stripe webhook: can get event ID but not type

In my webhook when I put $event_id = $event_json->id; I get the event id (example: id:evt_1EJ1NdIcP22cq9aQWsTXf8DY).
However, when I put $event_type = $event_json->type; I am expecting to get
charge.succeeded or charge.failed, instead I am getting customer.source.created.
I've searched the internet up and down, can't find the answer. What should I use to get what type of charge it was (charge.succeeded or charge.failed). Maybe this great community can help me solve this one.

SugarCRM rest API order by not working

I try to sort records returned by the get_entry_list rest api method, and it doesn't working.
Request JSON:
{
"session":"mj95dgk1ldtd2m96u02oj0u3r2",
"module_name":"Accounts",
"query":"accounts.name LIKE 'Air%'",
"order_by":"accounts.name desc",
"offset":0,
"select_fields":[
],
"link_name_to_fields_array":"",
"max_result":100,
"deleted":0,
"favorites":false
}
I'm using api version 4.1.
Results are not sorted even using ASC or DESC sorting method.
Manage to solve the problem based on this link
https://web.sugarcrm.com/support/issues/806c9fb3-6712-abd6-3106-5287d5398699
Proposed fix:
in service/v4/SugarWebServiceUtilv4.php
Around line 89: remove or comment the following line:
$order_by=$seed->process_order_by($order_by, null);
It certainly would be better to fix that in SugarBean.php (process_order_by) where the following test was removed:
if (strchr($value,'.') === false)
it seems like this is bug in sugar crm ( Bug :59526 ) .
order by not working with web service
But you can also fetch the record by creating your own method for Api , i hope this helps !

PHRets using POST

I'm using PHRets and trying to return some search results. Below is the code, which is very basic and should work:
include('../include/common.php');
include('../classes/phrets.php');
$rets = new phRETS();
$connect = $rets->connect(RETS_LOGIN_URL, RETS_USERNAME, RETS_PASSWORD);
if($connect){
$search = $rets->SearchQuery('PROPERTY', 'RES', '((COUNTY=Dallas))', array('LIMIT'=>20));
print_r($rets->Error());
echo $rets->TotalRecordsFound($search);
$rets->Disconnect();
}else{
$error = $rets->Error();
print_r($error);
}
When I run the page, I receive the following error:
Array ( [type] => rets [code] => 20203 [text] => The request limit is too large for a GET. Please use the POST method to submit your search. ) 0
I don't see a parameter to force PHRets to send the request as a POST. Will this require a hack of the class, or am I missing something?
Thanks
EDIT: I just heard back from the developer. It's not supported at this time. Perhaps a less-busier person should clone it and work on that.. :) Anyway, if anyone has already has modified the code to make this work, let me know, please.
Get the latest phRETS version which supports POST method from here and replace with your old phrets.php.
then you need to add an extra line to the script
$rets->SetParam('use_post_method', true);
Note: By default it will be GET method.
I've published an updated version supporting POST searches available at https://github.com/nathanklick/PHRETS or via composer by adding "nathanklick/phrets": "1.0.2" to your composer.json file.

Modifying budget of an AdWord Campaign by using API

I am implementing adword api version 201306 in one of my project. I am able to fetch the details of a campaign but unable to retrieve the budget details.
My goal is to access the budget details and modify them. I am using PHP library and request to all of you a piece of code written in php.
Any help would be highly appreciated.
Thanks,
Pramod
I found the solution and here is the way you need to go out - -
First you need to pass out the field 'BudgetId' in Campaign Service selector for CampaignStats.
Now you can use following code - -
$budgetService = $user->GetService('BudgetService', ADWORDS_VERSION);
$bm = new Money('10000000');
$campaign->budget->amount = $bm;
$boperation = new BudgetOperation();
$boperation->operand = $campaign->budget;
$boperation->operator = 'SET';
$budgetService->mutate($boperation);
Yes, I agree that this help is very less. Do let me know if anyone face any issue OR need more help.
Regards,
Pramod

List Contacts from a group from Zend GData

and thanks for reading.
My problem is that I'm trying to get a list of contacts belonging to a group in GData using Zend_Gdata_Query.
Using
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full/?group=http://www.google.com/m8/feeds/groups/xxx...xxx/base/XXX');
$feed = $gdata->getFeed($query);
give me an "Unknown authorization header".
$query = new Zend_Gdata_Query('http://www.google.com/m8/feeds/contacts/default/full/');
$query->setParam('group', 'http://www.google.com/m8/feeds/groups/XXX...XXX/base/XXX');
$feed = $gdata->getFeed($query);
is the same.
Obviously without that parameter I get all the contacts.
I already tried the first method with the parameter in the URL with a modified Extension to CakePHP core HttpSocket and it was working. So I suppose the problem is with Zend stripping out parameters from the url but I had no luck looking at the libraries.
Thanks for any help.
$query->setParam('group', 'http://www.google.com/m8/feeds/groups/myemail%40gmail.com/base/xxxxxxxxxxxxxx');
xxxxxxxxxxxxxx = group ID
As above the max-results also works if you add it to the query string like so:
http://www.google.com/m8/feeds/contacts/default/full?max-results=1000
Note that even in the google documentation the only way of getting ALL results is by 'setting a high number' for the number of results returned. So you can never explicitly specify 'ALL'
I guess you are using 3-legged OAuth. Then you need to add next line before getFeed() called:
$gdata->getHttpClient()->setRequestScheme(Zend_Oauth::REQUEST_SCHEME_QUERYSTRING);
It will solve "Unknown authorization header" error.
For me using
$query->setParam('group', 'http://www.google.com/m8/feeds/groups/XXX...XXX/base/XXX');
returns another error: "Invalid value for group parameter: XXXXXXXXXX" and I still dunno how to fix it :(

Categories