Google Consent API - google-cloud-healthcare

The samples and documentation for the Cloud Healthcare Consent API need a refresh. For instance, when POST to attributeDefinitions?attributeDefinitionId=requester_identity
with BODY:
{
"description": "what groups are consented for access",
"category": "REQUEST",
"allowedValues": [
"fhirUser"
]
}
{
"error": {
"code": 400,
"message": "attribute definition ID malformed, must match ^[_a-zA-Z][_a-zA-Z0-9]{0,255}$",
"status": "INVALID_ARGUMENT"
}
}
These are the values straight from the documentation.

This was an error on my side. The proxy was dropping the query string parameter. The value in the documentation is correct.

Related

The forbidden error occurs, when I try to link an account to another user with an email

I have a user's refresh token with these scopes:
'https://www.googleapis.com/auth/analytics https://www.googleapis.com/auth/analytics.edit https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/analytics.manage.users’’
The user has a few accounts and a forbidden error occurs for XXXX2 account when I try to give access to an account to another user(you can see at the below code and account list json). I checked this account's effective permission field, I see that it is an empty array as you can see below as well.
In my opinion, this error reason is that this user does not have ‘manage_users’ permissions for this account(XXXX2), so this is an expected error, isn't it?
PS: I can link XXXX1 properly with the below code.
My code :
linkAccount = self.service.management().accountUserLinks().insert(
accountId=accountId,
body={
'permissions': {
'local': [
'EDIT',
'MANAGE_USERS'
]
},
'userRef': {
'email': email}}).execute()
User Account list :
{
"id": "XXXX1",
"kind": "analytics#account",
"selfLink": "https://www.googleapis.com/analytics/v3/management/accounts/XXXX1”,
"name": "XXXX1",
"permissions": {
"effective": [
"COLLABORATE",
"EDIT",
"MANAGE_USERS",
"READ_AND_ANALYZE"
]
},
"created": "2014-02-17T17:52:10.911Z",
"updated": "2019-06-04T16:06:12.717Z",
"childLink": {
"type": "analytics#webproperties",
"href": "https://www.googleapis.com/analytics/v3/management/accounts/XXXX1/webproperties"
}
},
{
"id": "XXXX2”,
"kind": "analytics#account",
"selfLink": "https://www.googleapis.com/analytics/v3/management/accounts/XXXX2”,
"name": "XXXX2",
"permissions": {
"effective": []
},
"created": "2015-07-02T19:11:16.307Z",
"updated": "2019-03-05T21:16:19.552Z",
"childLink": {
"type": "analytics#webproperties",
"href": "https://www.googleapis.com/analytics/v3/management/accounts/XXXX2/webproperties"
}
}
Error Code :
<HttpError 403 when requesting https://analytics.googleapis.com/analytics/v3/management/accounts/XXXXX/entityUserLinks?alt=json returned "User does not have permission to perform this operation.". Details: "User does not have permission to perform this operation."
I would check what access the currently authenticated user has to the account in question.
If the user you are authenticated with only has read access. To the Analytica account there not going to be able to give your application the ability to add another user.

Sending a notification through Firebase's FCM API Test

I'm currently trying to send a notification using the " Try this API " interface of Firebase.
I filled my Request Body with this :
{
"validateOnly": false,
"message": {
"notification": {
"body": "Body",
"title": "Title"
}
}
}
and the RequestParameters with
projects/myprojectid
I didn't check the Google API Key since my project doesn't have one, but I checked the Google OAuth 2.0.
After executing, I get this error :
{
"error": {
"code": 400,
"message": "Recipient of the message is not set.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "message",
"description": "Recipient of the message is not set."
}
]
},
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "INVALID_ARGUMENT"
}
]
}
}
After some research, I don't understand what is missing in the request. Are all the parameters mandatory for the request ?
You're not specifying who the message is for, which is what the error message is trying to tell you. You can do by either including a token key with one of more device tokens, or a topic or condition key in the JSON.
Also see the Firebase documentation on building requests to send a message for more information and examples of each of these.

Google Calendar Events Watch 400 pushNotSupportedForRequestedResource

I am trying to subscribe to all user's calendars, but some calendars do not support this functionality.
Request:
POST https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events/watch
Response:
{
"error": {
"errors": [
{
"domain": "calendar",
"reason": "pushNotSupportedForRequestedResource",
"message": "Push notifications are not supported by this resource."
}
],
"code": 400,
"message": "Push notifications are not supported by this resource."
}
}
How I can find out whether the current calendar support "watch"?
Does it corresponding to "accessRole" from calendar#calendarListEntry.accessRole

Adding ACL records for FreeBusyReader

I am trying to add a new ACL record to add a domain as freeBusyReader as described here.
Whenever I POST to
https://www.googleapis.com/calendar/v3/calendars/r...#resource.calendar.google.com/acl with a new domain I receive an error:
# Request
{
"scope": {
"type": "domain",
"value": "domain.com"
},
"role": "freeBusyReader"
}
# Reply
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
Weirdly though, it works for domains for which there is already some ACL rule. Those I can even change, so I assume that neither existence of the resource nor authorization is not the problem as suggested in the docs.
You can check this documentation about How to update the ACL of a Google Calendar with the Google APIs Explorer. If the user you want to grant access to is included in the response, you can proceed to update the ACL of the calendar.
For more info:
Working with ACl in Google Calendar

permission error while making ugc video post on linkedin

I am trying to create video post on linkedin with new ugc endpoint
there are two steps to create this type of post
1). Upload video asset on linkedin server (done)
2). make post request to ugc endpoint with request body
I have successfully uploaded the video but getting authentication error for ugc post request. error is
{
"message": "urn:li:developerApplication:<id1> does not have permission to create ugc posts with author: li:member:<id2>",
"status": 401
}
I am passing the request body as suggested in the linkedin api docs.
{
"author": "urn:li:person:<id>",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"media": [
{
"title": {
"attributes": [],
"text": "Sample Video Create"
},
"description": {
"attributes": [],
"text": "Sample Description"
},
"media": "urn:li:digitalmediaAsset:<asset_id>",
"thumbnails": [],
"status": "READY"
}
],
"shareCommentary": {
"attributes": [],
"text": "Some share text"
},
"shareMediaCategory": "VIDEO"
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
},
"targetAudience": {
"targetedEntities": [
{
"locations": [
"urn:li:country:us"
]
}
]
}
}
Please suggest how I can solve this problem. From error message it seems like I am not providing some permission. But I am not sure where I am making mistake.
This is the response I got from the LinkedIn Developer Support:
"Hi Ervin,
Creating video UGC posts is currently a whitelisted feature. There is currently hold on whitelisting new apps for video.
You may continue to create UGC posts that are not video though.
I'll put this on hold until I have more information on when we can whitelist apps again.
Best,
Alex"

Resources