We have moved to a new Sailfish OS Forum. Please start new discussions there.
![]() | 1 | initial version | posted 2016-06-11 22:39:00 +0200 |
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
amazonHelper.data()->setNetworkAccessManager(
view.data()->engine()->networkAccessManager());
...
void AmazonHelper::setNetworkAccessManager(QNetworkAccessManager *qnam) {
qDebug() << "setNetworkAccessManager()";
_manager = qnam;
connect(_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(requestFinished(QNetworkReply*)));
}
After executing
_manager->connectToHostEncrypted("https://avs-alexa-na.amazon.com");
I receive an error "Host not found"
.
After executing
QNetworkRequest request(QUrl("https://avs-alexa-na.amazon.com/v20160207/directives"));
request.setRawHeader("Authorization", "Bearer %1" + _accessToken.toUtf8());
_manager->get(request);
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.
![]() | 2 | No.2 Revision |
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
amazonHelper.data()->setNetworkAccessManager(
view.data()->engine()->networkAccessManager());
...
void AmazonHelper::setNetworkAccessManager(QNetworkAccessManager *qnam) {
qDebug() << "setNetworkAccessManager()";
_manager = qnam;
connect(_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(requestFinished(QNetworkReply*)));
}
After executing
_manager->connectToHostEncrypted("https://avs-alexa-na.amazon.com");
I receive an error "Host not found"
.
After executing
QNetworkRequest request(QUrl("https://avs-alexa-na.amazon.com/v20160207/directives"));
request.setRawHeader("Authorization", "Bearer %1" + _accessToken.toUtf8());
_manager->get(request);
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_0
got exception (https://github.com/JosephP91/curlcpp/issues/84)
![]() | 3 | No.3 Revision |
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
amazonHelper.data()->setNetworkAccessManager(
view.data()->engine()->networkAccessManager());
...
void AmazonHelper::setNetworkAccessManager(QNetworkAccessManager *qnam) {
qDebug() << "setNetworkAccessManager()";
_manager = qnam;
connect(_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(requestFinished(QNetworkReply*)));
}
After executing
_manager->connectToHostEncrypted("https://avs-alexa-na.amazon.com");
I receive an error "Host not found"
.
After executing
QNetworkRequest request(QUrl("https://avs-alexa-na.amazon.com/v20160207/directives"));
request.setRawHeader("Authorization", "Bearer %1" + _accessToken.toUtf8());
_manager->get(request);
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:
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:
UPD2: I tried to use libcurlcpp
but after setting CURLOPT_HTTP_VERSION
to CURL_HTTP_VERSION_2_0
got exception (https://github.com/JosephP91/curlcpp/issues/84)
![]() | 4 | retagged |
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
amazonHelper.data()->setNetworkAccessManager(
view.data()->engine()->networkAccessManager());
...
void AmazonHelper::setNetworkAccessManager(QNetworkAccessManager *qnam) {
qDebug() << "setNetworkAccessManager()";
_manager = qnam;
connect(_manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(requestFinished(QNetworkReply*)));
}
After executing
_manager->connectToHostEncrypted("https://avs-alexa-na.amazon.com");
I receive an error "Host not found"
.
After executing
QNetworkRequest request(QUrl("https://avs-alexa-na.amazon.com/v20160207/directives"));
request.setRawHeader("Authorization", "Bearer %1" + _accessToken.toUtf8());
_manager->get(request);
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_0
got exception (https://github.com/JosephP91/curlcpp/issues/84)