Creating a Work Item in RTC/RQM 4.0 using OSLC REST API Pragmatically in Java
7 answers
Comments
Your HTTP client is not authenticated with the RTC server. Try logging into RTC from FireFox and using Poster and/or HttpRequester to make the HTTP request.
We have seen 403 error when the below situation applied:
1)the user does not have "create workitem" permission
2) the user does not have right license
3) the user is not the member of the project area
4) after 4.0.0.1, header [X-Jazz-CSRF-Prevent] value as current JSESSIONID(from) is requied: https://jazz.net/forum/questions/98072/x-jazz-csrf-prevent-header-is-required-to-create-a-work-item-via-oslc-on-version-4001
it's a good point you've already experienced the OSLC workshop.
As you've figured out already, it misses an RQM-related section. For the moment (but there are plans to add such subpart to it). In the meanwhile, you've a starting point (code for auth, etc. )
In addition to the RQM wikis (providing extensive information and already pointed out to you by Paul), you could check sample-based "cheat sheets" / "How Tos" provided in this blog:
http://sleroyblog.wordpress.com/2013/04/09/querying-rqm-40-through-oslc-and-rest-api/
Regards,
Stéphane
See if this article offers any help: https://issues.apache.org/jira/browse/HTTPCLIENT-896. It looks like the "Expires" value for your cookie is not in a valid format (for whatever reason) and this article provides some steps in the comments to workaround.
It works fine after adding the header [X-Jazz-CSRF-Prevent] value as current JSESSIONID for me.
reference: https://jazz.net/forum/questions/98072/x-jazz-csrf-prevent-header-is-required-to-create-a-work-item-via-oslc-on-version-4001
i.e postRequest.addHeader("X-Jazz-CSRF-Prevent","
AAAACF37530880CEE8034FD5A890453F")
You can also try to make a POST request via REST Client add-on in Firefox.
Comments
Hi Rahul,
i am trying to create a category in RQM using RESTAPI (Java). i get this error below,
Jan 20, 2017 4:28:13 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: WASReqURL=""; Expires=Thu, 01 Dec 1994 16:00:00 GMT; Path=/; Secure; HttpOnly". Invalid 'expires' attribute: Thu, 01 Dec 1994 16:00:00 GMT
is it because of session id issue ? if so how can i overcome with this problem?
i used IRawRestClientConnection to perform doPost operation.
So my request (working ) is :
<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/terms/"xmlns:public_rm_10="http://www.ibm.com/xmlns/rm/public/1.0/"xmlns:calm="http://jazz.net/xmlns/prod/jazz/calm/1.0/"xmlns:rm="http://www.ibm.com/xmlns/rdm/rdf/"xmlns:acp="http://jazz.net/ns/acp#"xmlns:rm_property="https://grarrc.ibm.com:9443/rm/types/"xmlns:oslc="http://open-services.net/ns/core#"xmlns:nav="http://jazz.net/ns/rm/navigation#"xmlns:oslc_rm="http://open-services.net/ns/rm#" ><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">OSLC Creation Example 2</dc:description><dc:title rdf:parseType="Literal">OSLC Created Requirement 2</dc:title><dc:contributor rdf:resource="https://10.0.2.79:9443/jts/users/Admin"/><oslc:instanceShape rdf:resource="https://10.0.2.79:9443/rm/types/_opYnsUZsEeWL2aNIq4SA-w"/><nav:parent rdf:resource="https://10.0.2.79:9443/rm/folders/_4du-YEDTEeW98vRabXRPEQ"/></rdf:Description></rdf:RDF>with header :
Content-Type: application/rdf+xml
Comments
Eric Lemes
Oct 12 '17, 10:05 a.m.Hi Rahul,