VB.Net Google Page Speed Api How To Change Strategy On Mobile
I am trying to fire an api request to use google formatted pages using a VB.Net WindowsForm app and although I can get a response back for the request below, I cannot train how to get it to work with mobile strategy.
here is my working code for a desktop request:
Dim url As String = "http://news.bbc.co.uk"
Dim service = New PagespeedonlineService(New BaseClientService.Initializer() With { _
.ApiKey = "My Api Code", _
.ApplicationName = "PageSpeedOnline API Sample" _
})
Dim res = service.Pagespeedapi.Runpagespeed(url).Execute()
Here is a link to a page of pages in googles format: https://developers.google.com/speed/docs/insights/v1/getting_started
Note. I am visual studio 2012 with a Nuget package for api.
You need to create an objectRunpagespeedRequest
with the desired settings. Runpagespeed()
is a virtual method to be used RunpagespeedRequest
after it has been created.
Unverified code
Dim url As String = "http://news.bbc.co.uk"
Dim service = New PagespeedonlineService(New BaseClientService.Initializer() With { _
.ApiKey = "My Api Code", _
.ApplicationName = "PageSpeedOnline API Sample" _
})
Dim res = New RunpagespeedRequest(service, url);
res.Strategy = PagespeedapiResource.RunpagespeedRequest.StrategyEnum.Mobile
res.Runpagespeed(url).Execute()
The above code probably won't work, but I think it will help you set other properties.
PagespeedapiResource class reference PagespeedapiResource.RunpagespeedRequest Class reference