I need all google reviews for particular location but I am unable to use business api from google. Here is url for get request
https://mybusiness.googleapis.com/v3/accounts/account_name/locations/location_name/reviews
Now my question is what is the value for param account_name and location_name
How can I get that.
Please answer with sample location example
I think first of all you need to white list your google my business api for whatever project you are working on in your project as its private api. Google my business api will work on the locations associated with your account so make sure you verified the LOCATIONS from any account you know. Then you can try out the api call you mentioned in OAuthplayground.
Follow steps mentioned in below documentation URL to set it up:
https://developers.google.com/my-business/content/prereqs
After the setup and etc you will automatically understand the account id and location id.
Also few more urls you can go to understand it better.
https://console.developers.google.com (here you will setup your project)
https://business.google.com/manage (here you will add/can see the locations - for which you need reviews)
https://developers.google.com/my-business/content/basic-setup (Steps after completing the prereq)
https://developers.google.com/oauthplayground (You will test the my
business api here after approval)
When you make a request to https://mybusiness.googleapis.com/v3/accounts it gives you a list of accounts. On those accounts they have a field called name. That field is accounts/account_name.
{
"state": {
"status": "UNVERIFIED"
},
"type": "PERSONAL",
"name": "accounts/1337",
"accountName": "example"
}
When you make a request to https://mybusiness.googleapis.com/v3/accounts/account_name/locations it gives you a list of locations. On those locations they have a field called name. That field is accounts/account_name/locations/location_name.
{
"locations": [
{
"languageCode": "en",
"openInfo": {
"status": "OPEN",
"canReopen": true
},
"name": "accounts/1337/locations/13161337",
...
}
Related
I'm trying to get the place ID from a business on google.
I've searched it in this widget but it does not show
https://developers.google.com/maps/documentation/places/web-service/place-id
I followed this site
https://www.launch2success.com/guide/find-any-google-id/
and I get returned this from my request, any ideas?
{
"error_message": "The provided Place ID is no longer valid. Please refresh cached Place IDs as per https://developers.google.com/maps/documentation/places/web-service/place-id#save-id",
"html_attributions": [],
"status": "NOT_FOUND"
}
I'm trying to use the Web Service component of a Qualtrics survey to get data from a mailing list based on an answer provided by the person completing. So they would select "Bob Jones" and then the Web Service would look at the mailing list to then populate the email address for Bob Jones.
I'm able to call the mailing list and see results successfully with the API token, however, any time I try to add a query, I get a return of "Unexpected json key provided"
How can I access a specific entry? The format of the returned list follows:
{
"result": {
"elements": [
{
"id": "abcdefghijk",
"firstName": "Bob",
"lastName": "Jones",
"email": "bobjones#stackoverflow.com",
"externalDataReference": "Jones, Bob",
"embeddedData": {
"PrimaryEmail": "bobjones#stackoverflow.com",
"DisplayName": "Jones, Bob"
},
"language": "null",
"unsubscribed": false,
"responseHistory": [],
"emailHistory": []
},
I'm attempting to add the query where it says Parameter to Web Service...:
I greatly apologize if this has been discussed already. I searched through as many questions as I could, and didn't find an answer to this. Hope someone will help!
The API you are trying to use doesn't accept query parameters and you can't use it to get data for a specific contact.
Whether you can do it at all depends on whether your account has XM Directory or Research Core Contacts. If you have Research Core Contacts, the only way to get data for a specific contact is by contact id. If you have XM Directory you can use the search API. See: https://api.qualtrics.com/api-reference/reference/contacts.json/paths/~1directories~1{directoryId}~1contacts~1search/post
I have a slack app implemented in node.js where I am dynamically displaying a drop-down menu from an Options Load URL to a channel on the Slack group.
The drop down is getting displayed correctly based on the options JSON that I am returning form the external URL,
but now the problem is that I need to have separate items in the drop-down menu based on what the user has entered on the slack channel.
For example:
If the user says: give me choices for option 1: then the value 1 should be passed to the Options Load URL and the code that I have implemented at that URL will reply with the appropriate JSON based on the input value 1.
Next, when the User says give me choices for option 2: then the value 2 should be passed to the Options Load URL and the code implemented there will reply the options based on the value 2 that it receives.
The code at the Options Load URL is already implemented. The code for extracting the number 1 or 2 from the user message is also implemented.
The values 1 or 2 ... etc. are not constant or fixed. These can by random and the API at Options Load URL will be able to correctly handle these values.
I just need to figure out a way to send these values to the Options Load URL somehow.
Is it possible to do this somehow in Slack?
Use the name property in your request to pass a custom value to the part of your app that handles the options requests from Slack ("Options Load URL"). I use it usually to select which predefined options list to return, but you can also use it to dynamically create a new option list based on the value.
For reference here is the example Slack request for creating a dynamic menu (from the offical documentation), where you can see the name property under action. In this example it has the value "bugs_list":
{
"text": "What's bugging you?",
"response_type": "in_channel",
"attachments": [
{
"fallback": "Upgrade your Slack client to use messages like these.",
"color": "3AA3E3",
"attachment_type": "default",
"callback_id": "select_remote_1234",
"actions": [
{
"name": "bugs_list",
"text": "Which random bug do you want to resolve?",
"type": "select",
"data_source": "external",
"min_query_length": 3,
}
]
}
]
}
And here is what your Options Load URL will receive. Notice the name parameter.
{
"name": "bugs_list",
"value": "bot",
"callback_id": "select_remote_1234",
"team": {
"id": "T012AB0A1",
"domain": "pocket-calculator"
},
"channel": {
"id": "C012AB3CD",
"name": "general"
},
"user": {
"id": "U012A1BCJ",
"name": "bugcatcher"
},
"action_ts": "1481670445.010908",
"message_ts": "1481670439.000007",
"attachment_id": "1",
"token": "verification_token_string"
}
The name parameter is a common parameter in a HTTP request, so you can put pretty much everything in there, even data structures, as long as they are encoded as strings. Also see my other answer that talks about the limits of passing data in Slack parameters.
In javascript, I am trying to access analytics data for google shorten urls, for example. I tired 'URL Shortener API', which worked fine and I received data. But this data doesn't have analytics report for each hour in the day or for each day in the month, as its available on here. Here in response it have some properties for example 'clicks' and 'buckets' which contain the clicks count I need. Check the image below:
But these properties are not available in the data I received with the 'shortener API'. I might use Google analytics api for this purpose. Can anyone suggest me how can I use analytics api to get the analytics for any shorten url ?
Thanks
Are you sure you're using the URL Shortener API correctly ?
If I check the example you provided which contains the data you need like reports for the past two hours (per hour does not exists) or past day, I can see for example:
6 total clicks for the past two hours.
1243 clicks for the past day.
If I try to get the same data for the same short url with the URL Shortener API:
curl -X "GET" "https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo. gl/fbsS&projection=FULL&key=YOUR-API-KEY"
I'll get the same data:
{
"kind": "urlshortener#url",
"id": "http://goo. gl/fbsS",
"longUrl": "http://www.google.com/",
"status": "OK",
"created": "2009-12-13T07:22:55.000+00:00",
"analytics": {
"allTime": /* ... */,
"month": /* ... */,
"day": {
"shortUrlClicks": "1243",
/* ... */,
},
"twoHours": {
"shortUrlClicks": "6",
/* ... */,
}
}
}
So I have 1243 clicks for the past day and 6 for the past two hours, the data are identical.
If you need to get all data from all time, you'll either have to store the data yourself or like you said use Google Analytics.
Google Analytics and short URLs can be pretty tricky to handle in Analytics because they redirect users from their website to your website which can cause Analytics to treat them as "direct" and not coming from any campaign you specified (newsletter, facebook, twitter, etc.).
You need to tag your URLs in order to properly track them. Usually, you'll need to use Google URL Builder to generate custom campaign parameters for your URLs.
There is no API for Google URL Builder but you can generate yourself valid URLs using the detailed informations provided on the previous link and append some or all of the parameters at the end of your non-short URLs like utm_source, utm_medium, utm_term, etc.
When your non-short URLs are properly tagged, you can then shorten them using any service you want.
To get the data back, you'll need to use the Google Analytics API and specifically the Reporting API.
Once authenticated,
var discoveryURL = 'https://analyticsreporting.googleapis.com/$discovery/rest?version=v4';
// Load the API
gapi.client.load(discoveryURL)
.then(function() {
// Returns Analytics data.
gapi.client.analyticsreporting.reports.batchGet({
"reportRequests": [
{
"viewId": VIEW_ID,
// View IDs can be fetched from the Analytics Account Explorer
// https://ga-dev-tools.appspot.com/account-explorer/
"dateRanges": [
{
"startDate": "7daysAgo",
"endDate": "today"
}
],
"metrics": [
{
"expression": "ga:sessions"
}
]
}
]
})
.then(function(response) {
var json = JSON.stringify(response.result, null, 2);
// Do anything you want with the JSON returned.
});
});
The main function used here is batchGet and you can get every informations regarding the fields and options you can use on the Reporting API v4 reference.
You'll be able to toy with various fields like dates (DateRange), dimensions, etc. to get all the data you'll need in your application.
I have been getting like and comment counts per post of facebook page/group feed call by graph api separately using FQL but as version 2 of graph api released fql no longer working to serve purpose.
So i have to find new ways to get comment and like counts per post of page feed display. I will make a separate call to get comment and like counts per post of the fb page as it may not be possible to get things in same page feed call(or it is?).
So, searching through google, i found following way using graph api call -
..page_id/feed?fields=likes.limit(1).summary(true){id},comments.limit(1).summary(true)&limit=10
Is this the best and error free way?? Also besides id and summary fields i also get created_time, paging, likes data by the above call which is unexpected and redundant, how do i exclude these additional fields?
So please any FB employee show me light on what is the best way to retrieve like and comment count per post of page/group feed using graph api version 2.
If you want to retrieve Likes and comments count of a post on FB you can achieve this by using Id of the post Like this
..Your_Post_ID?fields=likes.limit(0).summary(true),comments.limit(0).summary(true)
the result will contain
Total numbers of likes of the post, total numbers of comments of the post, post ID and post created time.
The result will be like this
{
"likes": {
"data": [
],
"summary": {
"total_count": 550
}
},
"comments": {
"data": [
],
"summary": {
"order": "chronological",
"total_count": 858
}
},
"created_time": "2014-10-12T05:38:48+0000",
"id": "Your_Post_ID"
}