Welcome to the Jazz Community Forum
HTTP 412 Error (Precondition Failed - the state identifier is stale) while updating RQM/ETM Test Case Validated By links

ELM Version: 7.0.2
Note: Starting on version 7.x, some slugs were included on DNG UUIDs names. We will now see 'BI_' URL as the current 7.x data model for module bound artifacts and 'TX_' URL for core artifacts, whereas the 'MB_' is now referred to as a "legacy URL'.
I'm developing a tool that fixes Validated By links between ETM Test Cases and DNG Requirement Artifacts. In DNG we create modules containing the requirement artifacts (module bound) to avoid linking other objects (Test Cases, DNG Artifacts) to the base artifacts (core).
- ETM Validated By link to DNG Module Bound Artifact (BI_UUID) link is correct.
- ETM Validated By link to DNG Core Artifact (TX_UUID) link is incorrect.
Similar Questions
- https://jazz.net/forum/questions/242902/how-to-avoid-http-412-precondtition-failed-when-adding-a-validated-by-link-to-a-dng-requirement
- This question explains basically the same issue and the accepted answer says that the problem was solved by adding the If-Match header, which I include as well in my HTTP request.
- https://jazz.net/forum/questions/279598/deferred-operation-failed-with-multi-threaded-client-application
- This question explains a similar issue where the response from QM server is a 412 error but it's happening (probably) due to some other thread modifying the same resource causing the etag to no longer match while creating a test case.
My PUT requests look like this:
- method: PUT
- url: https://server.com/qm/oslc_qm/contexts/:projectAreaID/resources/com.ibm.rqm.planning.VersionedTestCase/:testCaseVersionableItemID
- headers
- Accept: application/json, text/plain
- Content-Type: application/xml
- OSLC-Core-Version: 2.0
- If-Match: "36_3374602f-b3b6-3b77-b10e-246e108083f3_hG6iiQoYEe6hidAxdF51pA"
- oslc_config.context: https://server.com/gc/configuration/:gcID
- Authorization: Basic SOMETOKENVALUE==
- Cookie: LtpaToken2=SOMETOKENVALUE; JSESSIONID=SOMETOKENVALUE
- auth
- username: userSSO
- password: userPassword
- body data:
<?xml version="1.0"?>
xmlns:acp="http://jazz.net/ns/acp#"
xmlns:projectICG6EJS3EeyTEqtlEceqew_testCase="https://server.com/qm/oslc_qm/contexts/_ICG6EJS3EeyTEqtlEceqew/shape/resource/com.ibm.rqm.planning.VersionedTestCase#"
xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/"
xmlns:acc="http://open-services.net/ns/core/acc#"
xmlns:process="http://jazz.net/ns/process#"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:jrs="http://jazz.net/ns/jrs#"
xmlns:oslc_auto="http://open-services.net/ns/auto#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cmx="http://open-services.net/ns/cm-x#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rqm_lm="http://jazz.net/ns/qm/rqm/labmanagement#"
xmlns:oslc="http://open-services.net/ns/core#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:rqm_process="http://jazz.net/xmlns/prod/jazz/rqm/process/1.0/"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:oslc_cm="http://open-services.net/ns/cm#"
xmlns:rqm_qm="http://jazz.net/ns/qm/rqm#"
xmlns:oslc_qm="http://open-services.net/ns/qm#"
xmlns:oslc_rm="http://open-services.net/ns/rm#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
<rdf:Description rdf:about="https://server.com/qm/oslc_qm/contexts/_ICG6EJS3EeyTEqtlEceqew/resources/com.ibm.rqm.planning.VersionedTestCase/_WvaZse4UEey3H4CzUiOIDQ">
<dcterms:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">null</dcterms:description>
<rqm_qm:scriptStepCount rdf:datatype="http://www.w3.org/2001/XMLSchema#string">0</rqm_qm:scriptStepCount>
<dcterms:relation rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/_ICG6EJS3EeyTEqtlEceqew/testcase/urn:com.ibm.rqm:testcase:8010?oslc_config.context=https://server.com/gc/configuration/395"/>
<rqm_qm:category_Ine4AZS3EeyTEqtlEceqew rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/ELM_Script_Test_Area-NLR+%28RQM%29/category/urn:com.ibm.rqm:category:_InrsW5S3EeyTEqtlEceqew#"/>
<rqm_process:hasPriority rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_ICG6EJS3EeyTEqtlEceqew/priority/literal.priority.101"/>
<oslc_config:component rdf:resource="https://server.com/qm/oslc_config/resources/com.ibm.team.vvc.Component/_NpcWAJS3EeyTEqtlEceqew"/>
<rqm_process:hasWorkflowState rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/process-info/_ICG6EJS3EeyTEqtlEceqew/workflowstate/com.ge.av.workflow.testcase/com.ge.av.workflow.testcase.state.s0"/>
<acp:accessControl rdf:resource="https://server.com/qm/oslc_qm/accessControl/_ICG6EJS3EeyTEqtlEceqew"/>
<oslc_qm:validatesRequirement rdf:resource="https://server.com/rm/resources/BI_TQfmEOLYEe2D6ayPxmFHeQ"/>
<rqm_qm:template rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/ELM_Script_Test_Area-NLR+%28RQM%29/template/testcase/com.ibm.rqm.planning.templates.testcase.template_1440174715764"/>
<oslc:instanceShape rdf:resource="https://server.com/qm/oslc_qm/contexts/_ICG6EJS3EeyTEqtlEceqew/shape/resource/com.ibm.rqm.planning.VersionedTestCase"/>
<dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2022-06-17T08:06:13.451Z</dcterms:created>
<rqm_qm:category_Im6QQZS3EeyTEqtlEceqew rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/ELM_Script_Test_Area-NLR+%28RQM%29/category/urn:com.ibm.rqm:category:_Inb0sZS3EeyTEqtlEceqew#"/>
<dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">https://server.com/qm/oslc_qm/contexts/_ICG6EJS3EeyTEqtlEceqew/resources/com.ibm.rqm.planning.VersionedTestCase/_WvaZse4UEey3H4CzUiOIDQ</dcterms:identifier>
<dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2023-06-13T18:31:31.197Z</dcterms:modified>
<rqm_qm:category rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/ELM_Script_Test_Area-NLR+%28RQM%29/category/urn:com.ibm.rqm:category:_InrsW5S3EeyTEqtlEceqew"/>
<rqm_qm:category rdf:resource="https://server.com/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/ELM_Script_Test_Area-NLR+%28RQM%29/category/urn:com.ibm.rqm:category:_Inb0sZS3EeyTEqtlEceqew"/>
<oslc:serviceProvider rdf:resource="https://server.com/qm/oslc_qm/contexts/_ICG6EJS3EeyTEqtlEceqew/services.xml"/>
<process:projectArea rdf:resource="https://server.com/qm/process/project-areas/_ICG6EJS3EeyTEqtlEceqew"/>
<rqm_qm:shortIdentifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">8010</rqm_qm:shortIdentifier>
<projectICG6EJS3EeyTEqtlEceqew_testCase:customAttributeIWq02JS3EeyTEqtlEceqew rdf:datatype="http://www.w3.org/2001/XMLSchema#string">true</projectICG6EJS3EeyTEqtlEceqew_testCase:customAttribute__IWq02JS3EeyTEqtlEceqew>
</rdf:Description>
</rdf:RDF>
</xml>
It's worth saying that:
- ETag is the server's current version of the resource.
- My example request has variables instead of real IDs - UUIDs, you can identify those by seeing a " : " at the beginning of the variable.
After executing the request I'm getting the following error.
Error: AQXCM5006E
Description: The operation failed because the state identifier, "E-TAG", is stale.
My update algorithm follows the next logic:
- Fetch Test Cases information
- Updates oslc_qm:validatesRequirement value
- Execute HTTP PUT Request to save changes
As you can notice, I'm only modifying the oslc_qm:validatesRequirement property from the test case, so I don't know what I'm doing wrong.
Hopefully someone can help me with my issue :)
Accepted answer

One thing I notice that's incorrect is that you are using an
oslc_config.context
header. You should either use a
Configuration-Context
header, or a
oslc_config.context
parameter. See https://docs.oasis-open-projects.org/oslc-op/config/v1.0/ps01/config-resources.html#configcontext. Here is an example URI that specifies the concept URI of a test case with a configuration context: https://localhost:9443/qm/oslc_qm/contexts/_T43jwZwCEe2xw5MmkuLgyg/resources/com.ibm.rqm.planning.VersionedTestCase/_mWjACpwCEe2xw5MmkuLgyg?oslc_config.context=https%3A%2F%2Flocalhost%3A9443%2Fgc%2Fconfiguration%2F2