Google Fit API Rest create data source - api

I'm learning how to use Google Fit API and right now I'm trying to do the examples Google offers to explore the OAuth 2.0 Playground.
There's one example to create a data source whose code is:
POST
https://www.googleapis.com/fitness/v1/users/me/dataSources
{
"name": "example-fit-heart-rate",
"dataStreamId":
"raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456",
"dataType": {
"field": [{
"name": "bpm",
"format": "floatPoint"
}],
"name": "com.google.heart_rate.bpm"
},
"application": {
"packageName": "com.example.fit.someapp",
"version": "1.0"
},
"device": {
"model": "example-fit-hrm-1",
"version": "1",
"type": "watch",
"uid": "123456",
"manufacturer":"Example Fit"
},
"type": "raw"
}
when I write that code down in the OAuth Playground I have this error message:
{
"error": {
"status": "INVALID_ARGUMENT",
"message": "Expected dataStreamId to be [raw:com.google.heart_rate.bpm:com.example.fit.someapp:Example Fit:example-fit-hrm-1:123456], but was [raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456]",
"code": 400,
"errors": [
{
"reason": "invalidArgument",
"message": "Expected dataStreamId to be [raw:com.google.heart_rate.bpm:com.example.fit.someapp:Example Fit:example-fit-hrm-1:123456], but was [raw:com.google.heart_rate.bpm:1234567890:Example Fit:example-fit-hrm-1:123456]",
"domain": "global"
}
]
}
}
I guess is because of the structure of the dataStreamID but I find it strange because I didn't change any code from the Google site. Also I tried to delete the dataStreamID, change the numbers, try this format type:dataType.name:developer project number:device.manufacturer:device.model:device.uid:dataStreamName
but I have no results.
I'm no pretty sure of how does the dataStreamID structure works so if anyone could explain it to me that would be great.
The link of this Google Fit site:
[https://developers.google.com/fit/rest/v1/workout?hl=es-419]
Hope someone can help me.
Thank you!!!

Related

2022: Get LinkedIn Posts via Access Token

I have been looking for an updated version of how to retrieve my own posts from LinkedIn via an access token which I have received from completing a three-legged OAuth process.
I have reviewed: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?view=li-lms-unversioned&tabs=http#permissions- but its now showing as legacy.
As it seems, LinkedIn unfortunately no longer wants us to retrieve this kind of content:
"Find Posts by authors is only supported for organization authors.
Finding by member authors is not supported."
Source
Neither a good, nor a solution within the LinkedIn-TOS (I assume) would be to use a webscraper. I have seen some solutions online but they are all very pricey in my opinion (and you never know if they get shut down by LinkedIn)
{
"activity": "urn:li:activity:12345657",
"content": {
"contentEntities": [
{
"entity": "urn:li:article:0",
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [
{
"imageSpecificContent": {},
"resolvedUrl": "https://www.example.com/image.jpg"
}
]
}
],
"description": "content description",
"title": "Test Share with Content"
},
"created": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967236000
},
"distribution": {
"linkedInDistributionTarget": {}
},
"id": "6173878065928642560",
"lastModified": {
"actor": "urn:li:person:A8xe03Qt10",
"time": 1471967237000
},
"owner": "urn:li:organization:123456789",
"text": {
"text": "Test Share!"
}
}

Chef Automate API

