Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT5 - Posting JSON in server not working.
QtWS25 Last Chance

QT5 - Posting JSON in server not working.

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeyas
    wrote on last edited by
    #1

    Hi friends,

    Here is my code, i'm trying to post my json in server but its not working, can u plz help me..
    I'm using QT5 version.

    @QVariantMap top;
    top.insert( "email", QString( "test@gmail.com" ) );
    top.insert( "test", QString( "test123" ) );
    const QJsonDocument doc = QJsonDocument::fromVariant(top);
    QByteArray postData;

    postData = doc.toJson();
    QString strData;
    strData = doc.toJson();

    QNetworkAccessManager manager = new QNetworkAccessManager(this);
    connect(manager, SIGNAL(finished(QNetworkReply
    )),
    this, SLOT(replyFinished(QNetworkReply*)));

    manager->get(QNetworkRequest(QUrl("http:/..../licenses")));

    QNetworkRequest req;
    req.setUrl(QUrl("http:/..../licenses"));
    req.setHeader(QNetworkRequest::ContentTypeHeader,"application/json");
    manager->Accessible;
    QNetworkReply *reply=manager->post(req,postData);
    connect(reply,SIGNAL(uploadProgress(qint64,qint64)),this,SLOT(updateProgress(qint64,qint64)));@

    Thanks
    Jeyaraman S

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Please,

      don't post the same thread on multiple Forum

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jeyas
        wrote on last edited by
        #3

        I'm new to this forum, can u tell/help me how to remove the duplicate post?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          I don't know how you can delete post, try contacting Forum Moderator.

          You can try editing Thread title adding "[REMOVE]"

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jeyas
            wrote on last edited by
            #5

            Hi,

            ok, Thx. i have reported to moderator..

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved