Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Retrieve work items from RTC using C# code

Can anyone help to provide a sample C# code for retrieving list of project which are created at RTC and its associated work item through REST API using C# code.


Thanks

0 votes


Accepted answer

Permanent link

If you're really "new", I suggest you learn how to use C# to access REST API first.
https://docs.microsoft.com/en-us/aspnet/web-api/overview/older-versions/build-restful-apis-with-aspnet-web-api
(Or whatever the tutorial you feel comfortable with)

Once you get familiar with it, plug the RTC REST API calls into your application. They are not that different from any other HTTP requests. The sequence of calls that you use for a particular task is the same for all programming languages I suppose, while handling the HTTP requests and responses is different.

Ralph Schoon selected this answer as the correct answer

1 vote

Comments
Thanks Ralph and Donald:-)
I guess the question was wrongly understood...the thing is, i am trying to get project name and its associated items by using the below.....but getting 403 forbidden error. so it would be better to provide the right URI will help me

string _serverURL = https://localhost:9443/ccm; 
string _resourceURL = "https://localhost:9443/ccm/rootservices";
    
_resourceURL + "/oslc/contexts/_0_iN4G09EeGGMqpyZT5XdQ/workitems/order"
    
CookieContainer _cookies = new CookieContainer();//create cookie container
HttpWebRequest documentGet = (HttpWebRequest)WebRequest.Create(_resourceURL);
documentGet.Method = "GET"; //method
documentGet.CookieContainer = _cookies; //set container for HttpWebRequest 
documentGet.Accept = mediatype;
documentGet.Headers.Set("OSLC-Core-Version", "3.0"); //for RTC 3.0.1.2
documentGet.Timeout = 300000;
HttpWebResponse response = requestSecureDocument(documentGet, _serverURL, username, password);
        

Your _resourceURL variable contains an incorrect URL. Also, header "OSLC-Core-Version: 3.0" won't get you anywhere, as the current implemented OSLC version is 2.0.


One other answer

Permanent link

I am not a C# guy, but I know our developers for the VisualStudio integration use HTTPS/REST calls. This question has also come up several times already. 


0 votes

Comments
might be. but i am new to this area, so better to share some C# code examples or links to understand better.

Thanks Ralph for your reply:-)

If you are new to this, you should better read the results of the google query. 


I have nothing to share. My examples are all Java, but if you are interested, you can find them here: https://rsjazz.wordpress.com 

they won't help you of course. 

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,951
× 1,701

Question asked: Oct 12 '17, 1:49 a.m.

Question was seen: 4,692 times

Last updated: Jun 07 '18, 10:12 a.m.

Confirmation Cancel Confirm