Starting to use the Chef Automate API.
I'm new to using APIs and I am confused as to what they mean by "Authorization Action" as listed on the documentation site:
I am using Postman as my utility/tool, and I have a Chef Automate admin API key. When I do a query:
GET {{ChefAutomateURL}}/apis/iam/v2/users?id=userid3
I would assume the reply would be only for that single user, but instead i'm getting everyone returned:
{
"users": [
{
"name": "user1",
"id": "userid1",
"membership_id": "a745cc00-8521-42a6-97ca-a60ccef931"
},
{
"name": "user2",
"id": "userid2",
"membership_id": "22e8e761-443b-45a3-9bdf-6ab4ccf79a"
},
{
"name": "user3",
"id": "userid3",
"membership_id": "67d2e924-2424-44d0-854d-c303f6c5ec"
}
]
}
... and I'm really confused as to why this isn't working.
This extends into my real desire, which is creating a local admin user, but again, when I try to do that, the response is just a JSON body with everyone:
POST {{ChefAutomateURL}}/apis/iam/v2/users
with this raw body:
{
"id": "userid4",
"name": "user4",
"password": "str0ng_password!"
}
I get a 200(OK) response like:
{
"users": [
{
"name": "user1",
"id": "userid1",
"membership_id": "a745cc00-8521-42a6-97ca-a60ccef931"
},
{
"name": "user2",
"id": "userid2",
"membership_id": "22e8e761-443b-45a3-9bdf-6ab4ccf79a"
},
{
"name": "user3",
"id": "userid3",
"membership_id": "67d2e924-2424-44d0-854d-c303f6c5ec"
}
]
}
I assume it has something to do with the "Authorization Action" as that's the only thing I'm not explicitly sending, but I don't understand what that is, or where/how it fits into the query.
I appreciate the help, thank you!

Zoho Recruit API Register / Login Candidate

Could someone guide me an idea of how to create the registration and login for candidates with the Recruit api? I'm making a flutter app and I need my candidates to register and log in trow the app and see the job opening, post jobs.
At the moment I created the user with [POST] https://recruit.zoho.com/recruit/v2/Candidates
{
"data": [
{
"Email": "mail#gmail.com",
"First_Name": "TheName",
"Last_Name": "TheLastName",
"Mobile": "000000000",
"Expected_Salary": "8000000",
"Country": "PY",
"Departamento": "Central",
"C_I": "37114594",
"Ciudad_de_residencia": "City",
"$Password":"myPassWord199**"
}
],
"trigger": [
"approval",
"workflow",
"blueprint"
]
}
Works Well, got success
{
"data": [
{
"code": "SUCCESS",
"details": {
"Modified_Time": "2022-06-15T20:47:23-04:00",
"Modified_By": {
"name": "Admin",
"id": "00000000000000"
},
"Created_Time": "2022-06-15T20:47:23-04:00",
"id": "00000000000000",
"Created_By": {
"name": "Admin",
"id": "00000000000000"
}
},
"message": "record added",
"status": "success"
}
]
}
But If I try to log in in the web version (for testing the new candidate) don't work, but if it see the dashboard, the user exist. Need to add something else?
Basically I need a register api and a login one for the created record of the candidate.
Any help will be awesome, Thanks

How to get number of googleplus page followers?

