Quantcast
Channel: VBForums - API
Viewing all articles
Browse latest Browse all 168

Need help with Google PageSpeedOnline Api

$
0
0
Hi this is my first post here i am complete newbie to vb.net so please be kind.

I am building a windows form app that can help me on various tasks that i do on a daily basis one of those is taking into account speed tests for different websites. I have implemented the Google PageSpeedOnline api and it works great in bringing back the score. The only teething problem i am having is implementing the strategy which basically allows me to change from getting speed results for desktop to mobile.

Here is my working code:

Imports Google
Imports Google.Apis.Pagespeedonline.v1
Imports Google.Apis.Services

Public Class UrlTest


Dim service = New PagespeedonlineService(New BaseClientService.Initializer() With { _
.ApiKey = "My Api Key", _
.ApplicationName = "Google PageSpeed Test App" _
})

Private Sub UrlTestButton_Click(sender As Object, e As EventArgs) Handles UrlTestButton.Click

Dim result = service.Pagespeedapi.Runpagespeed("http://" & UrlTestTextBox.Text).Execute()

Form1.Speed_Rank.Text = result.Score
Form1.Url.Text = result.id
Me.Close()

End Sub
End Class

Here is a link to Googles PageSpeed Online Api page for those of you interested: https://developers.google.com/api-cl...arted#examples

The following code Dim Strategy = PagespeedapiResource.RunpagespeedRequest.StrategyEnum.Mobile
Allows me to select the mobile strategy but i cannot figure out how i can pass this via the api.

Thanks in advance for any help offered.

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>