Ask / Submit

How to connect to Alexa (AVS) API?

asked 2016-06-11 22:39:00 +0300

Ósanwe gravatar image

updated 2016-06-13 12:09:27 +0300

chemist gravatar image

I'm writing an Qt application and try to use Alexa API. I received access token, but I can't use API because of "Host not found" and "Connection closed".

My QNetworkAccessManager defined as>setNetworkAccessManager(>engine()->networkAccessManager());


void AmazonHelper::setNetworkAccessManager(QNetworkAccessManager *qnam) {
    qDebug() << "setNetworkAccessManager()";
    _manager = qnam;
    connect(_manager, SIGNAL(finished(QNetworkReply*)),
            this, SLOT(requestFinished(QNetworkReply*)));

After executing


I receive an error "Host not found".

After executing

QNetworkRequest request(QUrl(""));
request.setRawHeader("Authorization", "Bearer %1" + _accessToken.toUtf8());

I receive an error "Connection closed".

What is a right way to use Amazon Alexa API?

Thanks in advance!

P.S. I didn't find any actual C++ libraries. I found node-http2 library fo JS, but I don't want to use full stack of node.js in the app.

UPD1: I found QNetworkRequest::SpdyAllowedAttribute in Qt documentation but when I tried to set this attribute I got the follow error: 'SpdyAllowedAttribute' is not a member of 'QNetworkRequest'

UPD2: I tried to use libcurlcpp but after setting CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_2_0got exception (

edit retag flag offensive close delete


If you do a nslookup from terminal on the phone to the same address what is the result?

tortoisedoc ( 2016-06-12 07:27:16 +0300 )edit

@tortoisedoc My phone does not have nslookup and I did not find it via pkcon. ping for both addresses returns unknown host. But I receive JSON reply after opening them in Google Chrome. Standard Sailfish browser downloads *.exe from these addresses.

Ósanwe ( 2016-06-12 09:36:19 +0300 )edit

@Osanwe - pkcon install bind-utils - contains nslookup.

Edz ( 2016-06-13 12:00:34 +0300 )edit

@tortoisedoc@Markkyboy I got the follow ouput: UPD: Also tried curl:

Ósanwe ( 2016-06-13 12:59:14 +0300 )edit

drop the https:// part of the address and try again.

Edz ( 2016-06-13 13:22:32 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2016-06-13 15:42:10 +0300

tortoisedoc gravatar image

updated 2016-06-13 15:43:04 +0300

does it have to be http2? FYI, for me ping via wifi works fine. Not over data tho.

edit flag offensive delete publish link more


According docs: "This endpoint exposes an HTTP/2 service and expects multipart messages encoded for HTTP/2." ping returns me ping: unknown host

Ósanwe ( 2016-06-13 21:29:02 +0300 )edit

Even via WiFi? If so, what's your SFOS version?

tortoisedoc ( 2016-06-13 22:50:34 +0300 )edit


Ósanwe ( 2016-06-14 01:24:15 +0300 )edit
Login/Signup to Answer

Question tools



Asked: 2016-06-11 22:39:00 +0300

Seen: 558 times

Last updated: Jun 13 '16