Hi,
I'm trying to update JSON data over a server but it is not updating, its deleting everything even if I send blank data.
Find the implementation below,
QNetworkAccessManager m_mgr;
QNetworkRequest m_request;
QNetworkReply *m_reply;
QUrl url
("https://api.predic8.de/shop/products/10");
m_request.setUrl(url);
QVariantMap data;
data.insert("name", "Oranges");
QJsonDocument jsonData = QJsonDocument::fromVariant(data);
m_reply = m_mgr.put(m_request, jsonData.toJson(QJsonDocument::Indented));
connect(m_reply, &QNetworkReply::finished, m_reply, &QNetworkReply::deleteLater);
QNetworkAccessManager m_mgr;
QNetworkRequest m_request;
QNetworkReply *m_reply;
QUrl url("https://api.predic8.de/shop/products/10");
m_request.setUrl(url);
QVariantMap data;
data.insert("name", "Oranges");
QJsonDocument jsonData = QJsonDocument::fromVariant(data);
m_reply = m_mgr.put(m_request, jsonData.toJson(QJsonDocument::Indented));
connect(m_reply, &QNetworkReply::finished, m_reply, &QNetworkReply::deleteLater);
To copy to clipboard, switch view to plain text mode
Please help me why it delete the data instead of an update?
Bookmarks