Can I use REST API to create a workitem in Complete/Closed status at once?
![]() I am using RESTClient in Firefox to create Workitems in RTC. (library versions 6.0.3) POST Request to Create workitem <o:p> </o:p> POST : https://localhost:9443/ccm/oslc/contexts/_GEcakBVmEee6xq3fftABNg/workitems/task <o:p> </o:p> Headers: <o:p> </o:p> Header Name | Header Value <o:p> </o:p> Accept | application/rdf+xml <o:p> </o:p> OSLC-Core-Version | 2.0 <o:p> </o:p> Content-Type | application/rdf+xml <o:p> </o:p> X-Jazz-CSRF-Prevent | JSESSIONID=00001IGA1EZ4wPHrGt-easJjnqs:f37b2418-3d73-415b-a35f-856e07d94d28; path=/ccm; domain=localhost; Secure; HttpOnly <o:p> </o:p> Body
<rdf:RDF xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/" xmlns:acp="http://jazz.net/ns/acp#" xmlns:process="http://jazz.net/ns/process#" xmlns:acc="http://open-services.net/ns/core/acc#" xmlns:oslc_pl="http://open-services.net/ns/pl#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:oslc="http://open-services.net/ns/core#" xmlns:oslc_cm="http://open-services.net/ns/cm#" xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/" xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"> <oslc_cm:ChangeRequest> <dcterms:title rdf:parseType="Literal">NEW REST API POST Sample Work Item</dcterms:title> <dcterms:description>Status IP Task Created from HTTP POST request</dcterms:description> <rtc_cm:type rdf:resource="https://localhost:9443/ccm/oslc/types/_GEcakBVmEee6xq3fftABNg/task"/> <rtc_cm:filedAgainst rdf:resource="https://localhost:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_Q5-ZsBVmEee7sYeSp0HetA"/> <rtc_cm:plannedFor rdf:resource="https://localhost:9443/ccm/oslc/iterations/_GRjpghVmEee7sYeSp0HetA"/> <oslc_cmx:priority rdf:resource="https://localhost:9443/ccm/oslc/enumerations/_GEcakBVmEee6xq3fftABNg/priority/priority.literal.l11"/> <oslc_cmx:project rdf:resource="https://localhost:9443/ccm/oslc/projectareas/_GEcakBVmEee6xq3fftABNg"/> <dcterms:contributor rdf:resource="https://localhost:9443/jts/users/myadmin"/> <rtc_cm:resolvedBy rdf:resource="https://localhost:9443/jts/users/myadmin"/> <rtc_cm:state rdf:resource="https://localhost:9443/ccm/oslc/workflows/_GEcakBVmEee6xq3fftABNg/states/com.ibm.team.workitem.taskWorkflow/com.ibm.team.workitem.taskWorkflow.state.s3"/> </oslc_cm:ChangeRequest>
</rdf:RDF>
This works fine to create a "New" task, except that the tickets that I will be migrating as tasks into RTC are already closed. Is is possible via REST APi, in one shot, to create the tickets, setup the status as "Complete" as well as populate resolvedBy, closeDate, ResolutioDate?
The only other option that I see is to : Create the tasks as "New", then query the workitems and update the status and the Resolution attributes.
|
One answer
![]() If really necessary, you can try to temporarily modify the workflow to suit. If I understand correctly, when you create a work item, the Start Action (usually is Initialize, whose target state is New) is called. Maybe you can choose the action, say Resolve, as the Start Action, temporarily.
|