I have the following problem when doing a privateExtendedProperty search
$service = new Google_CalendarService($client);
$extendedProperties = New Google_EventExtendedProperties();
$param = array();
$param['singleEvents'] = false;
$param['extendedProperties'] = "CodeID=66";
$events = $service->events->listEvents($calendarioId,$param);
Fatal error:
Uncaught exception 'Google_Exception' with message '(list) unknown parameter: 'extendedProperties'' in
..\google\service\Google_ServiceResource.php:111
Stack trace:
#0 ...\includes\google\contrib\Google_CalendarService.php(529): Google_ServiceResource->__call('list', Array)
#1 ...\google_calendario.php(198): Google_EventsServiceResource->listEvents('hude3h3fjolua08...', Array)
#2 ..\google_calendario.php(442): c_googlecalendario->proc_google('hude3h3fjolua08...', '66')
With the latest api on github you can do this:
$events = $service->events->listEvents($calendarId, array('privateExtendedProperty'=>'codeID='.$yourId));
Pay attention that it's either privateExtendedProperty or sharedExtendedProperty depending on how you created the event.
Related
While triggering the Purchase event after a successful transaction on the payment gateway and a redirection to the website, I'm getting the following error:
Fatal error: Uncaught FacebookAds\Http\Exception\AuthorizationException: Invalid parameter in /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Http/Exception/RequestException.php:174 Stack trace: #0 /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Http/Client.php(215): FacebookAds\Http\Exception\RequestException::create(Object(FacebookAds\Http\Response)) #1 /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Http/Request.php(286): FacebookAds\Http\Client->sendRequest(Object(FacebookAds\Http\Request)) #2 /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Api.php(165): FacebookAds\Http\Request->execute() #3 /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Api.php(214): FacebookAds\Api->executeRequest(Object(FacebookAds\Http\ in /path/fb-business-sdk/vendor/facebook/php-business-sdk/src/FacebookAds/Http/Exception/RequestException.php on line 174
Other events being triggered without any issues with a valid Pixel ID and a token.
$this->api = Api::init($pixel_id, null, $access_token);
$event = (new Event())
->setActionSource(ActionSource::WEBSITE)
->setEventName('Purchase')
->setEventTime(time())
->setEventSourceUrl($current_url)
->setUserData($user_data);
$events = array();
array_push($events, $event);
$request = $this->create_request($events);
// Execute the request
$response = $request->execute();
I had the same problem but found out that the reason to the exception is that a purchase event must have currency and value set.
$customData = (new CustomData())
->setCurrency('USD')
->setValue(10);
Then add the custom data to the event:
->setCustomData($customData)
I created a subscription for my Android app and here's my code to confirm subscription assignments, but I get an error
$packageName = "com.example.srkn";
$productId = "com.example.srkn.aylik";
$token = "<some token here>";
require 'vendor/autoload.php';
$client = new \Google_Client();
$client->setAuthConfig('ts.json');
$client->addScope('https://www.googleapis.com/auth/androidpublisher');
$service = new \Google_Service_AndroidPublisher($client);
$postBody = "okey";
$para = "test";
$purchase = $service->purchases_subscriptions->acknowledge($packageName, $productId, $token,$postBody,$para);
//echo json_encode($purchase);
Fatal error: Uncaught TypeError: Argument 4 passed to
Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions::acknowledge()
must be an instance of
Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest,
string given, called in /home/serkanka/public_html/dgr/onayla.php on
line 17 and defined in
/home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php:40
Stack trace: #0 /home/serkanka/public_html/dgr/onayla.php(17):
Google_Service_AndroidPublisher_Resource_PurchasesSubscriptions->acknowledge('com.text.spec.s...',
'com.text.spec.s...','jlkehndmfjoaenc...', 'test', 'test') #1 {main}
thrown in
/home/serkanka/public_html/dgr/vendor/google/apiclient-services/src/Google/Service/AndroidPublisher/Resource/PurchasesSubscriptions.php
on line 40
The postbody (4th parameter) should be an instance of Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest
You can set the developerPayload on the object like so:
$requestBody = new Google_Service_AndroidPublisher_SubscriptionPurchasesAcknowledgeRequest();
$requestBody->setDeveloperPayload('your_developer_payload');
I have tried below code for updating but it did not work it showed error code:
Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault] Cannot create an abstract class. in D:\xampp\htdocs\bingTest\UpdateAccount.php:81 Stack trace: #0 D:\xampp\htdocs\bingTest\UpdateAccount.php(81): SoapClient->__call('UpdateAccount', Array) #1 D:\xampp\htdocs\bingTest\UpdateAccount.php(81): SoapClient->UpdateAccount(Object(BingAds\CustomerManagement\UpdateAccountRequest)) #2 D:\xampp\htdocs\bingTest\UpdateAccount.php(62): UpdateAccount(Object(BingAds\Proxy\ClientProxy), Object(BingAds\CustomerManagement\AdvertiserAccount)) #3 {main} thrown in D:\xampp\htdocs\bingTest\UpdateAccount.php on line 81
$wsdl = "https://clientcenter.api.sandbox.bingads.microsoft.com/Api/CustomerManagement/v9/CustomerManagementService.svc?singleWsdl";
$proxy = ClientProxy::ConstructWithAccountAndCustomerId($wsdl, $UserName, $Password, $DeveloperToken, $AccountId, null, null);
$last_modified_time=GetAccount($proxy,$AccountId);
$account_obj=new AdvertiserAccount();
$account_obj->AccountType='Advertisement';
$account_obj->CountryCode="US";
$account_obj->CurrencyType="USD";
$account_obj->Id=$AccountId;
$account_obj->LastModifiedTime=$last_modified_time;
$account_obj->Name="Test Account";
$account_obj->AccountLifeCycleStatus='Pause';
UpdateAccount($proxy, $account_obj);
function GetAccount($proxy,$AccountId)
{
$account_obj=new GetAccountRequest();
$account_obj->AccountId=$AccountId;
return $proxy->GetService()->GetAccount($account_obj)->Account->LastModifiedTime;
}
function UpdateAccount($proxy, $update_account_info)
{
$request = new UpdateAccountRequest();
$request->Account = $update_account_info;
return $proxy->GetService()->UpdateAccount($request);
}
In case if you still need a solution. You need to do this:
$encodedAccount = new \SoapVar(
$account,
SOAP_ENC_OBJECT,
'AdvertiserAccount',
'https://bingads.microsoft.com/Customer/v9/Entities'
);
$request->Account = $encodedAccount;
I am just trying to connect my PHP with Google API. My aim is to fetch a particular folder's content and show them as feeds in my site. So for a base I am trying to pull the kind of file of my drive. I am struck. Here is my code.
<?php
require_once 'src/Google_Client.php';
require_once 'src/contrib/Google_DriveService.php';
$client = new Google_Client(); $client->setApplicationName("My Application");
$client->setDeveloperKey("<mykey>");
$service = new Google_DriveService($client);
$optParams = array('fields' => 'kind'); $results = $service->files->listFiles($optParams);
foreach ($results['files'] as $item) {
print($item['kind'].'<br>');
}
?>
When I execute this, I get the following error,
Fatal error: Uncaught exception 'Google_ServiceException' with message
'Error calling GET
https://www.googleapis.com/drive/v2/files?fields=kind&key=:
(403) Insufficient permissions for this file' in
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php:66
Stack trace: #0
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php(36):
Google_REST::decodeHttpResponse(Object(Google_HttpRequest)) #1
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\service\Google_ServiceResource.php(177):
Google_REST::execute(Object(Google_HttpRequest)) #2
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\contrib\Google_DriveService.php(465):
Google_ServiceResource->__call('list', Array) #3
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\test.php(12):
Google_FilesServiceResource->listFiles(Array) #4 {main} thrown in
C:\xampp\htdocs\ccl\gdapi\google-api-php-client\src\io\Google_REST.php
on line 66
I gave proper key. Kindly help me. Thank you
I have my application authenticated using OAuth - and I've tested it with the calendar API. Everything works. I also used the "quick add" method for the events API, and that worked fine. But when I tried to insert using the following code
$event = new Event();
$event->setSummary('hello there');
$event->setLocation('America/Los_Angeles');
$start = new EventDateTime();
$start->setDateTime('2012-04-19');
$event->setStart($start);
$createdEvent = $cal->events->insert('myemail#gmail.com', $event);
I get the following error:
Fatal error: Uncaught exception 'apiServiceException' with message
'Error calling POST
https://www.googleapis.com/calendar/v3/calendars/myemail#gmail.com/events?key=AIzaSyBddYIgnZJrXHuT8gvX-0tEypxsycw99rA:
(400) Bad Request' in
C:\xampp\htdocs\uis\google-api-php-client\src\io\apiREST.php:86 Stack
trace: #0
C:\xampp\htdocs\uis\google-api-php-client\src\io\apiREST.php(56):
apiREST::decodeHttpResponse(Object(apiHttpRequest)) #1
C:\xampp\htdocs\uis\google-api-php-client\src\service\apiServiceResource.php(187):
apiREST::execute(Object(apiServiceRequest)) #2
C:\xampp\htdocs\uis\google-api-php-client\src\contrib\apiCalendarService.php(493):
apiServiceResource->__call('insert', Array) #3
C:\xampp\htdocs\uis\google-api-php-client\examples\calendar\cal.php(44):
EventsServiceResource->insert('paine1591#gmail...', Object(Event)) #4
{main} thrown in
C:\xampp\htdocs\uis\google-api-php-client\src\io\apiREST.php on line
86
with myemail#gmail.com being the ID of my calendar. It works for everything else.
What am I doing wrong?
It appears that you're not setting the attendees of the event.
Example:
$end = new EventDateTime();
$end->setDateTime('2011-06-03T10:25:00.000-07:00');
$event->end = $end;
$attendee1 = new EventAttendee();
$attendee1->email = 'attendeeEmail';
$attendees = array($attendee1, ...);
$event->attendees = $attendees;