Is there still "no API to manage consumer googlegroups.com groups programatically"? - google-sheets

In an answer to this 2014 post
Unable to retrieve members of a google group, getting Invalid Input
you read: "There is no API to manage consumer googlegroups.com groups programatically".
Is this still the situation in 2018?
I tried to follow the suggestion in answer 3 of the post How to get the list of members in a Google group in Google app script (Admin SDK)? but I get the following error message:
ReferenceError: "AdminDirectory" is not defined. (line 9, file "Code")
where line 9 (and following) is (are):
page = AdminDirectory.Members.list(groupKey,
{
domainName: 'googlegroups.#com',
maxResults: 500,
pageToken: pageToken,
});
Searching to understand the error I found the reference page for Members: list. Using the "Try this API" form in that page I get the error reported in the first post I mentioned.
If it is NOT true that "There is no API to manage consumer googlegroups.com groups programatically", is there a guide to copy the list of the members of a group I own in a google-sheet sheet? (I mean to copy via a function, non by hand exporting and reimporting the CSV)
Many thanks, Roberto Scotti

It's 2021 and I still can't find any evidence there's an API for #googlegroups.com groups, sadly.

Related

Slack Conversations API conversations.kick returning "channel_not_found" for a public channel

I am writing a Slack integration that can boot certain users out of public channels when certain conditions are met. I have added several OAuth scopes to the bot token, including the following:
channels:history
channels:manage
channels:read
chat:write
chat:write.public
groups:write
im:write
mpim:write
users:read
I am writing my bot in Python using the slack-bolt library and asyncio. However when I try to invoke this code:
await app.client.conversations_kick(channel=channel_id, user=user_id)
I get the following error:
slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://www.slack.com/api/conversations.kick)
The server responded with: {'ok': False, 'error': 'channel_not_found'}
I know for a fact that both the channel_id and user_id arguments I'm passing in are valid. The channel ID I'm using is the string C01PAE3DB0A. I know it is valid because I can use the very same value for channel_id in the following API call:
response = await app.client.conversations_info(channel=channel_id)
And when I call conversations_info like that I get all of the information about my channel. (The same is true for calling users_info with the user_id - it returns successfully.) So why is that when I pass my valid channel_id parameter to conversations_kick I consistently receive this channel_not_found error? What am I missing?
So I got in touch directly with Slack support about this and they confirmed that there is a bug on their end. Specifically, the bug is that I should have received a restricted_action error response instead of a channel_not_found response. Apparently this is a known issue that is on their backlog.
The reason the API call would (try to) return this restricted_action error is simply because there is a workspace setting that, by default, prevents non-admins from kicking people out of public channels. Furthermore, this setting can only be changed by the workspace owner - one tier above admins.
But assuming you are the owner of the Slack workspace, you simply have to log into the Settings & Permissions page, which should look something like this:
And then you have to change the setting labeled "People who can remove members from public channels" from "Workspace admins and owners only (default)" to "Everyone, except guests."
Once I made that change, my API calls started succeeding.

Creating a shared link for an item in a Sharepoint list returns BadRequest - resource not found

Per documentation there's an option to create a sharing link for an item in a Sharepoint list - https://learn.microsoft.com/en-us/graph/api/listitem-createlink?view=graph-rest-beta&tabs=http
Tested it with code and all I get are bad requests
endpoint = https://graph.microsoft.com/v1.0/sites/mysharepointsite/lists/mytestlist/items/1/createLink
result:
{'error': {'code': 'BadRequest',
'innerError': {'client-request-id': '64033979-ec68-493a-84e5-881c93870f5c',
'date': '2022-12-02T13:45:22',
'request-id': '64033979-ec68-493a-84e5-881c93870f5c'},
'message': "Resource not found for the segment 'createLink'."}}
Is the API broken on this particular topic?
P.S. Removing the createLink option at the end returns the expected details of that specific item.
createLink endpoint is currently available only for Beta version but you are calling v1.0 version.
Use beta in URL
POST https://graph.microsoft.com/beta/sites/mysharepointsite/lists/mytestlist/items/1/createLink

Error using ActiveMerchant::Billing::AuthorizeNetCimGateway with Authorize.Net's opaqueData

