Skip to content

Commit

Permalink
#2789 fix: Deck API path and auth
Browse files Browse the repository at this point in the history
  • Loading branch information
pbek committed Jun 4, 2023
1 parent b93fd57 commit 3f67ab9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/services/nextclouddeckservice.cpp
Expand Up @@ -31,7 +31,7 @@ void NextcloudDeckService::createCard(const QString& title,
// 10 sec timeout for the request
timer.start(10000);

QUrl url(this->cloudConnection.getServerUrl() + "/boards/" +
QUrl url(this->cloudConnection.getServerUrl() + "/apps/deck/api/v1.1/boards/" +
QString::number(this->boardId) + "/stacks/" +
QString::number(this->stackId) + "/cards");

Expand Down Expand Up @@ -63,8 +63,14 @@ void NextcloudDeckService::createCard(const QString& title,
QByteArray data;
QNetworkReply *reply;

networkRequest.setHeader(QNetworkRequest::ContentTypeHeader,
"application/x-www-form-urlencoded");
networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
networkRequest.setRawHeader("OCS-APIRequest", "true");

auto authString = this->cloudConnection.getUsername() + QStringLiteral(":") + this->cloudConnection.getPassword();
QByteArray authStringBase64 = authString.toLocal8Bit().toBase64();
QString headerData = QStringLiteral("Basic ") + authStringBase64;
networkRequest.setRawHeader("Authorization", headerData.toLocal8Bit());

reply = manager->post(networkRequest, bodyJsonDoc.toJson());

loop.exec();
Expand All @@ -86,6 +92,7 @@ void NextcloudDeckService::createCard(const QString& title,
qDebug() << __func__ << " - 'id': " << id;
} else {
qDebug() << __func__ << " - error: " << returnStatusCode;
qDebug() << __func__ << " - 'data': " << data;
}
}

Expand Down

0 comments on commit 3f67ab9

Please sign in to comment.