It's all about the answers!

Ask a question

Api rest for view all project area and project area creation


Emiliano Iannetti (389) | asked Aug 11 '21, 12:15 p.m.
edited Aug 11 '21, 12:17 p.m.

 Hi everyone, I would like some clarifications.

I have searched far and wide, but unfortunately I have not found what is right for me, especially as I am a newbie to REST services so I apologize in advance.
After several searches I found this string for the project area getAll and it works:
https: // hostname: port / ccm / rpt / repository / foundation? fields = foundation / projectArea / (name | teamMembers / userId)

Now I wanted to ask you mainly the url and the body of the call for creating a workarea, as the body I would also have found it, maybe:

 <? xml version = "1.0" encoding = "UTF-8"?>

<jp06: project-area xmlns: jp06 = "http://jazz.net/xmlns/prod/jazz/process/0.6/" jp06: templateId = "com.ibm.team.process.test" jp06: templateLocale = " en_US ">

   
<jp06: name> testProjectAreaCreation </ jp06: name>
    <jp06: summary> The summary </ jp06: summary>
    <jp06: description> The description </ jp06: description>
    <jp06: visibility jp06: access = "PUBLIC" />
</ jp06: project-area>

  But I can't find the url for the post call, I'm going crazy and above all I've often read that you postpone here:
https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#Project_Areas_collection, but here I find only the "parameters" but not the end points for the calls. I also take this opportunity to find out if there is a sort of summary (including the end point, however) to do other operations as well, such as modifying a project area for example. I apologize for my English but it is the work of Google Translate.
Oh one last thing, for get or post calls, I have to login first right? And how do I know when the login call I have made expires?
Thanks everyone in advance.

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered Aug 12 '21, 6:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 12 '21, 6:35 a.m.

 https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi#Service_Entry_Points_start_here


states:

Project Areas collection
URL: the value of the rdf:resource attribute from the projectAreas element in the server's rootservices document.

So you GET the rootservices e.g.


The response XML contains the services. You want the projectAreas service.


So in the example: https://elm.example.com:9443/ccm/process/project-areas  is the Project Areas Collection URI to send to.


Emiliano Iannetti selected this answer as the correct answer

Comments
Ralph Schoon commented Aug 12 '21, 6:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

I am absolutely in agreement that a simple example like the above would have been nice and helpful. The discovery using the rootservices document and this kind of flow is absolutely typical. The flows are often longer.  


Emiliano Iannetti commented Aug 12 '21, 9:13 a.m.

Here I am again and after some tests maybe I managed the end point for the post is the following:

https://server:port/ccm/process/project-areas
So the same depending on whether you call get or post changes the result, in fact now with the body presented above it returns me that it does not find the templateId: com.ibm.team.process.test
Now I'm here to ask you, where do I get this id? I know the uid of a workArea, but I don't know (and I apologize) the templateId ... Thanks.

6 other answers



permanent link
Ralph Schoon (63.1k33645) | answered Aug 13 '21, 2:25 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 13 '21, 2:40 a.m.

 Note, In order to be able to POST successfully, add a header X-Jazz-CSRF-Prevent and in the value paste the value of the JSESSIONID Cookie from your session (e.g. you get it during the login or GET operations).


If you fail to do so, the server will reject the request with a 403 Forbidden. I am not aware if this is documented anywhere, but you can find it in the forum.

If you copy paste, make sure to replace the contributor URI's in the example to valid ones e.g. in my case

not


Comments
Emiliano Iannetti commented Aug 13 '21, 9:36 a.m. | edited Aug 13 '21, 9:38 a.m.
Here I am again, I managed to create the PA with the tip you reported to me, I missed it yesterday. But I have the same problem or rather, if I use a processTemplate that has preconditions, it doesn't initialize, if I use one without preconditions I can. 
Now I have to understand if there is a way through rest to tell the PA to inherit the processConfiguration, if it is not there I find it through APIJava and I make it serviceRest hoping that it will then be able to initialize the PA.

