It's all about the answers!

Ask a question

How to fetch and populate streams and baselines in custom attribute of work item based on GC Project area?


Rohit Goyal (11) | asked Jul 13 '23, 10:06 a.m.

 Hello,


We are trying to fetch and populate the streams and baselines in custom attribute of a work item in CCM based on the select GC project area in another custom attribute. While exploring we came to know that this is possible via dojo scripting but we need an API to fetch the streams and baselines based on the GC project area information. Is it possible to fetch via dojo scripting? Please suggest if there is any better way to fetch the streams or baselines based on GC Project area information,

Thanks and Regards,
Rohit


Comments
David Honey commented Jul 13 '23, 10:13 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You will need to use Ajax to make REST calls to GCM. See https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding for public GCM REST APIs.


Rohit Goyal commented Jul 13 '23, 10:26 a.m. | edited Jul 13 '23, 11:38 a.m.

 Hello David,


We are very new to OSLC, and still exploring, Could you please provide an example if you have it handy it will be very helpful for us.


David Honey commented Jul 13 '23, 11:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you followed the link I gave, you will see there is a link to the GCM REST API pages, one of which is https://jazz.net/gc/doc/scenarios which describes the operations you can perform and includes examples.

One answer



permanent link
David Honey (1.8k17) | answered Jul 13 '23, 12:07 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You will need to use Ajax to make REST calls to GCM. See https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding for public GCM REST APIs. That page has a link to https://jazz.net/gc/doc/scenarios which describes the operations you can perform and includes examples.


Comments
Rohit Goyal commented Jul 17 '23, 12:51 a.m.

Hello David, I tried the above links. I am able to understand the GC API's, but when I am trying to make an API call (using dojo) I am getting errors. I tried dojo.xhrGet and XMLHttpRequest() as well but both of them are not working. 


For dojo.xhrGet, my pseudocode: 

var xhrArgs = {
url: url,
handleAs: "json",
preventCache: true,
load: function(response) {
  / Do something with response /
},
error: function(response) {
/ Do something with response /
}]};

var deferred = dojo.xhrGet(xhrArgs);

The error which I get is:
TypeError: Cannot find function xhrGet in object [object Object].

Could you please let me know how can I get around this error. I tried to search but I am not able to find any solution.


David Honey commented Jul 17 '23, 4:27 a.m. | edited Jul 17 '23, 4:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I suggest you start by using web browser plugins such as Postman or RESTed. Get that working to achieve what you want first. As far as the Dojo error is concerned, that's a Dojo question not a Jazz question. There are plenty of online resources that provide tutorials for Ajax from Javascript or Dojo.

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.