i succeeded in getting a push notification from google calendar into my system, when a new event is created in the calendar.
the push notification has no data in the POST body and the POST headers are these:
[Host] => xxxxxx.xxxx.com
[Content-Type] => application/json; charset=UTF-8
[Accept] => */*
[X-Goog-Channel-ID] => xxxxxxx-xxxxxxxx-8824-f0c2166878be
[X-Goog-Channel-Expiration] => Thu, 04 Dec 2014 04:27:13 GMT
[X-Goog-Resource-State] => exists
[X-Goog-Message-Number] => 11897215
[X-Goog-Resource-ID] => xxxxxxxxxx-xxxx-pSbC27qOUfg
[X-Goog-Resource-URI] => https://www.googleapis.com/calendar/v3/calendars/xxxxxxx#gmail.com/events?key=AIzaSyC_0nytiZWHfabrpWiExxxxxxxxxxx&alt=json
[Content-Length] => 0
[Connection] => Keep-alive
[Accept-Encoding] => gzip,deflate
[User-Agent] => APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)
where are the new event details that was created in the calendar?
how do i get them?
no information online and no information in google documentation (been searching for hours):
https://developers.google.com/google-apps/calendar/v3/push
where are the event details??
UPDATE:
i set a watch on my calendar using this code:
service = new Google_Service_Calendar($client);
$channel = new Google_Service_Calendar_Channel($client);
$uuid = gen_uuid();
$channel->setId($uuid);
$channel->setType('web_hook');
$channel->setExpiration('1919995862000');
global $sugar_config;
$address = $sugar_config['site_url'] . "/index.php?entryPoint=updateFromCal";
$channel->setAddress($address);
$watchEvent = $service->events->watch($bean->google_cal_id_c, $channel);
This is the channel details i send to google calendar api:
[address] => https://mydomainXXXX/index.php?entryPoint=updateFromCal
[expiration] => 1919995862000
[id] => xxxxxxxxxxxxxxx--4558-ac19-b82e0ca32206
[kind] =>
[params] =>
[payload] =>
[resourceId] =>
[resourceUri] =>
[token] =>
[type] => web_hook
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
i still get the same resource ID in the response, with every new event i create in the calendar! why can't i get the event ID of the event i just created? what did i do wrong? am i watching events or channels?
the reply i get is still the one mentioned above, its with the same resource id all the time.
The push does not contain any data. It only tells you that something changed in that resource. You will need to do a list request to find out what it was. Preferably this list request will be an incremental sync. Take a look into how to do synchronization here: https://developers.google.com/google-apps/calendar/v3/sync
You are missing the incremental sync. From the creators themselves slightly revised according to my tastes:
The first thing the app needs to do is get the new push functionality is to subscribe to a calendar of interest. When a calendar changes, Google will notify your app and the app does an API call to get the update.
As an example, let’s assume you have a calendar my_calendar#my-host.com. Your app is hosted on a server with my-host.com domain and push notifications should be delivered to an HTTPS web-hook https://my-host.com/notification
Every time my_calendar#my-host.com changes, the Google Calendar server will trigger a web-hook callback at https://my-host.com/notification. After receiving the callback the app needs to do an incremental sync.
To get the event details, you need to make a GET request, which should return the resource information as a JSON response. You can do so by passing in the Calendar ID and the Event ID (the eventId in this case should be your resource-ID, assuming that your notification was set to watch events).
Related
I want to get my PayPal accounts transaction history. Just the same data I can export when I'm logged in.
All the transactions there where not generated via REST API itself.
I read some posts where it says that one can't use, for example, "Transaction Search" API (https://developer.paypal.com/docs/api/transaction-search/v1/) in this case.
I tried this out but could not get it to work.
After I got my access_token:
stdClass Object
(
[scope] => https://api.paypal.com/v1/payments/.* openid https://api.paypal.com/v1/vault/credit-card/.* https://uri.paypal.com/services/subscriptions https://uri.paypal.com/services/identity/activities https://api.paypal.com/v1/vault/credit-card
[access_token] => xxx
[token_type] => Bearer
[app_id] => xxx
[expires_in] => 32400
[nonce] => 2020-09-05T22:25:09ZHAnra0QUpsxgo4E90gqEKtgtUNgkGNzVs1IVCBJfiu0
)
I tried to call the /v1/reporting/transactions API an got back:
stdClass Object
(
[localizedMessage] => No permission for the requested operation.
[suppressed] => Array
(
)
[name] => PERMISSION_DENIED
[message] => No permission for the requested operation.
[details] => Array
(
[0] => stdClass Object
(
[field] =>
[value] =>
[location] =>
[issue] => No permission for the requested operation.
)
)
[information_link] => https://developer.paypal.com/docs/classic/products/permissions/
[debug_id] => feb53d91bc653
)
The "information_link" in the response ends up at 404.
And yes, I activated "Transaction Search API" in my Developer Account.
Then I found this old API:
https://developer.paypal.com/docs/archive/express-checkout/ht-searchRetrieveTransactionData-curl-etc/#
There, PayPal says that this API is deprecated but will still work ... for customers who are using it.
For me, this also does not work, response:
{
"name": "INTERNAL_SERVICE_ERROR",
"message": "An internal service error has occurred",
"debugId": "a2b554e8cc7b",
"links": [
{
"href": "https://developer.paypal.com/docs/api/overview/#error",
"rel": "information_link"
}
]
}
So how to get existing PayPal transactions of my PayPal account via API? There must be a way, there are many tools who import this data, but which API do they use?
I tried this out, it don't worked, I could not get the data.
And yes, I activated "Transaction Search API" in my Developer Account.
After activating it you need to wait 9 hours, and ensure you get a new access_token that is not the same as your old one. You should then have a new [scope] returned which includes https://uri.paypal.com/services/reporting/search/read
Without that scope returned, you can't use the Transaction Search API.
There must be a way, there are many tools who import this data, but which API do they use?
The Transaction Search API is actually not very useful -- most people use the Reports tab in www.paypal.com and download a CSV file
I am interested in getting bitbucket event payloads as they occur (e.g repo push, pull request created) in my application. I have all the necessary stuff ready (app descriptor, webhooks etc.)
I am able to get the event payload in event controller/handler when bitbucket sends event payload on that. But the payload is not as expected. See event payload docs for what should I be getting.
But, what I actually get is something like this
Array(
[ciphertext] => someciphertext
[encrypted_key] => yJGtBQD3x1oHxaB
[header] => Array
(
[alg] => PBES2-HS512+A256KW
[kid] => ari:cloud:bitbucket::app/{259e10da-4427-4b0}/test-app
[p2c] => 8192
[p2s] => TM6HLQpGaYg
)
[iv] => MtspXopJ4A
[protected] => eyJlbmEyIn0
[tag] => N4d5b4KsKhc
)
This seems like some encrypted data. Any pointers what it actually is and if it is encrypted how can I decrypt it.
I was developing a Shopify App. It was working fine till yesterday evening, but then I started getting the Bad Request [400] error, after the user allow access to the app for his shop.
Error is below
(https://SHOP-NAME.myshopify.com/admin/oauth/access_token) in /path/to/shopify/authentication/oauth.php on line 28
Array (
[method] => POST
[uri] => https://SHOP-NAME.myshopify.com/admin/oauth/access_token
[query] => Array ( )
[headers] => Array ( )
[payload] => Array (
[client_id] => {CLIENTID}
[client_secret] => {CLIENT_SECRET}
[code] => {CODE}
)
)
I'm doing a POST cURL Request with Content-Type:application/x-www-form-urlencode and all the request are validated to be coming from shopify.
If anyone want more information I can provide.
Thanks.
If this happening after the user authorizes the app, it could be an issue with the permanent token they have received. You could try grabbing the token that is generated and doing a POSTMAN request manually to query the API to verify the token works.
If it worked before and you didn't make any changes to the app, it could be a temporary API issue, even though I found that to be rare with my app.
The code parameter that is sent from Shopify can only be used a single time.
If you re-make the original request that sends the code parameter to your server, you should be able to make the call successfully.
I'm working on Shopify API and trying to register uninstall webhook for my plugin which is registered successfully and i do get a response e.g.
stdClass Object
(
[webhook] => stdClass Object
(
[id] => 52102211
[address] => http://www.example.com/dev1/login?code=42db53dae6d706f095711b8365a941e8&hmac=6ca8a5fa6659ea9b976454d352c73024d98417b0e20665c08090c636d3c9662b&shop=my-shopify-shop.myshopify.comsignature=ed384b260216b100ea2090e0d3c26460×tamp=1438850605/delete_shop
[topic] => app/uninstalled
[created_at] => 2015-08-06T04:43:27-04:00
[updated_at] => 2015-08-06T04:43:27-04:00
[format] => json
[fields] => Array
(
)
[metafield_namespaces] => Array
(
)
)
)
When i delete my plugin it generates a 302 POST request.
I want to see that where does this request leads so that I'd be sure that it is coming straight to my controller action for handling this i.e. to example.com/delete_shop
I'm working in PHP CI and sending email in my code upon the call of this function. Here are the routes:
$route['default_controller'] = "home";
$route['product_edit/:any'] = "home/product_edit";
$route['delete_shop'] = "home/delete_shop";
$route['404_override'] = '';
Is there any problem with my routes because I never receive an email even after hours?
(email functionality is working properly in the application though)
EDIT :
here is the image for the request generated
A 302 is a temporaly redirect. You can follow the requests with tools as:
Firebug (https://getfirebug.com/downloads)
Browser console for developers in Chrome, Safari, Firefox, Internet Explorer, etc.
The tools above make it possible to log the requests. Detailed information provided, such as request headers, response headers, response body, etc.
I am using the php watch commant:
$service = new Google_Service_Calendar($client);
$channel = new Google_Service_Calendar_Channel($client);
$channel->setId('20fdedbf0-a845-11e3-1515e2-0800200c9a6689111');
$channel->setType('web_hook');
$channel->setAddress('https://www.exampel.com/app/notification');
$watchEvent = $service->events->watch('primary', $channel);
This command works fine and I get the response:
Google_Service_Calendar_Channel Object ( [address] => [expiration] => 1401960485000 [id] => 20fdedbf0-a845-11e3-1515e2-0800200c9a6689111 [kind] => api#channel [params] => [payload] => [resourceId] => HZjSdbhwcd5KMKEA3ATA31LoR-w [resourceUri] => https://www.googleapis.com/calendar/v3/calendars/primary/events?key=AIzaSyBl_Y7Y4eQDve-0DjwzBEP7_qOLo-67ouY&alt=json [token] => [type] => [modelData:protected] => Array ( ) [processed:protected] => Array ( ) )
However; In my set up url I don't get any message when something changes in my calendar.
Am I missing something!?
I had a similar issue which was caused by authentication on my application.
Try sending a post request to https://www.exampel.com/app/notification and see if it is received. If not, double check your routing or authentication.
Also ensure that the endpoint is a valid https URL. Self-signed certificates are not allowed.
Source: https://developers.google.com/google-apps/calendar/v3/push
I have faced this issue today, so want to add some more details here.
Google only send the headers to your URL. so if you are waiting for getting some data (just like me) you won't get any (except some cases).
Check this Google Calendar API docs for Receiving Notifications
Understanding the notification message format
All notification messages include a set of HTTP headers that have X-Goog- prefixes. Some types of notifications can also include a message body.
Here are the headers I received in my webhook callback URL.
[Host] => mydomain.com
[X-Goog-Channel-ID] => 10ddfddt0-a995-10f4-1254e2-0000000a0a0609001
[X-Goog-Channel-Expiration] => Thu, 11 Jan 2018 10:04:04 GMT
[X-Goog-Resource-State] => exists
[X-Goog-Message-Number] => 2526579
[X-Goog-Resource-ID] => 9OG_a-ECJycPkpNR1ZrWSon5_i1
[X-Goog-Resource-URI] => https://www.googleapis.com/calendar/v3/calendars/primary/events?maxResults=250&alt=json
[Content-Length] => 0
[Connection] => keep-alive
[User-Agent] => APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)
[Accept-Encoding] => gzip,deflate,br
I also found some additional code sample here which you can use if you want to make the request to Google API without client library.
Hope this help someone.