Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How should i extract the title of the moduleContent of requirments using REST API

 When I call this: https://localhost:9443/rm/publish/resources?resourceURI=-I4ezTYYEeqPqJ6cXaaMqA for highlighted resource, i get only a partial text content, i.e., text content is cropped after some level. 

"""
<ds:moduleContext>
<rrm:contextBinding>
<rrm:about>
https://localhost:9443/rm/resources/-I4ezTYYEeqPqJ6cXaaMqA
</rrm:about>
<rrm:identifier>27</rrm:identifier>
<rrm:title>
Second testing change. Im making a change for testing. This use case starts when the actor does something. An actor always initiates use cases. The use case describes what the actor does and what the system does in response. It is phrased in the form of a 
"""

But the title content should be this: 
"""
Second testing change. Im making a change for testing. This use case starts when the actor does something.  An actor always initiates use cases.  The use case describes what the actor does and what the system does in response. It is phrased in the form of a dialog between the actor and the system.
"""
How should i change my query (https://localhost:9443/rm/publish/resources?resourceURI=_-I4ezTYYEeqPqJ6cXaaMqA) to get the full text content of the tile?

0 votes



One answer

Permanent link

This is expected. dataSource/artifact/moduleContext/contextBinding/title returns only first 256 characters. To print the requirement completely (with formatting), you must use "text" artifact type (that is, do a GET request on https://localhost:9443/rm/publish/text?resourceURI=-I4ezTYYEeqPqJ6cXaaMqA) and use dataSource/artifact/content/text/richTextBody/div. You see the length limitation when you print dataSource/artifact/title (for resources or text artifact) as well.

0 votes

Comments

Thank you so much. I'm net to Jazz and REST API. I wonder whether you can explain bit more. 

As you said, I requested "text" artifact by  and saved the content in to a .xml.  but it has so much details in it. 
{
tree = ET.ElementTree(ET.fromstring(response.text))
tree.write('../data/xml_files/temp1.xml')
}

Can you explain what you mean by " use dataSource/artifact/content/text/richTextBody/div" ? I want to extract clean text content. 


By dataSource/artifact/content/text/richTextBody/div I meant the XPath in the XML data. Since you can edit the requirement text in rich text editor, you will get the formatting along with the text.
If you want plain text, you can append ptext=true to the request URL (ex.
https://localhost:9443/rm/publish/text?resourceURI=_-I4ezTYYEeqPqJ6cXaaMqA&ptext=true or
https://localhost:9443/rm/publish/resources?resourceURI=_-I4ezTYYEeqPqJ6cXaaMqA&ptext=true) and use dataSource/artifact/primaryText

Hmmm.... I think I did explain what i wanted in a wrong way. I want to take the text within <rrm:title> .....tex tex text </rrm:title> 


<ds:moduleContext>
<rrm:contextBinding>
<rrm:about>
</rrm:about>
<rrm:identifier>27</rrm:identifier>
<rrm:title>
Second testing change. Im making a change for testing. This use case starts when the actor does something. An actor always initiates use cases. The use case describes what the actor does and what the system does in response. It is phrased in the form of a <<missing text>>
</rrm:title>

I apologies for asking again. Thank you.

For title attribute, the maximum number of characters is limited to 256.

Thank you for letting me know. I'll check whether there is any other way to get full title data using Rest API

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,019

Question asked: Sep 17 '20, 5:39 p.m.

Question was seen: 1,580 times

Last updated: Sep 21 '20, 1:03 p.m.

Confirmation Cancel Confirm