In the meantime, thanks for everything and sorry if maybe I express myself badly in the concepts. 


Ralph Schoon commented Aug 16 '21, 2:59 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note that inheriting a shared process requires to use the "Unconfigured Process" to create the sharing project area. Like usual, it is necessary to understand how the system behaves and how to work with the system, before being able to automate the process. 


Emiliano Iannetti commented Aug 24 '21, 5:30 a.m.

Hi Ralph sorry I'm late sorry but in this case I have to contradict you or rather if I understand what you mean I can tell you that it is not so. We have a processTemplate, configured, when this is inherited from the new project area, this too inherits all the configuration, with attached conditions and the rest and is also initialized, I attach some screens.

The problem with the Rest API is that I can't find (how I managed) to tell them, in the request body. Here is the link to the screen, this was created using a Java api, but inherits the process Configuration from another that has already been preconfigured and is not empty: https://ibb.co/CsBfQGf
I assure you that the PA from which it inherits everything is configured ad hoc and this one that inherits it receives everything.



Ralph Schoon commented Aug 24 '21, 7:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

And I assure you, you do not do it right and what you have done makes process sharing impossible. It might look like it works, but, in fact, it does not. 


We have something called documentation. There is a lot of room for improvement, I give you that. 

Anyway, follow https://www.ibm.com/docs/en/elm/7.0.3?topic=pm-standardize-process-by-using-project-area-process-sharing and notice that in step 2 the process template "Unconfigured Process" is used to create the template for step 3. This is important, because the "Unconfigured Process" template has no configuration for the parts of the process that are supposed to be inherited from the sharing process area.


permanent link
Emiliano Iannetti (389) | answered Aug 12 '21, 11:30 a.m.

Here I am again, re-reading the answer, I realized that maybe I have explained myself badly, I try to do it better.

This endPoint:
https://hostname:port/ccm/process/project-areas
If sent in get, it returns all the PAs present, if sent in post through a suitable body it should enter the PA.
Now making the call in get, I get the result if I do it in post it returns 403 to me (as long as the body is correct) but I do not think that the 403 is due to a failed login I believe more than anything else that it is not possible, but in the link above there is the get for the PA Collection that inserts one with two members, I tried to do exactly the same thing and the user with whom I do it has the rights to create them.


permanent link
Ralph Schoon (63.1k33645) | answered Aug 12 '21, 9:58 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 12 '21, 9:58 a.m.

 If users try these APIs, I have to assume some basic knowledge of RTC and its administration. 


If you want to use the API for something e.g. creating a project area, you better know how that works in the tool. 

If you want to create an EWM Project, you have to provide a process template. Process templates are maintained in the admin section and have an ID which is clearly visible in the admin UI.

Another way of getting the process template ID would be to use the API we talk about here to GET the project areas and to inspect the response body for the ID's  


Comments
Emiliano Iannetti commented Aug 12 '21, 11:21 a.m.

 You're right too, but I didn't find the tab I needed, then I found it. I know very well the creation of a manual PA, indeed we have also created PA that inherit the processConfiguration from another PA, which I did not understand if it can be done or not via APIRest.

The call is ready and functional only that a 403Forbidden always comes back to me, I tried various authentication methods but nothing, he on Postman also inherits the cookie for the connection but there is no way to make him do it, even if the Post in the collections of PA there but in the PA and just no and this thing leaves me perplexed, maybe it can't be done?


permanent link
Emiliano Iannetti (389) | answered Aug 12 '21, 6:40 a.m.

Thank you very much what you posted is very useful, this afternoon I will study it well. But I have to ask you two more questions, I try to post them here, otherwise I will open a new post.

