legato icon indicating copy to clipboard operation
legato copied to clipboard

API V4 Support

Open tpitale opened this issue 6 years ago • 17 comments

https://developers.google.com/analytics/devguides/reporting/core/v4/migration

tpitale avatar Sep 30 '19 16:09 tpitale

Hi @tpitale I wonder if this issue is related to something new I just found: I can't see these new "kind" of web profiles called "App + Web" when calling the web_profiles method.

Thanks in advance!

luctus avatar Feb 18 '20 11:02 luctus

Could you share the docs for this new kind of profile? It may be V4-only. But I’d be surprised. Either way I reallly need to do this ticket. 😆

tpitale avatar Feb 18 '20 13:02 tpitale

Hi @tpitale! I'm not able to find any related documentation. I'm doing a fork now and will give it a try for the version upgrade.

luctus avatar Feb 21 '20 22:02 luctus

wow, the change is massive! lol

luctus avatar Feb 21 '20 23:02 luctus

Yeah, it isn't a trivial change between V3 and V4 … but I think we can keep the code the same in most legato, and just change the adapter that sends the request to the API. I think that will work.

tpitale avatar Feb 21 '20 23:02 tpitale

It's basically … instead of making it query params to one endpoint, it's a POST to another endpoint with a big body for the request.

So, need an adapter to handle converting our structures into either query params or the body. And then a change in the endpoint depending on some config.

tpitale avatar Feb 21 '20 23:02 tpitale

Yes, the change should be done mainly here. right?

Do you want to keep the response object with the same format that you have today?

By the way, the upgrade is only in the Reporting API, not in the Management API, so my initial "App + Web" issue shouldn't be solved by upgrading the Reporting API :(

luctus avatar Feb 21 '20 23:02 luctus

So, there's some work here: https://github.com/tpitale/legato/blob/master/lib/legato/request.rb#L22 to handle the new endpoint. We'll need a path to switch on.

Changes in the Response

It might be best to move the current Request and Response into a new module like V3::Response and V3::Request so we can then make V4::Request and V4::Response or something like that.

Then, instead of query.to_query_string and this: https://github.com/tpitale/legato/blob/master/lib/legato/request.rb#L37 we'd probably want a new class to take a query and output the query as the request body format.

The User could have some switch on like api_version or something where it defaults to 3, and 4 is an option.

And then based on that we would look up the Request/Response here https://github.com/tpitale/legato/blob/master/lib/legato/user.rb#L14.

And all of that while updating the management API sections to use the V3::Request/response.

tpitale avatar Feb 22 '20 00:02 tpitale

Hey y'all,

I was wondering how this was moving along and if y'all needed any help! Would definitely be down to help push the api-v4 along if possible.

🙏

adamjung avatar Mar 23 '20 20:03 adamjung

Started working on this, but now I have a 9-day-old baby so kinda on pause. Sorry!

tpitale avatar Mar 24 '20 00:03 tpitale

Curious if there are any updates here? I'd love to keep using Legato for V4 if it's supported. If not, what are other people using instead?

bborn avatar Apr 27 '22 14:04 bborn

I haven't received any PRs for the work. You're welcome to submit one @bborn.

tpitale avatar Apr 27 '22 15:04 tpitale

@tpitale ok, I'd love to help out. Is this still the best approach?

bborn avatar Apr 27 '22 16:04 bborn

The last time I looked, yeah. Legato hasn't changed much, but I haven't looked at the Google api since that comment.

tpitale avatar Apr 27 '22 16:04 tpitale

I've got some time today to work on this, too. Give me through this weekend @bborn?

tpitale avatar Apr 27 '22 16:04 tpitale

@tpitale happy to help out as much as possible! I just don't know the Legato internals all that well 😄

bborn avatar Apr 27 '22 16:04 bborn

Starting with the changes to move all the existing functionality to a V3 location to make space for a V4.

tpitale avatar Apr 27 '22 18:04 tpitale