Feb 8, 2018
My Ruby on Rails application has been successfully using ActiveMerchant::Billing::AuthorizeNetCimGateway with the payment type :credit_card for creating a customer profile with an embedded payment profile.
I'm now in the process of migrating to Authorize.Net's Accept.js which accepts credit card info directly sent from their hosted payment form and returns a payment nounce of type COMMON.ACCEPT.INAPP.PAYMENT that can be used for one time to create a payment transaction, customer profile, etc.
I constructed a payment_profile hash with :opaque_data in place of :credit_card. For example:
> payment_profile
=> {:payment=>
{:opaque_data=>
{:data_descriptor=>"COMMON.ACCEPT.INAPP.PAYMENT",
:data_value=> "eyJjb2RlIjoiNTBfMl8wNjAwMDUzNjBDMzAwOUQ3OEUzOUQ1MDk4QTYxMjFGNzlCQ0Y3RDRGQUE4NTNCMEU3MkYyMUJBNTI3NUE0NjQ2Q0ZFQTVFNzMxMDI2Qjg5ODJGNjBFRUE2RDZFMTZCMUY5NzQ4NUJFIiwidG9rZW4iOiI5NTE4MDc3Njg5NDA4MTAwOTAzNTAyIiwidiI6IjEuMSJ9"}},
:bill_to=>{:first_name=>"Firstname", :last_name=>"Lastname", :address=>nil, :city=>nil, :state=>nil, :zip=>nil, :country=>nil, :phone_number=>"(012) 234-5678"}}
I then tried to create a customer profile with an existing code similar to the following:
response = #gateway.create_customer_profile profile: {
email: client.email,
description: client.name,
merchant_customer_id: client.id,
payment_profiles: payment_profile
}
However, I received a response which had a result_code of Error and complained about "incomplete content" for element payment as follows:
> response
=> #<ActiveMerchant::Billing::Response:0x007f9827d14900
#authorization=nil,
#avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
#cvv_result={"code"=>nil, "message"=>nil},
#emv_authorization=nil,
#error_code="E00003",
#fraud_review=nil,
#message=
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.",
#params=
{"messages"=>
{"result_code"=>"Error",
"message"=>
{"code"=>"E00003",
"text"=>
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."}}},
#success=false,
#test=true>
I have a few questions in my mind:
Does ActiveMerchant::Billing::AuthorizeNetCimGateway even support Accept.js' :opaque_data in place of :credit_card?
If ActiveMerchant::Billing::AuthorizeNetCimGateway does support :opaque_data, what's may be wrong with the above payment_profile and what other content that I'd need to provide for payment element?
I'd appreciate any help in resolving this issue.
While this question is over 4 years old, and I'm assuming you have either found a solution or abandoned your effort, I ran into this same issue recently, and thought it would be helpful to add my findings in case someone else runs into this.
the AuthorizeNetCimGateway does not currently support Accept.js' opaqueData. In looking at the sourcecode for the active_merchant gem, specifically in /lib/active_merchant/billing/gateways/authorize_net_cim.rb, there is ultimately a method add_payment_profile that gets called. In that method, specifically on lines 759-761, you can see that the options are either a credit_card, bank_account, or drivers_license. A tokenized payment is not currently supported.
That being said, there is an open PR#2422 that adds support for this. At the time of writing this, it appears to be failing some rubocop specs, but hopefully it can get deployed in the near future!

I'm getting troubles while uploading to Youtube with google java client: "Invalid value for: listed is not a valid value"

I'm trying to upload videos using https://code.google.com/p/youtube-api-samples/source/browse/samples/java/youtube-cmdline-uploadvideo-sample/src/main/java/com/google/api/services/samples/youtube/cmdline/youtube_cmdline_uploadvideo_sample/UploadVideo.java example
I've successfully registered on the youtube console and have obtained the client_secrets.json at https://code.google.com/apis/console/?api=youtube#project:340964720118:access
I have installed the secrets so my app can access them; everything is compiled well, but when the program is executed, I'me getting that strange errors:
GoogleJsonResponseException code: 400 : Invalid value for: listed is not a valid value
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid value for: listed is not a valid value",
"reason" : "invalid"
} ],
"message" : "Invalid value for: listed is not a valid value"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
I can't find out what is wrong; since the request itself is deeply encapsulated, I can't understand what is wrong with the request...
UPD.
Thanks to
System.out.println(videoInsert.getHttpContent().toString());
call inserted before the
Video returnedVideo = videoInsert.execute();
in the sample code, I got that the JSOn formed and sent to the google is
{snippet={description=Video uploaded via YouTube Data API V3 using the Java library on Sun Sep 29 20:29:30 MSK 2013, tags=[test], title=Test Upload via Java on Sun Sep 29 20:29:30 MSK 2013}, status={privacyStatus=listed}}
But actually there is still a question what is wong with this json and why it causes the error on the the server side.
UPD 2:
And no I no longer get the message above, but the upload is still impossible. I'm getting 401 Error while trying to upload the file in that lines of the example above:
System.out.println(videoInsert.getJsonContent().toString());
System.out.println(videoInsert.getHttpContent().getType());
Video returnedVideo = videoInsert.execute();
System.out.println(returnedVideo.getId());
I supposed that I haven't authorized the request to my personal data, but I actually DID it (the request was loaded to the default browser where I have accepted it and specified the account I would like to work with). However, there is no way to check that authoriation; my google account data holds only Apps and Activity log for the google+ apps; I haven't fount my app in the list. So where I can check where I'm not logged in?
IOException: 401 Unauthorized
com.google.api.client.googleapis.json.GoogleJsonResponseException: 401 Unauthorized
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:423)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)
at ScreenRecordingExample.UploadToYoutube(ScreenRecordingExample.java:356)
Ok, I have found out that the problem appeared due to the incorrect privacyStatus value:
I had
status.setPrivacyStatus("listed");
in my code, while it seems that only public, unlisted and private are possible values
And the UPD-2 problem was resolved unfortunately in the way i don't know exactly how:
i have noticed, that in my code example there was a line
return new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user");
I have replaced 'user' with my google user name (but actually I'm not sure that it was a thing that was really needed). After that replacement the authorization attempt started again (default browser loaded the accept/decline page and there I should select one of two accounts). Since I have two accounts, the original youtube one and the common google one, and during the last attempt I have selected the google's one and got 401 error, I have selected the youtube's one this time.
so, after that the problem was resolved. I still don't know do it due to the correct username instead of 'user' or due to the correct account selection. If someoune kows the truth, please comment!

How do I fetch orgusers beyond the 1st 100 using the Google Apps OrgUser provisioning API feed

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):
apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all
This works well for <= 100 users.
Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination
Here's the start of my orguser feed:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>
I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.
So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?
Please help - this is blocking an urgent delivery.
Thanks!,
Vinay.
Your 2nd request should look like:
https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all
startKey should be set to the value of the next parameter and get should continue to be all for each page request.
Also, make sure the URL is decoded, if & is encoded as & in the request, then Google's servers will see all of all&startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Resources