The first is that all the calls, I see that require a login to be made, so at the moment I have two end points, one for the login and one for the request, I don't know if merging them together can solve the problem of separation, otherwise there is a way to not always request the login?
Another question, I have to create a project Area that inherits the process template from a father, is there any way to tell him in the call? I state that the list you provided me has not yet been studied well, but this afternoon I go under to see it, in the meantime, thank you very much.
@David Can you explain to me what you are referring to for OSCL is a completely new topic for me and I apologize for that. Thank you.


Comments
Ralph Schoon commented Aug 12 '21, 6:56 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 This should be a comment and not an answer.


See https://jazz.net/wiki/bin/view/Main/NativeClientAuthentication for the authentication part. If this is too confusing see https://rsjazz.wordpress.com/2019/05/13/using-a-rest-client-to-authenticate-to-elm-clm-applications/ which is oversimplifying a bit. In reality you send your request, then you check if the request works. If it fails you check for a redirect to authenticate or if basic auth is needed etc. Then you authenticate as required and retry the request.

See https://jazz.net/wiki/bin/view/Deployment/CLMProductAPILanding and check the links and especially the OSLC section. There is no OSLC API to create project areas, so I would ignore that aspect for now.


David Honey commented Aug 12 '21, 7:00 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This is a good introduction to OSLC: https://open-services.net/resources/oslc-primer/
The OSLC specifications (there are many) can be found linked from here: https://open-services.net/specifications/



Emiliano Iannetti commented Aug 12 '21, 7:05 a.m.

You're right sorry, I could not find the link.

This time I'm not wrong, perfect today I see it I also tried to make a "united" call but it didn't lead to much. A little note, I saw the link of the services, but I did not find the endpoints that I need, maybe because I should merge them with the other page, then I see and then I wanted to tell you, for the moment I am only trying with Postman (or SoapUI ) so from the interface I don't think it changes much, but it was something I hadn't said. Thanks again for everything, after careful study I will try to answer again.


Ralph Schoon commented Aug 12 '21, 7:17 a.m. | edited Aug 12 '21, 7:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Sorry, I do not understand what you are trying to say here. With respect to the API endpoints, usually you have to discover them using the aforementioned rootservices document and possibly even more calls using URIS discovered so far. 

Postman works good enough. The SOAP APIs are all internal APIS. You should only use the APIS exposed in the API landing page and avoid internal APIs.


permanent link
Emiliano Iannetti (389) | answered Aug 12 '21, 4:36 a.m.

Thanks Ralph, for the answer, but the link you gave me, which by the way is the one I found but that does not present the endpoints, or at least I can't see them, there are the "creation" posts also the body that I posted in question is taken from there but "parameterized" for my needs. The problem is that I can't find the call endpoints.

The guide would be better, from my point of view, if it did not deduce the end points but presented them directly, certainly it is my lack, but in my "ignorance" on the subject I could tell you that they exist because there are also posts of more "objects "it's just that the end point for the call is missing, anyway thanks again, if I find something else too, I'll update the post.


permanent link
Ralph Schoon (63.1k33645) | answered Aug 12 '21, 3:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 As far as I can tell, the API https://hostname:port/ccm/rpt/ is part of the reportable REST API. It is a read-only API.


I am not sure if there is a public REST API that allows to do what you want. So far I have always used the Plain Java Client Libraries to automate this.  The https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi API would be your best bet. I will look and try to figure out what the URL should look like later and try to answer here, in case I can find it.

I share your feeling I have had similar issues with our REST and OSLC APIs.


Comments
David Honey commented Aug 12 '21, 4:40 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is an area where foundation could provide a deeper OSLC implementation than it currently does. For example, provide an OSLC query capability and creation factory for project areas that was discoverable from the OSLC service provider catalog, and support media types such as application/rdf+xml, application-x-turtle, text/turtle for GET/PUT/POST as recommended by OSLC Core. The https://jazz.net/wiki/bin/view/Main/DraftTeamProcessRestApi is not OSLC compliant, but AFAIK, is the only means to create or modify project areas.


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.