Error trying to write data on google's fit web aplication via rest api - rest

I'm trying to write data on google's fit via rest api. The idea is to write data on google's rest api, and the goal is to show that information on both google fit's web and app.
The information that i'm trying to write is a session (equals to workout)
Request:
GET https://www.googleapis.com/fitness/v1/users/me/sessions/11xxxx
Body:
{
"id": "11xxxx",
"name": "My example workout",
"description": "A very intense workout",
"startTimeMillis": 1396710000000,
"endTimeMillis": 1396713600000,
"version": 1,
"lastModifiedToken": "exampleToken",
"application": {
"packageName": "com.google.android.apps.fitness",
"version": "web"
},
"activityType": 1
}
Response:
{
"error": {
"code": 403,
"message": "Application package name (com.google.android.apps.fitness) provided by un-trusted source.",
"errors": [
{
"domain": "global",
"message": "Application package name (com.google.android.apps.fitness) provided by un-trusted source.",
"reason": "forbidden"
}
]
}
}

Related

How can I generate a ad preview without requiring the ad account id in the Facebook Ads API?

Though it is mentioned in the docs about generating a preview without requiring the ad_account_id (https://developers.facebook.com/docs/marketing-api/generatepreview/v13.0). I even follow the parameters required. However, I keep getting this error (even though the endpoint was mentioned in the docs)
"error": {
"message": "Unsupported get request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "--"
}
Endpoint:
https://graph.facebook.com/<API_VERSION>/generatepreviews?ad_format=RIGHT_COLUMN_STANDARD&creative={
"object_story_spec": {
"link_data": {
"description": "Description",
"link": "<URL>",
"message": "Message",
"name": "Name"
}
}
}&access_token=<Access_Token>
However, It works when using the same endpoint but with the ad_account_id on it and with the same set of test data. So I assume there is no issue with my set of test data.
https://graph.facebook.com/<API_VERSION>/act_<ad_account_id>/generatepreviews?ad_format=RIGHT_COLUMN_STANDARD&creative={
"object_story_spec": {
"link_data": {
"description": "Description",
"link": "<URL>",
"message": "Message",
"name": "Name"
}
}
}&access_token=<Access_Token>
Maybe I'm missing something? Not really sure.
Thanks in Advance.

How do I use Marketo REST API with Postman?

I'm having a hard time trying to figure out how to properly use the Marketo REST API using Postman for testing purpose.
So far I can Authenticate and get my access_token,
but when I try to create a folder... (properly authenticated)
endpoint: [POST] /rest/asset/v1/folders.json
body:
{
"description": "Test Folder",
"name": "Test",
"parent": {
"id": 1,
"type": "Folder"
}
}
I get:
{
"success": false,
"errors": [
{
"message": "name cannot be null.",
"code": "701"
},
{
"message": "parent cannot be null",
"code": "701"
}
],
"requestId": "408a#1720c00a893",
"warnings": []
}
I don't know what I'm doing wrong.
See an example in the Marketo API documentation
Create/Update folder request should be an application/x-www-form-urlencoded not application/json
So in Postman, you have to post a form with three parameters:
parent={"id":416,"type":"Folder"}
name=Test 10 - deverly
description=This is a test
For the parent parameter you should specify a specific json-like text, which is a usual format for folderId
For generic folders (not programs) you can provide just integer id, without JSON structure, this is not recommended but can be used for manual API tests

How to create a BigQuery View using REST request

I've tried building and sending the REST request using the Google Tables: insert page with the following (sanitised) values:
Request parameters
projectId:prj-name
datasetId:dataset_name
Request body
{
"view": {
"useLegacySql": false,
"query": "SELECT * FROM `prj-name.dataset_name.hello_world`"
},
"type": "VIEW",
"tableReference": {
"projectId": "prj-name",
"datasetId": "dataset_name",
"tableId": "v_hello_world"
}
}
This post suggests these parameters should work, but Google returns the following response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Output field used as input"
}
],
"code": 400,
"message": "Output field used as input"
}
}
I've experimented with the REST properties and I think the 400 issue is caused by the inclusion of the tableReference property. But if I exclude it I get the following alternative error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Required parameter is missing"
}
],
"code": 400,
"message": "Required parameter is missing"
}
}
It's a shame that the "Required parameter" is not named in this error message!
I can use this code method to create the view but that code method throws an exception when patching views.
Help is appreciated. I'd rather not have to maintain two different ways of managing views in my code.
Thanks.
Remove "type": "VIEW", from your request.
That's not an input parameter. It's an output field from the response.
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables#resource

Download files from Google cloud storage

Can any one please tell me how to download or read the files from Google cloud storage without login/Authentication
when i tried the below link i am getting
https://www.googleapis.com/storage/v1/b/igvideos/o/test1235.txt
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Thanks
Thanigaivelan

Facebook Graph Search Error while searching "Event"

This is embarrassing, but I am at my wits end. While performing a very simple search for "Events" using fb Graph Search, I get the following error:
{
"error": {
"message": "(#200) Must have a valid access_token to access this endpoint",
"type": "OAuthException",
"code": 200
}}
This is the code I execute:
https://graph.facebook.com/search?q=conference&type=event&limit=1&access_token=XXXXXXXXXX|XXXXXXXXXX
It works JUST FINE for any other type of search - with the same access token for example:
https://graph.facebook.com/search?q=conference&type=place&limit=1&access_token=XXXXXXXXXX|XXXXXXXXXX
I get the following result:
{
"data": [
{
"category": "Local business",
"category_list": [
{
"id": "164243073639257",
"name": "Hotel"
}
],
"location": {
"street": "Langelaan 3",
"city": "Noordwijk",
"state": "",
"country": "Netherlands",
"zip": "2211XT",
"latitude": 52.251963727407,
"longitude": 4.4722281054509
},
"name": "NH Conference Centre Leeuwenhorst",
"id": "165032770219308"
}
],
"paging": {
"next": "https://graph.facebook.com/search?limit=1&type=place&access_token=XXXXXXXX|XXXXXXXXX&offset=1&__after_id=165032770219308"
}
}
At this point, I am out of ideas.
Facebook recently changed things in their API, Search was one of those things. You can only do this kind of search on Places and Pages now. To search events, you need an app access token. See this blog post: https://developers.facebook.com/blog/post/2013/04/03/platform-updates--operation-developer-love/
Fixed! I am now able to search for events by using an App Token generated using the new api. Thank everyone for your help