It's all about the answers!

Ask a question

Use dojo.xhrpost to create automatically a workitem

David MICHEL (1472548) | asked Oct 30 '12, 5:47 a.m.
   I can create a workitem as the following article describes:

Instead of opening a new workitem, I wish to create a workitem with a post html request. I can create it with "curl" command (
So I want to know if it's possible to excute a post request with the dojo function, xhrpost, or another function.

Thank you in advance

Best regards


5 answers

permanent link
Curtis d'Entremont (1.3k3) | answered Oct 30 '12, 11:32 a.m.
You can do most things with XHR POSTs that you can do with any other HTTP client. Though for security, the browser restricts you to only making POSTs to the current hostname you're on (that the page was originally loaded from). So you won't be able to do it from another page on another host. Other than that you can put anything in the body and add whatever headers you need. The browser will automate some things for you, like Accept and Accept-Encoding headers (gzip support), cookies, and authentication.

permanent link
David MICHEL (1472548) | answered Oct 30 '12, 12:04 p.m.
Before to it in a pluggin, I have tried to custom attribut script (Calculated Values).
I trie with the following source code:

(function() {
var WorkItemAttributes=;

dojo.declare("org.example.workitems.providers.postrequest", null, {
    getValue: function(attributeId, workItem, configuration) {
        var xhrArgs = {
          url: "https://<my server>/ccm/oslc/workitems/522/",
          postData: dojo.toJson({"rdf:resource":"","oslc_cm:label":"add a new comment"}),
          handleAs: "json",
         // headers:
        return "system impact";
This source code doesn't work. Do you think that it can work ?
What is different to execute dojo code source througth a plugin and to execute dojo code source throught custom attribut ?

permanent link
David MICHEL (1472548) | answered Nov 06 '12, 10:08 a.m.
In my log server, I have this error:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function xhrPost in object [object Object]

So I think I must to add some require but what ?

permanent link
David MICHEL (1472548) | answered Nov 13 '12, 10:59 a.m.
Finally I managed to perform this source code. I have integrated it in javascript plugin and it's OK.
Also I have added some accept json application.

permanent link
Binoy D'costa (9532737) | answered Apr 15 '13, 5:12 p.m.

So it didn't work within the javascript API? you had to write a eclipse plugin?


Rafael Hayama commented Apr 17 '13, 3:52 p.m. | edited Apr 17 '13, 3:56 p.m.

Hello Binoy,

Yes, extending RTC using its APIs requires an Eclipse plugin.

Please, see this article:

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.