I'm trying to get the postcode of the returned Google Places API.
I've looked everywhere but can't seem to find a working example of how people do it.
Here's my API that runs fine in Postman:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=Sydney®ion=AU&key=xxxxx&libraries=places
Here's the sample JSON response
{
"predictions": [
{
"description": "xxxxx",
"place_id": "xxx",
"reference": "xxx",
"structured_formatting": {
"main_text": "xxx",
"main_text_matched_substrings": [
{
"length": 2,
"offset": 0
},
],
"status": "OK"
}
How do I get the postcode details as well?
Nevermind, found the solution.
Need to use another API endpoint and insert the place_id like so:
https://maps.googleapis.com/maps/api/place/details/json?region=AU&key=xxx&place_id=xxxx
Related
I want to be able approve a moderation request through Graph API. I have referred to Approve Moderation Request. I was not able to get it to work. Although, there is a PowerShell script available at EWS Managed API and Powershell How-To Series Part 11 Moderation that I managed to get working.
This is not a supported feature in Graph API and therefore requires some tinkering. I would like some guidance on how to do this.
This is the JSON I am sending to the end point https://graph.microsoft.com/v1.0/me/sendMail
{
"message": {
"subject": "Approve:MessageName"
},
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "systemmailbox#domain.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
This is the response I receive
{
"error": {
"code": "ErrorInvalidRecipients",
"message": "At least one recipient isn't valid., A message can't be sent because it contains no recipients.",
"innerError": {
"date": "2020-08-19T23:40:07",
"request-id": "7g5h732v-6uhb-3212-b6f1-43f6eeb139wq"
}
}
}
Any help would be appreciated.
You have a syntax issue in your Json request eg look closely at the Message after subject you have a closing } which means the only thing your posting is the subject of the message it should be
{
"message": {
"subject": "Approve:MessageName",
"toRecipients": [
{
"emailAddress": {
"name": "Microsoft Exchange",
"address": "address.com"
}
}
],
"singleValueExtendedProperties": [
{
"id": "Binary 0x31",
"value": "7gd324tgcxJJNkEuxk2DP2Xk+M/fxw=="
},
{
"id": "String 0x001A",
"value": "IPM.Note.Microsoft.Approval.Reply.Approve"
}
]
}
}
Additional
To make this work correctly you need to get the Approval Request from an app rovers mailbox for the Graph a query like this
https://graph.microsoft.com/v1.0/me/mailFolders('Inbox')/messages?$filter=singleValueExtendedProperties/any(ep:ep/id eq 'String 0x001a' and ep/value eq 'IPM.Note.Microsoft.Approval.Request')&$expand=singleValueExtendedProperties($filter%3D(Id eq 'Binary 0x0031') or (Id eq 'String 0x0E1D'))
This will give you the report tag 0x0031 value that you need to use in your Send and you also need to include the Approve Verb Extended property
{
id = "String {00062008-0000-0000-C000-000000000046} Id 0x8524"
value = "Approve"
}
I converted the script from my blog which I'll get around to posting this week that just approves the last email in a Mailbox you can look at it https://github.com/gscales/Powershell-Scripts/blob/master/Graph101/Moderation.ps1 (look at Invoke-ApproveModerationRequest)
I need to send google analytics event from the server but can not find documentation on how to map the object properly.
I need to send event like this
{
"event": "nameOfEvent",
"ecommerce": {
"currencyCode": "eur",
"purchase": {
"actionField": {
"id": "9d9e3cc9-0007-4aaa-d986-08d6g2f07b63",
"affiliation": "",
"revenue": 100
},
"products": [
{
"name": "Product name",
"id": "id",
"price": 200,
"category": "Category",
"variant": "Buy online",
"quantity": "1",
"dimension1": "1",
"dimension2": "2",
"dimension3": "3"
}
]
}
}
}
Result should be similar to https://www.google-analytics.com/debug/collect?v=1&t=event&tid=UA-222-1&uid=1&el=nameOfEvent& here I have a problem, what to do next???
I would appreciate any help with it!
Looks like a possible duplicate of this. Manually sending data to Google Analytics.
The above post has references to C# implementation of the Google measurement protocol https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide.
My query goes like this: If I have a feedItem (an image posted on facebook), how can I verify that I have liked it or not? Can I verify all the interactions which I have done to the feedItem or the interactions other people have done to it (like, dislike, pin, share)? Is there any way in getstream.io to retrieve these interactions?
Thanks in advance...
Graph API provides all functions you need. Here are some examples:
Read shares[it's a field of an object]: https://developers.facebook.com/docs/graph-api/reference/v3.1/post#read
Read Shared posts: https://developers.facebook.com/docs/graph-api/reference/v3.1/object/sharedposts
read likes:
https://developers.facebook.com/docs/graph-api/reference/v3.1/object/likes#read
/likes returns only the profile for the current user if read with a
user access token:
Album, Photo, Post, Video
all returns are JSON, which you can directly Deserialize Anonymous Type without using stream, for example, likes:
{
"likes": {
"data": [
{
"name": "Bill the Cat",
"id": "155111347875779",
"created_time": "2017-06-18T18:21:04+0000"
},
{
"name": "Calvin and Hobbes",
"id": "257573197608192",
"created_time": "2017-06-18T18:21:02+0000"
},
{
"name": "Berkeley Breathed's Bloom County",
"id": "108793262484769",
"created_time": "2017-06-18T18:20:58+0000"
}
],
"paging": {
"cursors": {
"before": "Nzc0Njg0MTQ3OAZDZD",
"after": "NTcxODc1ODk2NgZDZD"
},
"next": "https://graph.facebook.com/vX.X/me/likes?access_token=user-access-token&pretty=0&summary=true&limit=25&after=NTcxODc1ODk2NgZDZD"
},
"summary": {
"total_count": 136
}
},
"id": "user-id"
}
I want to get number of comments and/or likes for video with specific YouTube ID.
I am using YouTube API v3.0.
I was searching through API documentation and can't find appropriate method.
After having better look at Google API documentation here, I have found that I can use "statistics" part parameter of Videos.List API in order to get what I want.
Exact HTTP post request should be (notice part=statistics parameter):
GET https://www.googleapis.com/youtube/v3/videos?part=statistics&id=sTPtBvcYkO8&key={YOUR_API_KEY}
And response is:
{
"kind": "youtube#videoListResponse",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/XN5YXMZGQaruwTWTekZu7fQthdY\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/QbzZs_aBNpzkZJxTVM7YgQeEY3g\"",
"id": "sTPtBvcYkO8",
"statistics": {
"viewCount": "3215321",
"likeCount": "17003",
"dislikeCount": "263",
"favoriteCount": "0",
"commentCount": "621"
}
}
]
}
If you want number of comments and/or likes for video with specific YouTube ID, you need to use the YouTube API V3 with youtube.videos.list
with the parameters :
part=id, statistics
id=VIDEO_ID
This is the output :
"items": [
{
"kind": "youtube#video",
"etag": "\"kjEFmP90GvrCl8BObMQtGoRfgaQ/-hharrXKffaZ3z4sIleW9K-Nf2Q\"",
"id": "_RtGuUAQOC4",
"statistics": {
"viewCount": "484851",
"likeCount": "3993",
"dislikeCount": "72",
"favoriteCount": "0",
"commentCount": "262"
}
}
]
LIVE DEMO
You can find all informations about video list in the doc :https://developers.google.com/youtube/v3/docs/videos/list?hl=fr :
I have a website where I can post some contents. When I post a content, I want to also post a link/description to my Facebook page.
I've created an app, and then i got the App ID and App Secret. I asked for some permissions (publish_stream, manage_pages, offline_access) and then I got the access_token.
So, I think I have all I need: appid, appsecret, access_token, and these 3 permissions.
I'm logged in as the page administrator. I gave all the permissions to my app.
I'm using C#, so, there is some code:
var client = new FacebookClient(access_token);
client.AppId = appid;
client.AppSecret = appsecret;
var result = client.Post("/[MY_PAGE_ID]/feed",
new
{
picture = "http://some-picture.com/picture.jpg",
link = "http://random-link.com",
message = "A random message",
name = "My page's name",
description = "Other description",
});
The var result returns me the post ID.
A facebook page has 2 ID's: the User ID and the Page ID, right?
So, when I return to the facebook page, I can see the post in the "Recent Posts by Others on [MY PAGE's NAME]"
And then, the list of posts.
This is the WRONG place, I want to post to the wall.
When I click on the post, it opens a popup with more details. It has no information about the person who posted on my page. But I can get the ID of this person... and the ID is the same as the Admin ID of my page (the "person" who is logged in).
How can I make a post to my own page's wall?
When you post with your application, you use your appKey and AppSecret as log so you don't post with your account on the page but with the "application account".
{
"id": "170265327759_459817357429197",
"from": {
"id": "170265327759",
"category": "Computers/technology",
"name": "IntuiFace Presentation"
},
"message": "We just posted a preview video of IntuiFace Version 4.0 don't miss it! http://tmblr.co/Z4-xWvipid9i #intuiface #IFversion4.0 #preview",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQBXteQsf4IidGU-&w=154&h=154&url=http%3A%2F%2Fimg.youtube.com%2Fvi%2FqsgXFg-6iaE%2F2.jpg",
"link": "http://tmblr.co/Z4-xWvipid9i",
"name": "Preview of IntuiFace Version 4.0 The IntuiFace...",
"caption": "blog.intuilab.com",
"description": "Preview of IntuiFace Version 4.0 The IntuiFace platform is already the world’s premier no-programming solution for the creation of interactive digital experiences. In Version 4.0 we are...",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/170265327759/posts/459817357429197"
},
{
"name": "Like",
"link": "https://www.facebook.com/170265327759/posts/459817357429197"
}
],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2013-04-16T10:01:22+0000",
"updated_time": "2013-04-16T10:01:22+0000",
"likes":
{
"data": [
{
"name": "Roland Tomczak",
"id": "816909640"
},
{
"name": "Felipe Brito",
"id": "578018101"
},
{
"name": "Frank Coleman",
"id": "504788100"
},
{
"name": "Seb Meunier",
"id": "1513771056"
}
],
"count": 4
}
This is what a facebook page with a post look like it's a json file.