Sharing debuger from Graph API not working - api

I am sending a POST request to the API with data as on this page https://developers.facebook.com/docs/sharing/opengraph/using-objects
"id" : <domain>,
"scrape": True,
"access_token" : <token>
But in response I get an error
{
"error": {
"message": "Unsupported post request. Object with ID '<domain>' does not exist,
cannot be loaded due to missing permissions, or does not support this
operation. Please read the Graph API documentation at ...",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "A4szfMq_LpEo8ne_xipo3ky"
},
"__fb_trace_id__":"An9T1FjDJD2",
"__www_request_id__":"A4szfMq_LpEo8ne_xipo3ky"
}

Related

Whatsapp Cloud API - Account does not exist in Facebook Hosted API, please use /register API to create an account first

I am trying to send a WhatsApp message using Facebook graph API
https://graph.facebook.com/v13.0/107858631967863/messages
with below payload
**{
"messaging_product": "whatsapp",
"to": "XXXXXXXXX",
"type": "template",
"template": {
"name": "hello_world",
"language": {
"code": "en_US"
}
}
}**
But I am getting below error message ,
**{
"error": {
"message": "An unknown error occurred",
"type": "OAuthException",
"code": 1,
"error_subcode": 2593006,
"is_transient": false,
"error_user_title": "Account Not Exist",
"error_user_msg": "Account does not exist in Facebook Hosted API, please use /register API to create an account first.",
"fbtrace_id": "ApD14BKT4ZcnAmQe7aMNBYH"
}
}**
You need to first register the number on WhatsApp Cloud API before you can begin messaging. Checkout their developer docs: https://developers.facebook.com/docs/whatsapp/cloud-api/reference/registration
Note, you will need to add the number to the Business Manager account and verify it in the process first.

403 Error creating dataSource for com.google.blood_pressure in Google Fit REST API

