Google Apps .NET Client - c#

I was googling after a Google Apps API .NET client and found the following one which seems rather old.
The Google Data page (which is the API that the mention client uses) states the following:
Most newer Google APIs are not Google Data APIs. The Google Data APIs documentation applies only to the older APIs that are listed in the Google Data APIs directory. For information about a specific new API, see that API's documentation. For information about authorizing requests with a newer API, see Google Accounts Authentication and Authorization.
Does that mean that the Google Data APIs will be obsoleted?
Should I use another API/Client instead?
https://developers.google.com/google-apps/contacts/v3/ (newest API) does not list any .NET client implementations.

The Contacts API v3 is still a Google Data API and as such it is supported by the .NET library for the Google Data API:
http://code.google.com/p/google-gdata/
The documentation at https://developers.google.com/google-apps/contacts/v3/ has examples in .NET to help you get started with that.
Just to clarify, the Contacts API v3 and Google Data APIs in general are not obsolete, however it is likely that new versions of them (or new APIs) will be be JSON-based instead and use the new client libraries.

Related

Console Application to retrieve Domain Shared Contacts (Google Apps Admin SDK)

I need to write a console application to retrieve domain shared contacts (eventually update, add or delete them, too).
What I found so far is "Google Domain Shared Contacts API" should do just that, but I am a bit clueless as where to start.
I don't know how to access this API in .NET and I haven't found any examples of such a code.
As far as I can see in the documentation, Domain Shared Contacts API is not currently included in the list of Supported Google APIs for .NET .
You may, however, check in Release Notes for the Google API Client Library for .NET for announcement or updates regarding this API.
If the time comes that Domain Shared Contacts API becomes supported, you may use the following references to get started:
Easily access Google APIs from .NET
GitHub post - google-api-dotnet-client
GitHub post - google-api-dotnet-client-samples
I managed to come up with an application that sends http requests to the API, however their documentation is terrible as it lacks complete description of how exactly the requests should look like and I had to experiment a bit.

Connecting to Yammer from Azure Webjob

I am attempting to connect to Yammer using their .NET SDK but I am having a hell of a time managing this... The point of this exercise is to create an application in Azure which periodically - and AUTONOMOUSLY - contacts Yammer and fetches the latest messages from a specific Yammer group.
Does anyone know of the correct way to use the Yammer .NET SDK from, let's say, a console application, which does not rely on a browser (a.k.a. direct user interaction) to successfully connect via OAuth authentication?
What I have tried:
Trying to suss out what to do from the example given on .NET SDK page on developer.yammer.com, you can see under "Standard Process" an example which shows the LaunchSignIn() function with an incorrect signature! The example shows the usage as:
var authResponse = await OAuthUtils.LaunchSignIn(_clientConfig.ClientId, _clientConfig.RedirectUri, ssoEnabled);
whereas the actually signature I get from the dll is:
void OAuthUtils.LaunchSignIn(string clientId, string RedirectUri)
I'll forgive the missing ssoEnabled parameter... but the example claims the function receives a response, from which a Code is then extracted. This is, of course, the piece missing from my attempt to call:
(awaitable) Task<AuthEnvelope> AuthClient.AuthenticateAppAsync(string code)
I have scoured Google for information on the use of the Yammer .NET SDK but have come up empty handed. All manner of examples of connecting to Yammer but none are in any way relevant to the .NET API. The only thing in any way relevant that I have seen is the Yammer .NET API example uploaded, apparently, by the person who developed it, who posted the code on GitHub. I have checked this example but the two parts in it - one for Windows Phone and one for Windows "Modern App" - both rely on a Browser object being available, or something to that effect anyway. There are redirects, I'm supposed to have a RedirectUri for Yammer to direct me... So does this other example - which was the ONLY other example of using the .NET SDK that I could find.
I imagine that the reason the signature is different is because this isn't actually the same function at all. The one I am trying to use is in Yammer.Oss.Api.Utils whereas the example application doesn't even have the letters Utils together other than in the name of the class OAuthUtils... which leads me to believe that it is possibly under Yammer.Oss.Core.WinRT which, as luck would have it, I cannot reference at all... Yammer.Oss.Core only contains Collections, Constants, Extensions and Serialization.
By the way, in the announcement of the .NET SDK (see first link above), the link to documentation for the SDK leads to the Yammer Support page.
Skip the .NET SDK and just do the authorization yourself using the server-side flow. Then make the requests with HttpClient and add the Authorization header. The SDK might be helpful with some Modern Apps but it's overkill for most people. When working with the API manually the worst thing you'll have to deal with is deserializing the JSON responses with JSON.NET, or other JSON library.
You don't say what you are trying to build, but AFAIK WebJobs don't have a UI so you'll need to do the authorization from a console app or website. Then store the resulting OAuth token somewhere that the WebJob can access it. If you have need an OAuth token per user you'll need to store those in a database, but make efforts to protect them because each OAuth token provides access to their Yammer account.

