CRUD RTC work items using cURL (Part 1: Read)

Introduction

Often I wanted to learn how to use cURL to be able to interact with the OSLC API without using Java and often I run out of time to do it. This time I could not avoid it because a colleague of mine was expecting an answer from me. So I decided to go thru all the learning process and figure it out.

First of all, you need to have a good understanding of what OSLC is all about, it will help you figure out the technology and the API we are using to interact with our Jazz Team Server (JTS). For that check out some references mentioned at the end of this article.

These days you can find more and more inputs about OSLC, RESTFul and cURL than I could find in some early days, when I started playing with OSLC. So don’t hesitate to “google” if you have any concern regarding one of the mentioned points.

This article should be split in four CRUD parts :

  • Part 1: How to Read a Work Item using cURL.
  • Part 2: How to Create a Work Item using cURL
  • Part 3: How to Update a Work Item using cURL
  • Part 4: How to Delete a Work Item using cURL

And you are reading the first one.

Why cURL?

cURL is a command line tool for transferring data with URL syntax. It supports lots of protocols including HTTP(S) which is the protocol used to interact with the REST API of a Jazz Team Server. So cURL will help us interacting with your Jazz Team Server directly from a command line interface without using any programming language.

cURL is free and is an open software that compiles and runs under a wide variety of operating systems including AIX, Apple iOS, DOS, Linux, QNX, VMS, Windows of z/OS. So thanks to this great community providing a so stable tool. So to be able to proceed with this tutorial, please grab the cURL binary that you need from http://curl.haxx.se/download.html and install it on your machine.

FYI, my tutorial is using the Windows version so all my samples will be based on the MS DOS command line syntax.

Root Services

To be able to retrieve the REST / OSLC service which will permit you to create a new work item in RTC repository, you need to go thru several intermediate services unless you already know the URL of the service.

So let assume we start from scratch, the entry point to your repository is, what we name in RTC, the “Root Service Document” accessible thru the link https://jazz.server.com:9443/ccm/rootservices (Please replace https://jazz.server.com:9443 with the address the server handling your CCM application). This document lists all the root services available from your RTC repository.

If you type this URL in your web browser while your server is running, your browser should show you the following sentence:

Change and Configuration Management Jazz https://jazz.server.com:9443/ccm

Now, this is not really very informative… Let request the same URL using cURL:

curl.exe https://jazz.server.com:9443/ccm/rootservices

In my case, cURL returns the following message:

curl: (60) SSL certificate problem, verify that the CA cert is OK.
Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.

In this tutorial, we will not treat the certificate issue, so let turn it off using the -k option:

curl.exe -k https://jazz.server.com:9443/ccm/rootservices

This instruction with return the following XML answer:

<?xml version="1.0"?>
<!--
    Licensed Materials - Property of IBM
    (c) Copyright IBM Corporation 2010, 2012. All Rights Reserved.
    
    Note to U.S. Government Users Restricted Rights:  
    Use, duplication or disclosure restricted by GSA ADP Schedule
    Contract with IBM Corp.
 -->