Goal:
I have a simple web application where I submit my Blood Pressure and Heart Rate measurements.
Now I'd like to submit these measurements to my Google Fit Account.
I tried Googles tutorial: https://developers.google.com/fit/scenarios/write-bp-data
OAuth2 Setup
I created new credentials in one of my existing Cloud Console Projects. And then requested a new authorization code using the following scopes (The project is in Testing State and my account is registered as tester):
https://www.googleapis.com/auth/fitness.blood_pressure.write
https://www.googleapis.com/auth/fitness.heart_rate.write
Requesting the token returns the following response:
{
"access_token": "ya29.XXXXXXXXXXXXXXXX",
"expires_in": 3599,
"refresh_token": "1//XXXXXXXXXXXXXXXX",
"scope": "https://www.googleapis.com/auth/fitness.heart_rate.write https://www.googleapis.com/auth/fitness.blood_pressure.write",
"token_type": "Bearer"
}
As you can see, both write scopes are granted.
Additionally, if I check the permissions in my Google Account, both scopes are set.
Create dataSource
Now I create two dataSources (one for com.google.heart_rate.bpm and one for com.google.blood_pressure).
creating the Heart Rate dataSource works as expected, but creating a dataSource for Blood Pressure returns a 403 PERMISSION_DENIED Error:
Request (POST https://www.googleapis.com/fitness/v1/users/me/dataSources)
{
"dataStreamName": "BPA-BloodPressure",
"type": "raw",
"application": {
"detailsUrl": "https://aaa.bbb.ccc",
"name": "Blood Pressure App",
"version": "1"
},
"dataType": {
"name": "com.google.blood_pressure"
}
}
Response
{
"error": {
"code": 403,
"message": "Scope not included to modify data of type com.google.blood_pressure. Possible scopes: https://www.googleapis.com/auth/fitness.blood_pressure.write",
"errors": [
{
"message": "Scope not included to modify data of type com.google.blood_pressure. Possible scopes: https://www.googleapis.com/auth/fitness.blood_pressure.write",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}
The Google Fit REST API tells me that the Scope fitness.blood_pressure.write is missing, but as you can see the Scope is given for the used access token.
Notes
I am working with Postman to test all requests. Later a Java/Groovy or PHP backend will used.
I also tried with read and write scopes for both data types.
I can see my app with both write scopes in Google Fit under "Connected apps".
Change dataType name to "fitness.blood_pressure" instead of "com.google.blood_pressure"
The body will be like this.
{
"dataStreamName": "BPA-BloodPressure",
"type": "raw",
"application": {
"detailsUrl": "https://aaa.bbb.ccc",
"name": "Blood Pressure App",
"version": "1"
},
"dataType": {
"name": "fitness.blood_pressure"
}
}

Youtube Analytics API - HTTP request for Associated Channel's data

I am new to YouTube Analytics API.
Could you please help me to retrieve data from my associated YouTube channel.
I have populated the data using “youtubeAnalytics.reports.query” in the APIs Explorer window.
But when I am trying to use the below HTTP request
https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D{MY_ASSOCIATED_CHANNEL_ID}&start-date=2016-08-01&end-date=2016-08-31&metrics=views&dimensions=video&filters=video%3D%3D{MY_VIDEO_ID}&max-results=10&sort=-views&key={MY_API_KEY}
It shows an error message “Login Required”
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Could you please help me to correct my HTTP request to populate the data.
Thanks,
Aneesh
As far as I know most all of the YouTube Analytics API is private data. Being that its private data you need to be authenticated in order to access it.
Your error "Login Required" means exactly that you need to be authenticated to access the data you are requesting. Probably using the scope
https://www.googleapis.com/auth/yt-analytics.readonly
Once you have authenticated your application you can do access_token={Access token gotten from authentication} in order to access that data.

Downloading a public shared file from Google Drive (encountering 500 error)

I run this request:
https://www.googleapis.com/drive/v3/files/1TcBDyugpHQSyUCLZcM0XtHOXo0S9Neh6asQUAYh54EM/export?mimeType=application%2Fpdf&key=[apiKey]
on this public file:
https://docs.google.com/document/d/1TcBDyugpHQSyUCLZcM0XtHOXo0S9Neh6asQUAYh54EM/edit
which is clearly exportable as PDF. I run this same query via Google's API explorer: Files: export
With whatever credentials it grabs, it tells me the response is 200 OK with application/pdf data. However, running the query manually in the browser gives me:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "internalError",
"message": "Internal Error"
}
],
"code": 500,
"message": "Internal Error"
}
}
I had a similar problem with a 400 using the normal File.get method:
https://www.googleapis.com/drive/v3/files/1TcBDyugpHQSyUCLZcM0XtHOXo0S9Neh6asQUAYh54EM?alt=media&key=[api key]
returning:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Am I just doing something wrong? Any help appreciated!
API key is used for accessing PUBLIC data. Unless your file is set to public your not going get it using an API key. You will need to be authenticated using Oauth2 and use an access token
https://www.googleapis.com/drive/v3/files/1TcBDyugpHQSyUCLZcM0XtHOXo0S9Neh6asQUAYh54EM?alt=media&access_token=[token]
Error documentation:
400: Bad Request
User error. This can mean that a required field or parameter has not been provided, the value supplied is invalid, or the combination of provided fields is invalid.

Foursquare API - Tastes

When I try to send a GET request to Foursquare API below, I get "No matching endpoint." error.
I have validated my tokens and everything seems normal. Any advices?
REQUEST URL
https://api.foursquare.com/v2/users/USER_ID/tastes
RESPONSE MESSAGE
{
"meta": {
"code": 404,
"errorType": "endpoint_error",
"errorDetail": "No matching endpoint"
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {}
}
FoursquareAPI twitter account has told me that I needed to pass m=foursquare in addition to version information.
The correct endpoint information is like
https://api.foursquare.com/v2/users/USER_ID/tastes?oauth_token=TOKEN&v=20150420&m=foursquare
The detailed information about v and m parameters are below.
https://developer.foursquare.com/overview/versioning