is there actually a possibility to get the number of followers of my googleplus-page. the following script - which I found here in an earlier post - doesn't work (no output):
$google_api_key = 'XYZXYZXYZXYZXYZXYZ';
$page_id = 'MYNUMERICPAGEID';
$data = #file_get_contents("https://www.googleapis.com/plus/v1/people/$page_id?key=$google_api_key");
$data = json_decode($data, true);
echo $data['plusOneCount'];
thank you!
There could be a few things wrong:
Don't have an updated project on the Developer Console.
Didn't enable the API for that project.
Are past thresholds/quotas.
Try the following:
Login to your Google Developers Console
You'll need a project.
If you don't have a project, create one.
Enable "Google Plus API" on that project.
Confirm usage/quotes are within tolerance and you haven't gone past.
From there, your call should work as normal:
GET https://www.googleapis.com/plus/v1/people/{USER_ID}?key={YOUR_API_KEY}
In my case, I'm querying Google's's page, so {USER_ID} = 116899029375914044550. I can then see the plusOneCount:
{
"kind": "plus#person",
"etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/bTf-sq_Sg3fLAFijixPfjtKM5f8\"",
"urls": [
{
"value": "http://www.google.com",
"type": "website",
"label": "www.google.com"
},
{
"value": "http://www.google.com/support/",
"type": "other",
"label": "Google Help"
},
{
"value": "http://googleblog.blogspot.com/",
"type": "other",
"label": "Official Blog"
},
{
"value": "http://twitter.com/#!/google",
"type": "other",
"label": "#google"
},
{
"value": "http://www.google.com/about/corporate/company/",
"type": "other",
"label": "Company Info"
},
{
"value": "http://www.google.com/press/",
"type": "other",
"label": "News"
},
{
"value": "http://www.google.com/press/google-directory.html",
"type": "other",
"label": "More Google pages"
}
],
"objectType": "page",
"id": "116899029375914044550",
"displayName": "Google",
"tagline": "News and updates on Google's products, technology and more",
"aboutMe": "<p>Welcome to Google's official page. Here, you'll find product news and announcements, company updates, glimpses into what it's like to work at Google, discussions on technology and the web, and much more. </p><p><span>Given the volume of feedback we receive here, we may not be able to respond individually to every comment and we're not able to provide product support (if you're having product issues, please visit our Help Center). Rest assured we're paying attention, and we're always eager to hear from you.</span></p>",
"url": "https://plus.google.com/+google",
"image": {
"url": "https://lh4.googleusercontent.com/-v0soe-ievYE/AAAAAAAAAAI/AAAAAAAC9wQ/JD8tdz3bFTM/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"plusOneCount": 10757884,
"circledByCount": 7692912,
"verified": true,
"cover": {
"layout": "banner",
"coverPhoto": {
"url": "https://lh4.googleusercontent.com/-PLPoXvnN0XI/UTdr4xTtuHI/AAAAAAAA_1U/p1n_Za3BZUg/s630-fcrop64=1,00000000fe06fe97/g_plus_background.png",
"height": 528,
"width": 940
},
"coverInfo": {
"topImageOffset": 0,
"leftImageOffset": 0
}
}
}

Invalid Path error while inserting job from google cloud storage to google bigquery

I am trying to insert a job through HTTP Post request, but i am getting Invalid path error.
My request body is as follows:
{
"configuration": {
"load": {
"sourceUris": [
"gs://onianalytics/PersData.csv"
],
"schema": {
"fields": [
{
"name": "Name",
"type": "STRING"
},
{
"name": "Age",
"type": "INTEGER"
}
]
},
"destinationTable": {
"datasetId": "Test_Dataset",
"projectId": "lithe-anvil-404",
"tableId": "tb_test_Pers"
}
}
},
"jobReference": {
"jobId": "10",
"projectId": "lithe-anvil-404"
}
}
For the sourceuri parameter, I am passing "gs://onianalytics/PersData.csv", where onianalytics is my bucket name and PersData.csv is my csv file (from which I want to upload data into google bigquery).
I am getting below response:
"status": {
"state": "DONE",
"errorResult": {
"reason": "invalid",
"message": "Invalid path: gs://onianalytics/PersData.csv"
},
"errors": [
{
"reason": "invalid",
"message": "Invalid path: gs://onianalytics/PersData.csv"
}
]
},
"statistics": {
"creationTime": "1387276603674",
"startTime": "1387276603751",
"endTime": "1387276603751"
}
}
My bucket is under the same projectid which has the BigQuery service activated. Also, I have Google Cloud Storage enabled under APIs and Auth. Following scopes are added while authenticating:
googleapis.com/auth/bigquery, googleapis.com/auth/cloud-platform, googleapis.com/auth/devstorage.full_control,googleapis.com/auth/devstorage.read_only,googleapis.com/auth/devstorage.read_write
I am inserting this job by "Try it!" link which is available on developers.google.com/bigquery/docs/reference/v2/jobs/insert.
In fact I am able to create buckets and objects in goggle cloud storage through APIs. But when i try to insert job from the uploaded object (which is a csv file), i got "Invalid Path" error. Can anyone please help me to identify why this error is occurring?
The error I get when trying the code above is "Not found: URI gs://onianalytics/PersData.csv".
I'm wondering if instead of /onianalytics/ you had a different path with invalid characters?