Results 1 to 7 of 7

Thread: Redmine Rest API

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    54
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    7

    Default Re: Redmine Rest API

    You do not check the response, so how do you know you are not getting it?
    How can I check the response ?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: Redmine Rest API

    Quote Originally Posted by Binary01 View Post
    How can I check the response ?
    One little trick in getting help on a forum is to read the replies to one's question.
    One little trick in hypertext based systems is to follow links.
    One little trick in using API documentations is to look at descriptions of methods and enums.

    Combined they make a huge trick of finding that there is a way to get attributes from a network reply's request object and that there is an attribute called QNetworkRequest::HttpStatusCodeAttribute.

    After a bit of practising the little tricks individually, they will eventually allow you to perform the huge trick on your own.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2015
    Posts
    35
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: Redmine Rest API

    Try to use this
    Qt Code:
    1. void TestClass::onRequestFinished(QNetworkReply* reply)
    2. {
    3.  
    4. if(reply->error())
    5. {
    6. qDebug() << "ERROR : " << reply->errorString();
    7. }
    8. else
    9. {
    10. qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
    11. qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();
    12.  
    13. QString strReply = reply->readAll();
    14. qDebug() << strReply;
    15. // ....
    16.  
    17.  
    18. }
    19. reply->deleteLater();
    20.  
    21. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. connect to rest service with qt and error SSL handshake failed
    By panagiotisss in forum Qt Programming
    Replies: 5
    Last Post: 24th September 2015, 10:56
  2. Rest Web Service - Keep-alive Connection
    By buleron in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 29th May 2015, 16:54
  3. Replies: 1
    Last Post: 15th June 2012, 13:45
  4. Replies: 12
    Last Post: 22nd April 2012, 22:48
  5. Removing divider between menubar and rest of main window
    By tgreaves in forum Qt Programming
    Replies: 4
    Last Post: 18th February 2009, 20:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.