Sharing private survey with service account email address - google-surveys

I've created a service account from the initial guide and am using the same sample code published on the Google Surveys GitHub repo.
I see that I have to add my service account email as an owner to the individual survey from other answers to get the results, but so far this isn't working. It looks like an email is sent to that address to verify ownership, but nothing is sent to me. Is there another way to confirm this please?
I'm using the correct credentials JSON file in oauth.py but all requests return the following:
Error fetching survey results: <HttpError 403 when requesting https://www.googleapis.com/surveys/v2/surveys/{id}/results?alt=media returned "Forbidden">
Am I missing something? Thanks in advance for any help.

To check the current owners of the survey, you have two options:
1) Google Surveys UI. Click on the survey on the Your Surveys page. Next, click on the Confirm Survey tab and look at the Details section at the bottom of the page. This will show you the current owners of the survey, and give you the option to add one.
2) Use the OAuth Playground (the Getting Started Guide has detailed directions). Call "get" on the survey to see its owners list (see "Send a GET request to examine a survey").
You can use the API to update the owners without the need for a confirmation email.
Follow the directions in the Getting Started Guide to set up the OAuth Playground with credentials attached to the Google account that owns this particular survey.
Then, use the PUT method on your survey to update the owners. Make a request in the OAuth Playground with:
HTTP Method: PUT
Request URI: https://www.googleapis.com/surveys/v2/surveys/{survey id}
Enter request body: { "owners": ["my_service_account#something.gserviceaccount.com"] }
Hope this helps! I'm on the Google Surveys team; if you have any further issues, feel free to send me the request ID for your failed request, so I can debug in more detail.

Related

Empty POST request's body from Google Pay in program Loyalty Card

We faced with testing problem on the side Google Pay.
At the current stage, we get into the GPay only after Card registration on the side of our site, when after filling out the form user is redirected to the GPay page to create a new Card.
A Card is being created : we see it with the data that is entered into the form, but the GPay doesn't send any requests to our site. A special test environment from GPay is needed?
Google Pay's support service asks: "Are you receiving the POST from GPay when you attempt the enrollment flow from the app?"
How we can apply from GPay if we can't create a Card from GP at this stage?
The process of creating a Card is described in paragraph 1 (on the site side).
How to get into the GPay for enrollment at the testing stage?
Support service writes "When you submit your user details from GPay, it sends a POST request to your server so that when your page is displayed it contains the information from the user data form. "
As we pointed, at the current stage we can't send data from the GPay.
It was expected thatGoogle Pay's support service send a POST request to our site, but we don't see POST request's body. It is empty.
Therefore, we asked earlier, What internet service we can see it with?
They answered, as we understood, that we can see it by sending from GPay.
How to send it from the GPay, if at the testing stage we can only see
newly created cards and we don’t get any requests from GPay?
Is testing take place from GPay app?
If so, why don't we have an access?
We get a request POST, but with an empty request body.
The GPay has a lot of users with the Loyalty Card.
Someone has already come across this.
We didn't find such situations on the Internet.
How anybody have handled situations like this before?
How to create a new Card from GPay and see a POST request?
We do not have access to the class settings in the account. On Russian language, we do not see the callback feature, and on English technical support sends to us a screenshot - there are settings in the account. Could there be access rights issues?
To accoding with your link from paragraph 5 https://developers.google.com/pay/passes/rest/v1/loyaltyclass#discoverableprogrammerchantsignupinfo - we did not find the insert barcode /manually settings. Can you tell us where to find them?
At the moment, we can scan the barcode in GPay app(due to help of GPay support service ), but we do not receive a Post request after inserting bar code in GPay app.
Our Russian account settings looks like:
GPay support service see our account on English so:
We don't see these settings for barcode.
In accordance with the documentation https://developers.google.com/pay/passes/guides/overview/how-to/use-callbacks, we set up a callback feature, but we do not receive a post request in the format json (php):
$responseJson_str = file_get_contents('php://input');
$responseJson = '[' . $responseJson_str . ']';
$response = json_decode($responseJson, true);
var_dump( $response);
$file_server = "server_calback.log";
$fw = fopen($file_server, "a");
fwrite($fw, "POST " . var_export($response, true) . "\n");
fclose($fw);
What is wrong?
I show a screenshot with the request POST to our site
https://itcrk.icu/testcallback.php
from https://reqbin.com/
At the beginning of testing stage, we implemented signin / signup as you indicated in points 1-6. We did this functionality was not because we needed it, but thought that it was necessary for testing.
Then we wrote in support team that we need a barcode/manually, as users of other cards are used to. We were answered that we need settings in the account, we did not find them. Support team helped us to configure the barcode in the account of the Merchant Center - Google.We insert barcode in the GPay , but we don’t get json on the site. We assume a problem with access rights in the Merchant Center - Google. How do other cardholders usually set up a barcode in their accounts? We do not have access to the settings n the Merchant Center - Google, unfortunately. Support team writes that there should be access, but it does not.
It turned out that there are two ways to work with cards in the GPay. The first method is described in the documentation here https://developers.google.com/pay/passes/guides/enrollment-signin, the second method is to scan the card(barcode/manually) and use it as a card storage, but card data is not sent to the user’s server.
The Loyalty card is simply displayed in the GPay with its number(from barcode/manually) and that's all.
Sign up and enrollment are triggered from the google pay app: https://developers.google.com/pay/passes/guides/enrollment-signin
You will see post once a user goes into the Google Pay app and hits add pass then finds your program and hits sign up/ sign in.
See 1-2.
You have to use the account you provide to support team - its only visible for them for testing.
It may not be from Google. Google requests have the body with the user details.
Go to google pay app and sign in with user that is whitelisted by support to see the program. Hit add pass, then loyalty program then search for your program then hit sign up/ sign in and it will post to the endpoint defined here: https://developers.google.com/pay/passes/rest/v1/loyaltyclass#discoverableprogrammerchantsignupinfo
Let me also clarify enrollment and sign in. This is what a user sees, what the Google Pay app does and finally what a merchant needs to do:
Google Pay user navigates to passes tab in Google Pay App, hits "+ Pass":
Google Pay chooses which type of pass to add, hits loyalty for this example:
User searches and presses on the specific program they want to sign up for (theres a testing phase before it goes public, in which only accounts which you tell support team can see the program in google pay app):
User then fills out information to share and consents to share their information with this merchant, then they press continue.
Google Pay Then does a POST request with user info to endpoint defined here on the loyalty class by merchant: https://developers.google.com/pay/passes/rest/v1/loyaltyclass#discoverableprogrammerchantsignupinfo
Here is where merchant, yourself would have to be listening for POST to endpoint you defined in the setting mentioned previously and give user form to finish providing all details needed and then redirect to the JWT link to automatically save the pass.
See https://developers.google.com/pay/passes/partners/enrollment-signin for reference.
It turned out that there are two ways to work with cards in the GPay. The first method is described in the documentation here https://developers.google.com/pay/passes/guides/enrollment-signin, the second method is to scan the card(barcode/manually) and use it as a card storage, but card data is not sent to the user’s server. The Loyalty card is simply displayed in the GPay with its number(from barcode/manually) and that's all.

Get current logged in user info (email or userid) from google fit API

I am integrating google fit APIs for tracking fitness activities and I need to display logged in user email, but I am not able to fetch user info like email or userid from google fit.
I have found https://developers.google.com/fit/rest/v1/reference/users/dataSources/get but I need to add userId and dataSourceId in request parameters which I am unable to find.
You are looking at the wrong place.
The data you are looking for is under: People API v1.
Use the following scopes for oAuth:
https://www.googleapis.com/auth/userinfo.profile,
https://www.googleapis.com/auth/userinfo.email
Following url to fetch data:
https://people.googleapis.com/v1/people/me
A get call with access_token should be good for you. Enjoy :)

How to fetch user and page/company posts from linkedin

I have been checking the available linkedin API methods but cant see on how to fetch post by user and by page/company. What I need to do is that, user can enter username or a page/company name then, fetch news posts by it. Maybe you know some workarounds. Thanks
References:
https://developer.linkedin.com/docs/rest-api
https://apigee.com/console/linkedin?authTypeVal=oauth2&afterSuccessfulAuth=true
Since October 2016 Linkedin updated the API an restricted actions to sign in, share content and manage companies, so you only can fetch the company's posts.
If you already have the user(company's admin) token access use this endpoint for get the posts of the page:
GET "https://api.linkedin.com/v1/companies/{id}/updates?format=json"
Detail Infomation
For search user
https://api.linkedin.com/v1/people/~
Method : GET
Add a format=json URL argument to the end of your API call.
Add this
HTTP header to your API call: x-li-format: json

Paypal Payments (Authorization & Capture) not returning Authorization ID

According to the documentation the paypal payment method should be able to do Authorization & Capture just fine. The following excerpt under the PayPal authorizations excerpt specifically states how to go about it:
First get payment approval and execute the payment as you normally would do for a PayPal payment. Once you successfully execute on the payment authorization, PayPal responds with a new set of HATEOAS links, including a capture link that you use to capture the payment.
So if im following correctly the flow for doing Authorize & Capture is as follows:
Create a Payment
Redirect User to HATEOAS link approval_url to get them to sign into paypal.
Be returned to success (or cancel, but not in this example) link.
Get the Payment to see what's changed, get the shipping address / etc....
Let the customer review the details
Execute The Payment to commit to the hold on funds.
At this point an AuthorizationID / HATEOAS Link should hold information about the authorization.
Some time later use the authorization ID to Capture, and voila, we're done.
Now this is all fine and dandy, but in my tests on the sandbox environment I'm having trouble retrieving the authorization ID anywhere.
Here's my HATEOAS Links I receive from my Execute Step:
As you can see, only the self reference is returned, according to the documentation there should be one capture link at the least that should have the authorizationID in it.
Also, nowhere in the response body is any authorization ID. However, If I look at the payment in my sandbox paypal dashboard:
And once I drill down into it:
Sure enough if I call the Authorization.Capture API call against 8B633793L37511009 it captures as you would expect. However I can't find a programmatic way to determine this number.
How am I supposed to store the authorization number so my tooling can capture later when our business conditions have been met?
In the beggining, when you create the payment with intent authorize you should be getting an authorization object within the response. This object has the id you need for the capture later.
Check this blog post to see if you're missing something fundamental in the picture.
I followed the tutorial and executed the sample requests via curl. As you can see, I got the authorization id under transactions->related resources->authorization->id
Then I used the id in the URL and successfully captured the payment.
Hope this helps, if it doesn't, please elaborate and maybe I will be able to help you further. Good luck!

How do you get the contact information for a Foursquare user who checks in to your venue via 4sq's API?

I am currently writing an application as the owner of a particular venue. I want to be able to programmatically reach out to a user who checks in to the location via the contact information associated with their Foursquare account (if they've chosen to make that information public).
Based on the sample code provided with the Real-Time API, it doesn't look like contact information is returned here. Is there a way to crawl to the necessary info from the info returned via this endpoint?
You generally ought to actually be able to get the email from the actual push API response. Inside the user object should be a contact object, and the email field will be populated with their email. You can always also fall back to making a user details call to retrieve a user's contact info once you know their user ID.
However, please keep in mind our API platform policy when it comes to situations like this. From the policy: "You must not take any action that constitutes unauthorized or unsolicited advertising, junk or bulk e-mail."