<rdf:Description
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:dc="http://purl.org/dc/terms/"
     xmlns:jfs="http://jazz.net/xmlns/prod/jazz/jfs/1.0/"
     xmlns:jd="http://jazz.net/xmlns/prod/jazz/discovery/1.0/"
     xmlns:jdb="http://jazz.net/xmlns/prod/jazz/dashboard/1.0/"
     xmlns:jp06="http://jazz.net/xmlns/prod/jazz/process/0.6/"
     xmlns:jp="http://jazz.net/xmlns/prod/jazz/process/1.0/"
     xmlns:jtp="http://jazz.net/xmlns/prod/jazz/jtp/0.6/"
     xmlns:ju="http://jazz.net/ns/ui#"
     xmlns:oslc="http://open-services.net/ns/core#"
     xmlns:trs="http://jazz.net/ns/trs#"
     rdf:about="https://jazz.server.com:9443/ccm/rootservices">

  <!--
          Default root service registry document for an RTC server.
          Contains contributions for core JFS services and components
          and OSLC Change Management.
          Specification is available at https://jazz.net/wiki/bin/view/Main/RootServicesSpec
   -->

  <!-- Add descriptive title here -->
  <dc:title xml:lang="en">Change and Configuration Management</dc:title>

  <!-- List of friends (applications known to this application) -->
  <jd:friends
      rdf:resource="https://jazz.server.com:9443/ccm/friends" />
       
  <!-- Discovery service for the JFS server and associated applications -->
  <jd:discovery
      rdf:resource="https://jazz.server.com:9443/ccm/discovery" />
       
  <!-- Viewlet-related properties -->
  <jd:viewletServiceRoot
        rdf:resource="https://jazz.server.com:9443/ccm" />

  <jd:viewletWebUIRoot
        rdf:resource="https://jazz.server.com:9443/ccm" />

  <!-- Default root service registry document for a JFS server. -->

  <jfs:oauthRequestTokenUrl
        rdf:resource="https://jazz.server.com:9443/ccm/oauth-request-token" />
 
  <jfs:oauthAccessTokenUrl
        rdf:resource="https://jazz.server.com:9443/ccm/oauth-access-token" />
        
  <jfs:oauthRealmName>Jazz</jfs:oauthRealmName>
  <jfs:oauthDomain>https://jazz.server.com:9443/ccm</jfs:oauthDomain>
        
  <jfs:oauthUserAuthorizationUrl
        rdf:resource="https://jazz.server.com:9443/ccm/oauth-authorize" />
        
  <jfs:oauthRequestConsumerKeyUrl
      rdf:resource="https://jazz.server.com:9443/ccm/oauth-request-consumer" />
      
  <jfs:oauthApprovalModuleUrl
      rdf:resource="https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.repository.AuthorizeOAuth" />      
 
  <!-- JAuth URLS -->
 
  <jfs:jauthIssueTokenUrl
      rdf:resource="https://jazz.server.com:9443/ccm/jauth-issue-token" />
      
  <jfs:jauthCheckTokenUrl
      rdf:resource="https://jazz.server.com:9443/ccm/jauth-check-token" />
      
  <jfs:jauthRevokeTokenUrl
      rdf:resource="https://jazz.server.com:9443/ccm/jauth-revoke-token" />
      
  <jfs:jauthCheckAuthUrl
      rdf:resource="https://jazz.server.com:9443/ccm/jauth-check-auth" />
      
  <jfs:jauthProxyUrl
      rdf:resource="https://jazz.server.com:9443/ccm/jauth-proxy" />
      
  <!-- service for finding users and getting user info -->
  <jfs:users
        rdf:resource="https://jazz.server.com:9443/jts/users"   />
 
  <!-- Service to redirect to the resource that represents the authenticated user -->
  <jfs:currentUser
        rdf:resource="https://jazz.server.com:9443/ccm/whoami"   />
        
  <!-- JFS storage service -->
  <jfs:storage
        rdf:resource="https://jazz.server.com:9443/ccm/storage"   />
 
  <!-- JFS SPARQL query service -->
  <jfs:query
        rdf:resource="https://jazz.server.com:9443/ccm/query"   />

  <!-- Put RTC changes in here, so we do not have to merge all the time : START -->

  <!-- Change Management service catalog -->
  <oslc_cm:cmServiceProviders
          xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
          rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/catalog" />
          
  <oslc_scm:scmServiceProviders
          xmlns:oslc_scm="http://open-services.net/xmlns/scm/1.0/"
          rdf:resource="https://jazz.server.com:9443/ccm/oslc-scm/catalog" />
          
  <jd:oslcCatalogs>
        <oslc:ServiceProviderCatalog rdf:about="https://jazz.server.com:9443/ccm/oslc/workitems/catalog">
            <oslc:domain rdf:resource="http://open-services.net/ns/cm#"/>
        </oslc:ServiceProviderCatalog>
  </jd:oslcCatalogs>
 
  <jd:oslcCatalogs>
        <oslc:ServiceProviderCatalog rdf:about="https://jazz.server.com:9443/ccm/oslc-scm/catalog">
            <oslc:domain rdf:resource="http://open-services.net/ns/scm#"/>
        </oslc:ServiceProviderCatalog>
  </jd:oslcCatalogs>
 
  <!-- Change Management Tracked Resource Set Provider -->
  <rtc_cm:trackedResourceSetProvider xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/">
          <trs:TrackedResourceSetProvider>
            <trs:trackedResourceSet rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/trs" />
          </trs:TrackedResourceSetProvider>
  </rtc_cm:trackedResourceSetProvider>
          
  <jd:registration
     rdf:resource="https://jazz.server.com:9443/ccm/service/com.ibm.team.repository.service.internal.setup.IRegistrationHandlerService" />
     
   <jfs:setupWizardDescriptor
     rdf:resource="https://jazz.server.com:9443/ccm/service/com.ibm.team.repository.service.internal.setup.ISetupWizardDescriptorService"/>
     
   <jfs:adminWebUI rdf:resource="https://jazz.server.com:9443/ccm/admin"/>

  <!-- Put RTC changes in here, so we do not have to merge all the time : END -->
 
  <!-- JFS indexing service -->
  <jfs:indexing
        rdf:resource="https://jazz.server.com:9443/ccm/indexing"   />
        
  <!-- JFS revisions and history of storage resources -->        
  <jfs:history
        rdf:resource="https://jazz.server.com:9443/ccm/history"   />
 
  <!-- JFS full text search -->
  <jfs:search
        rdf:resource="https://jazz.server.com:9443/ccm/search"   />

  <!-- JFS baseline service -->
  <jfs:baselines
        rdf:resource="https://jazz.server.com:9443/ccm/baselines"   />
        
  <!-- JFS mailer service -->
  <jfs:mailer
        rdf:resource="https://jazz.server.com:9443/ccm/mailer"   />       
 
    <!-- JFS bulk operations service -->
  <jfs:bulkOperations
        rdf:resource="https://jazz.server.com:9443/ccm/bulk"   />
 
  <!-- JFS changes service -->
  <jfs:changes
      rdf:resource="https://jazz.server.com:9443/ccm/changes" />
 
  <!-- Dashboards service (provisional) -->
  <jdb:dashboards
        rdf:resource="https://jazz.server.com:9443/ccm/dashboards" />       

  <!-- Widget Catalog -->    
  <ju:widgetCatalog
      rdf:resource="https://jazz.server.com:9443/ccm/jfs/WidgetCatalog"/>
 
  <!-- Web Welcome -->     
  <jd:infocenterRoot
      rdf:resource="https://jazz.server.com:9443/ccm/../clmhelp" />
 
  <!-- Project areas service. This service is provisional and may change in the next release. -->
  <jp06:projectAreas
        rdf:resource="https://jazz.server.com:9443/ccm/process/project-areas" />

  <!-- Process templates service. This service is provisional and may change in the next release. -->
  <jp06:processTemplates
        rdf:resource="https://jazz.server.com:9443/ccm/process/templates" />

  <!-- Process security service. This service is provisional and may change in the next release. -->
  <jp06:processSecurity
      rdf:resource="https://jazz.server.com:9443/ccm/process-security"/>
    
  <!-- Process about service. It returns information about process and component versions without
       requiring user authentication. See work item 236627 for details-->  
  <jp06:processAbout
        rdf:resource="https://jazz.server.com:9443/ccm/process-about" />
                
  <!-- Project Area Management for registered applications. This entry is provisional. -->
  <jp:manageProjectAreas
        rdf:resource="https://jazz.server.com:9443/ccm/process/manageProjectAreas"/>

  <!-- Process Template Management for registered applications. This entry is provisional. -->
  <jp:manageProcessTemplates
        rdf:resource="https://jazz.server.com:9443/ccm/process/manageProcessTemplates"/>

  <jtp:associations
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/associations"/>
 
  <jtp:defaultPracticeLibraryUrl
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/libraries/shared"/>
 
  <jtp:file
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/file"/>
 
  <jtp:license
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/license"/>
 
  <jtp:practices
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/practices"/>
 
  <jtp:processDescriptions
      rdf:resource="https://jazz.server.com:9443/ccm/process-authoring/descriptions"/>
 
  <!-- Application about service. -->
  <oslc:publisher rdf:resource="https://jazz.server.com:9443/ccm/application-about"/>      
        
  <!-- Server Rename Application Status service -->
  <jfs:serverRenameStatus
      rdf:resource="https://jazz.server.com:9443/ccm/appServerRenameStatus"/>
        