Can I move a Google API implementation to a web-service?

I have an in-house CMS system written in ASP.NET C#, and I need to implement a few pages that can allow the user to access and alter their Google Analytics management settings using the Google Analytics management API.
I have added the Google.Apis.Analytics.v3 library from NuGet, and I managed to make it work using OAuth2 authentication.
However, the library installs several dependencies, and some of them are upgrading some of my existing DLL files. This is not good, because I have a lot of functionality in this solution and some other solutions that are based on these old DLLs.
Would it be possible to move all the Google API implementation into an external web-service and just call this from my CMS? That way, I would not have to upgrade the CMS's old references. The only problem that I've run into with this is that I have no idea how to use OAuth2 to allow the CMS user to use his own Google account since all this is now done in the web-service, and the authentication page from google will not open in the user's browser.
I don't think a web service will work. The user needs to be prompted for authentication with the web browser. You cant really do that from a web service and return the proper authentication.
The Google .net client lib uses the newest DLLs you may want to look into upgrading yours.

Is it possible to point multiple 'back-end' APIs to one proxy in Azure API Management?

Google gave me no answers.
But essentially what I'd like to do is point our old (badly)hand-built REST api to API Management and have our apps access it trough the new API Management proxy.
Then I'd like create a brand new .NET WEB API and point it to the same proxy and slowly port endpoints from the old api to the new .NET WEB API.
The API consumers (by proxy), never being aware that there has been a switch.
So, is it possible to create "composite" APIs using multiple back-ends in Azure API Management?
Please see discussions on MSDN forums here: https://social.msdn.microsoft.com/Forums/azure/en-US/3f1f19bf-e4c4-486d-b412-7cd8a5509cac/is-it-possible-to-point-multiple-backends-to-one-proxy-in-azure-api-management?forum=azureapimgmt

Alternatives to Google Libraries/DotNetOpenAuth for Google OAuth2

I'm looking for the easiest way to authenticate against google oAuth 2.0 implementation for the purpose of accessing the google Drive API. These are the constraints:
It has to be .NET 2.0 compatible
Can not use the google libraries
I'll be using a service account to do work on behalf of specific users
I've looked at DotNetOpenAuth, but the version for the .NET 2.0 runtime doesn't seem to support oAuth 2.0 (google has deprecated oAuth v1, which DNOA supports, of course).
Google's documentation is confusing, at best (witholding explitives here).
Not sure if this will help but the since you mentioned direct JSON, XML, etc. Google has a UI that simulates and generates requests as well as provides some limited documentation that might get you started on creating such code:
https://developers.google.com/apis-explorer/#p/
https://developers.google.com/oauthplayground/
The following provides some additional info on the login:
https://developers.google.com/accounts/docs/OAuth2Login
Far from exhaustive but it's a start if that's your angle.

Categories