Talk:REST/@comment-Rem Sun-20121126201442: Difference between revisions

From Request Tracker Wiki
Jump to navigation Jump to search
m (1 revision imported)
 
(No difference)

Latest revision as of 15:52, 6 April 2016

Well, seen that I don't have reponse I have to find alone.
Here is my code if it can help somebody in the future (the code C ++ works fine for me with QT libreries):

edit ticket :

const QUrl url = QUrl("your-domain-name/REST/1.0/ticket/"NUM TK"/edit?user="your login name"&pass="your pass"");

const QNetworkRequest requete(url);

QNetworkAccessManager *m = new QNetworkAccessManager;

QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);QHttpPart textPart;

textPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));

textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"content\""));

textPart.setBody("Subject: your balbla here");

multiPart->append(textPart);

QNetworkReply *r = m->post( requete,multiPart);


New Ticket :

const QUrl url = QUrl("http://rt.easter-eggs.org/demos/stable/REST/1.0/ticket/new?user=admin&pass=admin");

const QNetworkRequest requete(url);

QNetworkAccessManager *m = new QNetworkAccessManager;

QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);

QHttpPart textPart;

textPart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/plain"));

textPart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant("form-data; name=\"content\""));

textPart.setBody("Queue: General\nSubject: test in C++");

multiPart->append(textPart);

QNetworkReply *r = m->post( requete,multiPart);


Have Fun all

Rem_Sun