It's all about the answers!

Ask a question

create work item with REST service


Milan Krivic (9808161132) | asked Oct 20 '16, 10:06 a.m.
 Hi,

I am trying to create work item with REST service with json structure.

In old version of REST addons of Google Chrome and Mozzila Firefox I was successfull to do it, but now I am getting 302 status always, which says that I need authentification. 
I 've been already authenticated during the REST service call, but still the same thing.

Now, I am using only Mozzila firefox rest addon.

Here is my url for creating work item in JKE banking (ccm):

https://clm_server:9443/jazz/oslc/contexts/_SBqxwYO_Eea1JuvQPYWTpg/workitems/task

Here is my body content:

{
    "dc:title":"Test work item",
    "dc:description":"Test wi description",
    "dc:type":
    {
        "rdf:resource":"https:\/\/clm_server:9443\/jazz\/oslc\/types\/_SBqxwYO_Eea1JuvQPYWTpg\/task"
    },
    "rtc_cm:filedAgainst":
    {
        "rdf:resource":"https:\/\/clm_server:9443\/jazz\/resource\/itemOid\/com.ibm.team.workitem.Category\/_uJOSiIO_Eea1JuvQPYWTpg"
    },
"rtc_cm:state":{"rdf:resource":"https:\/\/clm_server:9443\/jazz\/oslc\/workflows\/_SBqxwYO_Eea1JuvQPYWTpg\/states\/com.ibm.team.workitem.taskWorkflow\/1"},
   "rtc_cm:ownedBy":
           {
             "rdf:resource":"https:\/\/clm_server:9443\/jts\/users\/bob"
           },

"rtc_cm:com.ibm.team.workitem.linktype.parentworkitem.parent":[
{
"rdf:resource":"https:\/\/clm_server:9443\/jazz\/resource\/itemName\/com.ibm.team.workitem.WorkItem\/215813"}]
}

After I run Send, I am getting the following response:

It seems my user don't have appropriate rights, but I am logged in while I 've been executing this REST service.

Am I doing something wrong?

Kind regards,
Milan

3 answers



permanent link
Donald Nong (14.4k314) | answered Nov 01 '16, 2:09 a.m.
You said the return code was 302 but your screen shot shows 403. Which one is correct?

If your screen shot is to be trusted, the error message says that your account lacks the JazzUsers (or JazzAdmins) repository role. As you appear to be using Firefox with the RESTClient addon, and you log on CCM already, the easiest way to verify is to go into the user profile and see what Repository Permissions have been assigned.

permanent link
Milan Krivic (9808161132) | answered Feb 20 '17, 3:47 a.m.

 Hi,


sorry for my late answer.
I am getting 403 Forbidden, and I checked for several times, my user is a part of Security groups that can access to JTS. 
Is there could be a reason in authentication type? We are using WAS 8.5.5. and SSO mechanism.

Regards,
Milan


Comments
Donald Nong commented Feb 20 '17, 7:06 p.m.

In WAS, security role mapping is done separately in JTS and CCM/(jazz in your case), so you need to do it separately. Having a correct role in JTS does not automatically give you the correct one in CCM.


permanent link
Milan Krivic (9808161132) | answered Feb 20 '17, 3:53 a.m.

 just to know, we are using form-based authentication.

Is there any example for calling rest service with form-based authentication?

Regards,
milan


Comments
Donald Nong commented Feb 20 '17, 7:05 p.m.

I've answered in your other post. Check this out.
https://jazz.net/wiki/bin/view/Main/ResourceOrientedWorkItemAPIv2#Appendix_A

Your answer


Register or to post your answer.