Page 1 of 1

No API key was provided

Posted: Mon Apr 20, 2015 9:27 pm
by andrewvbe
Just registered today and am trying to get the .Net demo working. I am getting the error "No API key was provided" when making the call to GetDeviceInfo. Waited a couple hours for the key to propagate, still no luck.

I can ping api.wurflcloud.com.

at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequestFromUserAgentOnly(String url)
at ScientiaMobile.WurflCloud.Http.CloudClient.SendRequest(HttpContextBase context, String url, Boolean uaMayBeDifferent)
at ScientiaMobile.WurflCloud.CloudClientManager.DetectDevice(String userAgent, Dictionary`2 reqParams, String[] capabilities)
at ScientiaMobile.WurflCloud.CloudClientManager.GetDeviceInfo(String userAgent, String[] capabilities)
at CloudDemoBase.Services.Home.WurflService.GetDataByRequest(HttpContextBase context) in d:\ASU\CSE 598 Web

Re: No API key was provided

Posted: Tue Apr 21, 2015 9:14 am
by Elliotfehr
Hello,

Are you able to provide me with a sample of your code to see how you are configuring the WURFL cloud client?

Thank you,

Elliot

Re: No API key was provided

Posted: Tue Apr 21, 2015 6:26 pm
by andrewvbe
I am using the sample code from your website.
public DeviceInfoViewModel GetDataByRequest(HttpContextBase context)
{
var config = new DefaultCloudClientConfig
{
ApiKey = "699083:z40ORAIC17eEGnT8DcM9alqSxUtK6isj"
};

var manager = new CloudClientManager(config);

// Grab data

const String ua = "Mozilla/5.0 (Linux; U; Android 5.4; en-us; Nexus 4 Build/JOP40C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
var info = manager.GetDeviceInfo(ua, new[] { "is_wireless_device", "is_tablet" });

var model = new DeviceInfoViewModel
{
DeviceId = info.Id,
ServerVersion = info.ServerVersion,
DateOfRequest = info.WurflLastUpdate.ToString(),
Library = manager.GetClientVersion(),
Capabilities = info.Capabilities,
Errors = info.Errors,
Source = info.ResponseOrigin
};

return model;
}

Re: No API key was provided

Posted: Thu Apr 23, 2015 6:15 am
by support-all
Hi,

I'm the .NET engineer of ScientiaMobile.
When you want to use an explicit user-agent, you have to choose and set the two available capabilities from your account page.

Try to use this sample code based on your default request to test the Cloud.

Code: Select all

using ScientiaMobile.WurflCloud.Request;


var wurflRequest = new WurflCloudRequest(context);
var info = manager.GetDeviceInfo(context);
instead of

Code: Select all

const String ua = "Mozilla/5.0 (Linux; U; Android 5.4; en-us; Nexus 4 Build/JOP40C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
var info = manager.GetDeviceInfo(ua, new[] { "is_wireless_device", "is_tablet" });
Regards

Beppe