</rdf:Description>

 Login and Retrieve the Project Area services

To retrieve the services available for a particular Project Area we must retrieve the Project Area by itself. The service listing the project areas, also named Service Providers, is the “Change Management service catalog”.

So, look for the text “Change Management service catalog” in the root services. You will find the following element:

<oslc_cm:cmServiceProviders
     xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
     rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/catalog" />
<pre>

The URL designated by the attribute rdf:resource (https://jazz.server.com:9443/ccm/oslc/workitems/catalog) specifies the service giving access to the Project Areas  available in your server. Let call cURL with this new URL:

curl.exe -k https://jazz.server.com:9443/ccm/oslc/workitems/catalog

In this case, cURL doesn’t return any result. It comes from the fact that to access to this catalog service you need to login.

So, let assume that to login to the server as “philippe”, the password is “philippe”, to login you need to go thru the following set of instructions:

rem Login as philippe/philippe
set USER=philippe
set PWD=philippe
rem File which will contain the login cookies
set COOKIES=cookies.txt

rem First pass to request the authentication cookie
curl.exe -k -c %COOKIES% https://jazz.server.com:9443/ccm/authenticated/identity
rem Second pass to login
curl.exe -k -L -b %COOKIES% -c %COOKIES% -d j_username=%USER% -d j_password=%PWD% https://jazz.server.com:9443/ccm/authenticated/j_security_check

rem Request the url using the authentication
curl.exe -k -b %COOKIES% https://jazz.server.com:9443/ccm/oslc/workitems/catalog

If you need more inputs to understand how the login mechanism works in Jazz, please read my old post on this subject: Jazz Form-based Authentication.

cURL will return then the following XML answer:

<?xml version="1.0" encoding="UTF-8"?>
<oslc_disc:ServiceProviderCatalog
	xmlns:oslc_disc="http://open-services.net/xmlns/discovery/1.0/"
	rdf:about="https://jazz.server.com:9443/ccm/oslc/workitems/catalog.xml"
	xmlns:dc="http://purl.org/dc/terms/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:jfs_proc="http://jazz.net/xmlns/prod/jazz/process/1.0/">

	<dc:title>Project Areas</dc:title>
	<oslc_disc:entry>
		<oslc_disc:ServiceProvider>
			<dc:title>JUnit Project</dc:title>
			<oslc_disc:details <span="" class="hiddenSpellError" pre="details " data-mce-bogus="1">rdf:resource="https://jazz.server.com:9443/ccm/process/project-areas/_TN0swJPUEeOnRa9khWwR1A"/>
			<oslc_disc:services <span="" class="hiddenSpellError" pre="services " data-mce-bogus="1">rdf:resource="https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/services.xml"/>
			<jfs_proc:consumerRegistry rdf:resource="https://jazz.server.com:9443/ccm/process/project-areas/_TN0swJPUEeOnRa9khWwR1A/links"/>
		</oslc_disc:ServiceProvider>
	</oslc_disc:entry>
	<oslc_disc:entry>
		<oslc_disc:ServiceProvider>
			JKE Banking (Change Management)
			<oslc_disc:details <span="" class="hiddenSpellError" pre="details " data-mce-bogus="1">rdf:resource="https://jazz.server.com:9443/ccm/process/project-areas/_rbJMTpo-EeO4grwsLLv1Pg"/>
			<oslc_disc:services <span="" class="hiddenSpellError" pre="services " data-mce-bogus="1">rdf:resource="https://jazz.server.com:9443/ccm/oslc/contexts/_rbJMTpo-EeO4grwsLLv1Pg/workitems/services.xml"/>
			<jfs_proc:consumerRegistry rdf:resource="https://jazz.server.com:9443/ccm/process/project-areas/_rbJMTpo-EeO4grwsLLv1Pg/links"/>
		</oslc_disc:ServiceProvider>
	</oslc_disc:entry>
</oslc_disc:ServiceProviderCatalog>

This catalog service lists all the Project Areas present in the requested repository.

At this point, you can select the service URL corresponding to the Project Area you want to interact with. For example, for the Project Area “JUnit Project”, select the URL under the attribute “rdf:resource” in the element “oslc_disc:services”:

https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/services.xml

Now, if you call cURL with this new URL:

rem Authentication
...
rem Request the url using the authentication
curl.exe -k -b %COOKIES% https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/services.xml

You get the services available for this project area:

<?xml version="1.0" encoding="UTF-8"?>
<oslc_cm:ServiceDescriptor 
	xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/" 
	rdf:about="https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/services.xml" 
	xmlns:dc="http://purl.org/dc/terms/" 
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/">

	<dc:title>JUnit Project</dc:title>
	<dc:description>IBM Rational Team Concert OSLC CM Service Description for Project 'JUnit Project'</dc:description>
	<dc:contributor>
		<dc:title>IBM Rational Team Concert Work Items</dc:title>
		<dc:identifier>com.ibm.team.workitem</dc:identifier>
		<oslc_cm:icon>https://jazz.server.com:9443/ccm/web/com.ibm.team.rtc.web/ui/graphics/UICustomizations/RationalTeamConcert.ico</oslc_cm:icon>
	</dc:contributor>
	<oslc_cm:plans oslc_cm:version="1.0">
		<oslc_cm:home>
			<dc:title>Plans Home</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/web/projects/JUnit%20Project#action=com.ibm.team.apt.welcome</oslc_cm:url>
		</oslc_cm:home>
		<oslc_cm:selectionDialog oslc_cm:default="true" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="360px">
			<dc:title>Plan</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.apt.PlanSelectionDialog?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true</oslc_cm:url>
		</oslc_cm:selectionDialog>
	</oslc_cm:plans>
	<oslc_cm:changeRequests oslc_cm:version="1.0">
		<oslc_cm:home>
			<dc:title>Work Items Home</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/web/projects/JUnit%20Project#action=com.ibm.team.workitem.viewWelcome</oslc_cm:url>
		</oslc_cm:home>
		<oslc_cm:factory oslc_cm:default="true" calm:id="defect">
			<dc:title>Location for creation of Defect change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/defect</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="requirementChangeRequest">
			<dc:title>Location for creation of Task change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/task</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="planItem">
			<dc:title>Location for creation of Story change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.apt.workItemType.story</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="com.ibm.team.apt.workItemType.epic">
			<dc:title>Location for creation of Epic change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.apt.workItemType.epic</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="com.ibm.team.workItemType.buildtrackingitem">
			<dc:title>Location for creation of Track Build Item change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.workItemType.buildtrackingitem</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="com.ibm.team.workitem.workItemType.impediment">
			<dc:title>Location for creation of Impediment change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.workitem.workItemType.impediment</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="com.ibm.team.workItemType.adoption">
			<dc:title>Location for creation of Adoption Item change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.workItemType.adoption</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="com.ibm.team.workitem.workItemType.retrospective">
			<dc:title>Location for creation of Retrospective change requests </dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems/com.ibm.team.workitem.workItemType.retrospective</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory>
			<dc:title>Location for creation of change requests</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:factory calm:id="drafts">
			<dc:title>Location for creation of draft change requests</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/drafts/workitems</oslc_cm:url>
		</oslc_cm:factory>
		<oslc_cm:simpleQuery>
			<dc:title>Change request queries</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems</oslc_cm:url>
		</oslc_cm:simpleQuery>
		<oslc_cm:creationDialog oslc_cm:default="true" calm:id="defect" oslc_cm:hintWidth="680px" oslc_cm:hintHeight="505px">
			<dc:title>New Defect</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/modules/com.ibm.team.workitem.WICreationDialog?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=defect</oslc_cm:url>
		</oslc_cm:creationDialog>
		<oslc_cm:creationDialog calm:id="planItem" oslc_cm:hintWidth="680px" oslc_cm:hintHeight="545px">
			<dc:title>New Plan Item</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/modules/com.ibm.team.workitem.WICreationDialog?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=com.ibm.team.apt.workItemType.story</oslc_cm:url>
		</oslc_cm:creationDialog>
		<oslc_cm:creationDialog calm:id="task" oslc_cm:hintWidth="680px" oslc_cm:hintHeight="505px">
			<dc:title>New Task</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/modules/com.ibm.team.workitem.WICreationDialog?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=task</oslc_cm:url>
		</oslc_cm:creationDialog>
		<oslc_cm:creationDialog calm:id="requirementChangeRequest" oslc_cm:hintWidth="680px" oslc_cm:hintHeight="505px">
			<dc:title>New Requirement Change Request</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/modules/com.ibm.team.workitem.WICreationDialog?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=task</oslc_cm:url>
		</oslc_cm:creationDialog>
		<oslc_cm:selectionDialog oslc_cm:default="true" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="460px">
			<dc:title>Select Change Request</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.workitem.WIPicker?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true</oslc_cm:url>
		</oslc_cm:selectionDialog>
		<oslc_cm:selectionDialog calm:id="defect" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="460px">
			<dc:title>Select Defect</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.workitem.WIPicker?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=defect</oslc_cm:url>
		</oslc_cm:selectionDialog>
		<oslc_cm:selectionDialog calm:id="planItem" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="460px">
			<dc:title>Select Plan Item</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.workitem.WIPicker?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=com.ibm.team.apt.workItemType.story</oslc_cm:url>
		</oslc_cm:selectionDialog>
		<oslc_cm:selectionDialog calm:id="task" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="460px">
			<dc:title>Select Task</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.workitem.WIPicker?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=task</oslc_cm:url>
		</oslc_cm:selectionDialog>
		<oslc_cm:selectionDialog calm:id="requirementChangeRequest" oslc_cm:hintWidth="550px" oslc_cm:hintHeight="460px">
			<dc:title>Requirement Change Request</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/_ajax-modules/com.ibm.team.workitem.WIPicker?projectAreaId=_TN0swJPUEeOnRa9khWwR1A&amp;showLoginLink=true&amp;dc%3Atype=task</oslc_cm:url>
		</oslc_cm:selectionDialog>
		<calm:filter calm:id="openItems">
			<dc:title>Open Change Requests Filter</dc:title>
			<calm:url>https://jazz.server.com:9443/ccm/oslc/calm-filter/_TN0swJPUEeOnRa9khWwR1A/openItems</calm:url>
		</calm:filter>
		<calm:filter calm:id="resolvedItems">
			<dc:title>Resolved Change Requests Filter</dc:title>
			<calm:url>https://jazz.server.com:9443/ccm/oslc/calm-filter/_TN0swJPUEeOnRa9khWwR1A/resolvedItems</calm:url>
		</calm:filter>
		<calm:filter calm:id="readyForTesting">
			<dc:title>Ready for Testing Change Requests Filter</dc:title>
			<calm:url>https://jazz.server.com:9443/ccm/oslc/calm-filter/_TN0swJPUEeOnRa9khWwR1A/readyForTesting</calm:url>
		</calm:filter>
		<calm:module calm:id="embedded-cm">
			<dc:title>Embeddable Work Item Web Module</dc:title>
			<oslc_cm:url>https://jazz.server.com:9443/ccm/web/com.ibm.team.workitem.web/ui/internal/module/WorkItemGadget.xml?projectAreaItemId=_TN0swJPUEeOnRa9khWwR1A</oslc_cm:url>
		</calm:module>
		<calm:rpc calm:id="home">
			<dc:title>Work Items Home</dc:title>
			<calm:rpcService>OSLC_requestAction</calm:rpcService>
			<calm:rpcArg>action=com.ibm.team.workitem.viewWelcome</calm:rpcArg>
		</calm:rpc>
		<calm:rpc calm:id="defect">
			<dc:title>Create Defect</dc:title>
			<calm:rpcService>OSLC_requestAction</calm:rpcService>
			<calm:rpcArg>action=com.ibm.team.workitem.newWorkItem&amp;type=defect</calm:rpcArg>
		</calm:rpc>
		<calm:rpc calm:id="task">
			<dc:title>Create Task</dc:title>
			<calm:rpcService>OSLC_requestAction</calm:rpcService>
			<calm:rpcArg>action=com.ibm.team.workitem.newWorkItem&amp;type=task</calm:rpcArg>
		</calm:rpc>
		<calm:rpc calm:id="query-page">
			<dc:title>Queries</dc:title>
			<calm:rpcService>OSLC_requestAction</calm:rpcService>
			<calm:rpcArg>action=com.ibm.team.workitem.viewQueries</calm:rpcArg>
		</calm:rpc>
	</oslc_cm:changeRequests>
</oslc_cm:ServiceDescriptor>

Work Item URL syntax

To retrieve the syntax used to access to a work item, you can run the Project Area named “Change request queries”.

<oslc_cm:simpleQuery>
	<dc:title>Change request queries</dc:title>
	<oslc_cm:url>https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems</oslc_cm:url>
</oslc_cm:simpleQuery>

So if you run:

rem Authentication
...
rem Request the url using the authentication
curl.exe -k -b %COOKIES% https://jazz.server.com:9443/ccm/oslc/contexts/_TN0swJPUEeOnRa9khWwR1A/workitems

You get the ALL the work items of the designated project area. Each of these work items have the same XML structure:

The attribute “rdf:resource” of the “oslc_cm:ChangeRequest” element will provide you the syntax to access to a work item based on its identifier:

https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/<wi_id>[

Read your first Work Item

Before creating a Work Item it is important to understand the XML (resp. Jason format) used to describe a work item.

So let say, you want to access to the work item having the id #1, with cURL you will run:

rem Authentication
...
rem Request the url using the authentication
curl.exe -k -b %COOKIES% -H "Accept: application/x-oslc-cm-change-request+xml" https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1

Please notice the –H “Accept: application/x-oslc-cm-change-request+xml” header parameter. Without this parameter, you will get an HTML answer instead of the XML expected answer… Actually, this URL can be used to access to a WI from your web browser. So we need to tell to your server the format of the expected answer.
So with the previous call we will obtain the following XML answer:

<oslc_cm:ChangeRequest rdf:resource="https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1">
	<rtc_cm:archived>false</rtc_cm:archived>
	<rtc_cm:filedAgainst rdf:resource="https://jazz.server.com:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_UF6LUJPUEeOnRa9khWwR1A"/>
	<rtc_cm:contextId>_TN0swJPUEeOnRa9khWwR1A</rtc_cm:contextId>
	<rtc_cm:correctedEstimate/>
	<dc:created>2014-02-09T10:00:08.139Z</dc:created>
	<dc:creator rdf:resource="https://jazz.server.com:9443/jts/users/jennifer"/>
	<dc:description>The exception gets caught silently in runProtected.&lt;br/&gt; BTW any empty catch block should be forbidden in junit ;-)&lt;br/&gt;&lt;br/&gt;Sincerely, and good job with the 4 and annotations, really simplifies things !&lt;br/&gt;</dc:description>
	<rtc_cm:due/>
	<rtc_cm:estimate>14400000</rtc_cm:estimate>
	<rtc_cm:foundIn/>
	<dc:identifier>1</dc:identifier>
	<rtc_cm:comments oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:comments"/>
	<oslc_cm:priority rdf:resource="https://jazz.server.com:9443/ccm/oslc/enumerations/_TN0swJPUEeOnRa9khWwR1A/priority/priority.literal.l01"/>
	<rtc_cm:resolution rdf:resource="https://jazz.server.com:9443/ccm/oslc/workflows/_TN0swJPUEeOnRa9khWwR1A/resolutions/com.ibm.team.workitem.defectWorkflow/1"/>
	<oslc_cm:severity rdf:resource="https://jazz.server.com:9443/ccm/oslc/enumerations/_TN0swJPUEeOnRa9khWwR1A/severity/severity.literal.l3"/>
	<rtc_cm:state rdf:resource="https://jazz.server.com:9443/ccm/oslc/workflows/_TN0swJPUEeOnRa9khWwR1A/states/com.ibm.team.workitem.defectWorkflow/com.ibm.team.workitem.defectWorkflow.state.s3"/>
	<rtc_cm:subscribers oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:subscribers"/>
	<dc:subject/>
	<dc:modified>2014-02-12T10:56:40.239Z</dc:modified>
	<rtc_cm:modifiedBy rdf:resource="https://jazz.server.com:9443/jts/users/philippe"/>
	<rtc_cm:ownedBy rdf:resource="https://jazz.server.com:9443/jts/users/bill"/>
	<rtc_cm:projectArea rdf:resource="https://jazz.server.com:9443/ccm/oslc/projectareas/_TN0swJPUEeOnRa9khWwR1A"/>
	<rtc_cm:resolved>2014-02-12T10:56:25.445Z</rtc_cm:resolved>
	<rtc_cm:resolvedBy rdf:resource="https://jazz.server.com:9443/jts/users/philippe"/>
	<rtc_cm:startDate/>
	<dc:title>Silently dropped exception in ClassRoadie (beforetest)</dc:title>
	<rtc_cm:plannedFor rdf:resource="https://jazz.server.com:9443/ccm/oslc/iterations/_TPm1cpPUEeOpAbBwyZpuzw"/>
	<rtc_cm:timeSpent/>
	<dc:type rdf:resource="https://jazz.server.com:9443/ccm/oslc/types/_TN0swJPUEeOnRa9khWwR1A/defect"/>
	<rtc_cm:teamArea/>
	<rtc_cm:timeSheet rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:timeSheet"/>
	<rtc_cm:progressTracking rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/progressTracking"/>
	<oslc_pl:schedule rdf:resource="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/schedule"/>
	<calm:affectsExecutionResult oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:affectsExecutionResult"/>
	<calm:blocksTestExecutionRecord oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:blocksTestExecutionRecord"/>
	<calm:testedByTestCase oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:testedByTestCase"/>
	<calm:implementsRequirement oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:implementsRequirement"/>
	<oslc_cm:tracksWorkItem oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/oslc_cm:tracksWorkItem"/>
	<oslc_cm:trackedWorkItem oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/oslc_cm:trackedWorkItem"/>
	<oslc_cm:relatedChangeManagement oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/oslc_cm:relatedChangeManagement"/>
	<calm:tracksChanges oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:tracksChanges"/>
	<calm:relatedTestCase oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedTestCase"/>
	<calm:relatedTestScript oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedTestScript"/>
	<calm:relatedExecutionRecord oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedExecutionRecord"/>
	<calm:relatedTestPlan oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedTestPlan"/>
	<calm:tracksRequirement oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:tracksRequirement"/>
	<calm:relatedRequirement oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedRequirement"/>
	<calm:elaboratedByArchitectureElement oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:elaboratedByArchitectureElement"/>
	<calm:affectsPlanItem oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:affectsPlanItem"/>
	<calm:affectedByDefect oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:affectedByDefect"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionBuildResult.promotionBuildResult oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionBuildResult.promotionBuildResult"/>
	<rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.blocks oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.blocks"/>
	<rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionDefinition.promotionDefinition oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionDefinition.promotionDefinition"/>
	<rtc_cm:com.ibm.team.workitem.linktype.attachment.attachment oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.attachment.attachment"/>
	<rtc_cm:com.ibm.team.enterprise.package.linktype.packageDefinition.packageDefinition oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.package.linktype.packageDefinition.packageDefinition"/>
	<rtc_cm:com.ibm.team.build.linktype.includedWorkItems.com.ibm.team.build.common.link.includedInBuilds oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.build.linktype.includedWorkItems.com.ibm.team.build.common.link.includedInBuilds"/>
	<rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom"/>
	<rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result"/>
	<rtc_cm:com.ibm.team.enterprise.package.linktype.packageBuildResult.packageBuildResult oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.package.linktype.packageBuildResult.packageBuildResult"/>
	<rtc_cm:com.ibm.team.connector.ccbridge.common.act2wi.s oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.connector.ccbridge.common.act2wi.s"/>
	<rtc_cm:com.ibm.team.connector.ccbridge.common.ver2wi.s oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.connector.ccbridge.common.ver2wi.s"/>
	<rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolves oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolves"/>
	<rtc_cm:com.ibm.team.build.linktype.includedDeployments.com.ibm.team.build.common.link.includedInDeployment oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.build.linktype.includedDeployments.com.ibm.team.build.common.link.includedInDeployment"/>
	<rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentDefinition.packageDefinition oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentDefinition.packageDefinition"/>
	<rtc_cm:com.ibm.team.build.linktype.reportedWorkItems.com.ibm.team.build.common.link.reportedAgainstBuilds oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.build.linktype.reportedWorkItems.com.ibm.team.build.common.link.reportedAgainstBuilds"/>
	<rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentBuildResult.packageBuildResult oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentBuildResult.packageBuildResult"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.promoted oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.promoted"/>
	<rtc_cm:com.ibm.team.scm.svn.linkType.workItem.s oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.scm.svn.linkType.workItem.s"/>
	<rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicateOf oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicateOf"/>
	<calm:relatedTestSuite oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/calm:relatedTestSuite"/>
	<rtc_cm:com.ibm.team.workitem.linktype.relatedworkitem.related oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.relatedworkitem.related"/>
	<rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.predecessor oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.predecessor"/>
	<rtc_cm:com.ibm.team.build.linktype.includedPackages.com.ibm.team.build.common.link.includedInPackages oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.build.linktype.includedPackages.com.ibm.team.build.common.link.includedInPackages"/>
	<rtc_cm:com.ibm.team.connector.scm.common.linkType.importerDependency.t oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.connector.scm.common.linkType.importerDependency.t"/>
	<rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolvedBy oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolvedBy"/>
	<rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copies oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copies"/>
	<rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicates oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicates"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedChangeSets.promotedChangeSets oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedChangeSets.promotedChangeSets"/>
	<rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.promoted oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.promoted"/>
	<rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.children oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.children"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedBuildMaps.promotedBuildMaps oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedBuildMaps.promotedBuildMaps"/>
	<rtc_cm:com.ibm.team.connector.scm.common.linkType.tracksUcmObject.t oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.connector.scm.common.linkType.tracksUcmObject.t"/>
	<rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.successor oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.successor"/>
	<rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact"/>
	<rtc_cm:com.ibm.team.filesystem.workitems.change_set.com.ibm.team.scm.ChangeSet oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.filesystem.workitems.change_set.com.ibm.team.scm.ChangeSet"/>
	<rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn"/>
	<rtc_cm:com.ibm.team.workitem.linktype.textualReference.textuallyReferenced oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.workitem.linktype.textualReference.textuallyReferenced"/>
	<rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.result oslc_cm:collref="https://jazz.server.com:9443/ccm/oslc/workitems/_UJVSwJPUEeOnRa9khWwR1A/rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.result"/>
</oslc_cm:ChangeRequest>

If you prefer to have your work item in a Jason format, you can use the same code and only change the value of your “Accept” header:

 
rem Authentication 
... 
rem Request the url using the authentication 
curl.exe -k -b %COOKIES% -H "Accept: application/x-oslc-cm-change-request+json" https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1

In this case the answer will be in a Jason format. It should look like this:

{"dc:description":"The exception gets caught silently in runProtected.
BTW any empty catch block should be forbidden in junit 😉
Sincerely, and good job with the 4 and annotations, really simplifies things !
",
"rtc_cm:due":null,
"rtc_cm:com.ibm.team.workitem.linktype.relatedworkitem.related":[],
"dc:identifier":1,
"rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.predecessor":[],
"rtc_cm:com.ibm.team.build.linktype.includedPackages.com.ibm.team.build.common.link.includedInPackages":[],
"rtc_cm:com.ibm.team.filesystem.workitems.change_set.com.ibm.team.scm.ChangeSet":[],
"rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.dependsOn":[],
"rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolvedBy":[]
"rtc_cm:com.ibm.team.workitem.linktype.textualReference.textuallyReferenced":[],
"calm:relatedTestPlan":[],
"rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copies":[],
"calm:relatedTestCase":[],
"calm:relatedRequirement":[],
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedChangeSets.promotedChangeSets":[],
"rtc_cm:archived":false,
"rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.children":[],
"rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.promoted":[],
"rtc_cm:plannedFor":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/iterations\/_TPm1cpPUEeOpAbBwyZpuzw"},
"calm:implementsRequirement":[],
"oslc_cm:tracksWorkItem":[],
"rtc_cm:subscribers":[{"rdf:resource":"https:\/\/jazz.server.com:9443\/jts\/users\/jennifer"}],
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotedBuildMaps.promotedBuildMaps":[],
"rtc_cm:com.ibm.team.connector.scm.common.linkType.tracksUcmObject.t":[],
"dc:title":"Silently dropped exception in ClassRoadie (beforetest)",
"rtc_cm:state":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workflows\/_TN0swJPUEeOnRa9khWwR1A\/states\/com.ibm.team.workitem.defectWorkflow\/com.ibm.team.workitem.defectWorkflow.state.s3"},
"rtc_cm:timeSheet":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/rtc_cm:timeSheet"},
"rtc_cm:resolvedBy":{"rdf:resource":"https:\/\/jazz.server.com:9443\/jts\/users\/philippe"},
"rtc_cm:com.ibm.team.workitem.linktype.schedulePredecessor.successor":[],
"rtc_cm:com.ibm.team.workitem.linktype.relatedartifact.relatedArtifact":[],
"rtc_cm:com.ibm.team.build.linktype.includedWorkItems.com.ibm.team.build.common.link.includedInBuilds":[],
"calm:testedByTestCase":[],
"rtc_cm:comments":[{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/rtc_cm:comments\/0"},{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/rtc_cm:comments\/1"},{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/rtc_cm:comments\/2"}],
"oslc_cm:severity":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/enumerations\/_TN0swJPUEeOnRa9khWwR1A\/severity\/severity.literal.l3"},</pre>
"rtc_cm:resolved":"2014-02-12T10:56:25.445Z",
"calm:relatedTestScript":[],
"rtc_cm:com.ibm.team.connector.ccbridge.common.act2wi.s":[],
"rtc_cm:timeSpent":null,
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.result":[],
"dc:subject":"",
"dc:creator":{"rdf:resource":"https:\/\/jazz.server.com:9443\/jts\/users\/jennifer"},
"rtc_cm:modifiedBy":{"rdf:resource":"https:\/\/jazz.server.com:9443\/jts\/users\/philippe"},
"oslc_cm:relatedChangeManagement":[],
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionBuildResult.promotionBuildResult":[],
"rtc_cm:progressTracking":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/progressTracking"},
"rtc_cm:contextId":"_TN0swJPUEeOnRa9khWwR1A",
"calm:elaboratedByArchitectureElement":[],
"rtc_cm:teamArea":null,
"rtc_cm:com.ibm.team.connector.ccbridge.common.ver2wi.s":[],
"rtc_cm:startDate":null,
"calm:tracksChanges":[],
"calm:tracksRequirement":[],
"rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent":[],
"rtc_cm:com.ibm.team.workitem.linktype.blocksworkitem.blocks":[],
"rtc_cm:com.ibm.team.build.linktype.includedDeployments.com.ibm.team.build.common.link.includedInDeployment":[],
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.promotionDefinition.promotionDefinition":[],
"rtc_cm:com.ibm.team.workitem.linktype.attachment.attachment":[],
"rtc_cm:com.ibm.team.enterprise.package.linktype.packageDefinition.packageDefinition":[],
"rtc_cm:com.ibm.team.workitem.linktype.copiedworkitem.copiedFrom":[],
"rtc_cm:com.ibm.team.enterprise.packaging.linktype.resultWorkItem.result":[],
"oslc_cm:priority":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/enumerations\/_TN0swJPUEeOnRa9khWwR1A\/priority\/priority.literal.l01"},
"rtc_cm:com.ibm.team.enterprise.package.linktype.packageBuildResult.packageBuildResult":[],
"rtc_cm:projectArea":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/projectareas\/_TN0swJPUEeOnRa9khWwR1A"},
"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/1",
"rtc_cm:foundIn":null,
"dc:type":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/types\/_TN0swJPUEeOnRa9khWwR1A\/defect"},
"calm:relatedTestSuite":[],
"calm:blocksTestExecutionRecord":[],
"calm:relatedExecutionRecord":[],
"rtc_cm:estimate":14400000,
"rtc_cm:resolution":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workflows\/_TN0swJPUEeOnRa9khWwR1A\/resolutions\/com.ibm.team.workitem.defectWorkflow\/1"},
"calm:affectsPlanItem":[],
"rtc_cm:correctedEstimate":null,
"rtc_cm:com.ibm.team.workitem.linktype.resolvesworkitem.resolves":[],
"oslc_cm:trackedWorkItem":[],
"rtc_cm:com.ibm.team.connector.scm.common.linkType.importerDependency.t":[],
"dc:modified":"2014-02-12T10:56:40.239Z",
"rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentDefinition.packageDefinition":[],
"rtc_cm:ownedBy":{"rdf:resource":"https:\/\/jazz.server.com:9443\/jts\/users\/bill"},
"rtc_cm:filedAgainst":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/resource\/itemOid\/com.ibm.team.workitem.Category\/_UF6LUJPUEeOnRa9khWwR1A"},
"rtc_cm:com.ibm.team.build.linktype.reportedWorkItems.com.ibm.team.build.common.link.reportedAgainstBuilds":[],
"dc:created":"2014-02-09T10:00:08.139Z",
"rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicates":[],
"oslc_pl:schedule":{"rdf:resource":"https:\/\/jazz.server.com:9443\/ccm\/oslc\/workitems\/_UJVSwJPUEeOnRa9khWwR1A\/schedule"},
"calm:affectsExecutionResult":[],
"rtc_cm:com.ibm.team.enterprise.deployment.linktype.deploymentBuildResult.packageBuildResult":[],
"rtc_cm:com.ibm.team.scm.svn.linkType.workItem.s":[],
"rtc_cm:com.ibm.team.enterprise.promotion.linktype.resultWorkItem.promoted":[],
"calm:affectedByDefect":[],
"rtc_cm:com.ibm.team.workitem.linktype.duplicateworkitem.duplicateOf":[]}

You can limit the amount of returned information by indicating the fields of work item in your REST request.
For example, the following URL:

https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=dc:title,dc:identifier,rtc_cm:ownedBy

By adding “?oslc_cm.properties=dc:title,dc:identifier,rtc_cm:ownedBy” we limits the answer to the summary, the ID and the owner of the corresponding work item… So the following code:

curl.exe -k -b %COOKIES% -H "Accept: application/x-oslc-cm-change-request+xml" https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1?oslc_cm.properties=dc:title,dc:identifier,rtc_cm:ownedBy

will return the following answer:

<?xml version="1.0" encoding="UTF-8"?>
<oslc_cm:ChangeRequest 
	xmlns:oslc_cm="http://open-services.net/xmlns/cm/1.0/"
	rdf:about="https://jazz.server.com:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/1"
	xmlns:dc="http://purl.org/dc/terms/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/">

	<dc:identifier>1</dc:identifier>
	<rtc_cm:ownedBy rdf:resource="https://jazz.server.com:9443/jts/users/bill"/>
	<dc:title>Silently dropped exception in ClassRoadie (beforetest)</dc:title>
</oslc_cm:ChangeRequest>

Feel free to select the fields you really want to see or to change.

 

I hope this first part helped you understand how to use cURL to interact with the RTC OSLC layer…

On the next part, we will explain how to create a work item…

Advertisements

6 thoughts on “CRUD RTC work items using cURL (Part 1: Read)

  1. Hi Philippe, this is a straight to the point and nicely done document. No doubt I’ll share this link to customers/colleagues ! I look forward the 3 next parts. Thanks !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s