Congratulations to our 2022 Qt Champions!

Problem is calling cloud print search api

  • I am trying to call cloud print search api form my desktop application.

    Below is my working code so far.

    QString httpRequest;
    httpRequest = "";
    QEventLoop loop;
    QNetworkAccessManager mNetworkManager;
    QObject::connect(&mNetworkManager, SIGNAL(finished(QNetworkReply *)),
                        &loop, SLOT(quit()));
    QNetworkRequest request;
    request.setRawHeader("Authorization" ,accessToken.toUtf8());
    request.setRawHeader("Content-Type" ,"application/json");
    request.setRawHeader("Host" ,"");
    QNetworkReply *rep = mNetworkManager.get(request);
    QObject::connect(&mNetworkManager, SIGNAL(finished(QNetworkReply *)),
    this, SLOT(Onfinish(QNetworkReply *)));

    I am getting error ContentOperationNotPermittedError.

    I know its issue related to access but what is wrong with the above implementation i am not getting that. I am generating access token using aouth 2.0 . I have also tested above api using google playground successfully.


  • Moderators

    ContentOperationNotPermittedError = HTTP error 403 = Access Denied

    How do you create the OAuth tokens? Make sure you create them with the same network access manager you use to send your requests. Or at least make sure you transfer them from the other QNAM.

  • @raven-worx

    Please see below link for the code file now i am using single object to retrieve access token and to call search api.

    I am getting same error.

Log in to reply