It's all about the answers!

Ask a question

Get attributes specific to a community and asset type using REST API


Kiran Kumar R (77810) | asked Jul 17 '12, 3:52 a.m.
edited Jul 18 '12, 2:33 a.m.

Hi,

Im working on creating a C#.Net application which integrates RAM with TFS using REST API. In RAM when user submits an asset, some of the attributes change according to the community and asset type selected. I want to replicate the same functionality in my code. I want to know the query to be used in RESTClient to get list of attributes name, type(string, int, date etc) and default value if any. Please refer to the link below to understand using REST API for RAM.

http://publib.boulder.ibm.com/infocenter/ramhelp/v7r5m0/index.jsp?topic=%2Fcom.ibm.ram.doc%2Ftopics%2Ft_using_api.html

If we do a get operation on the query http://inblr-3dvesrvqa:13080/ram/internal/communities/{Community GUID}/types on the REST Client, the response would be as below:


<atom:feed xml:base="http://inblr-3dvesrvqa:13080/ram/">

<atom:generator>RAM 7.x:(inblr-3dvesrvqa)</atom:generator>
<atom:id>
RAM 7.x [http://inblr-3dvesrvqa:13080/ram/internal/communities/1040/types] - 7/18/12 11:51 AM
</atom:id>
<atom:link type="text/xml" rel="self" href= "http://inblr-3dvesrvqa:13080/ram/internal/communities/1040/types" />
<atom:link type="application/xhtml+xml" rel="alternate" href= "http://inblr-3dvesrvqa:13080/ram/internal/communities/1040/types.wml" />
<atom:link type="application/json" rel="alternate" href= "http://inblr-3dvesrvqa:13080/ram/internal/communities/1040/types.json" />
<atom:title>Asset Types</atom:title>
<atom:updated>2012-07-18T11:51:58.199+05:30</atom:updated>
<atom:entry xml:base="http://inblr-3dvesrvqa:13080/ram/">
<atom:id>classif/assetTypesSchema.xmi#code_component</atom:id>
<atom:link type="text/xml" rel="alternate" href= "internal/types/classif/assetTypesSchema.xmi%23code_component" />
<atom:summary>
Source code files written in any programming language
</atom:summary>
<atom:title>Code Component</atom:title>
<atom:updated/>
<atom:content xml:base="http://inblr-3dvesrvqa:13080/ram/" type="application/xml">
<ram:assetType xml:base="com.ibm.ram.internal.rest.RestContext@1d5e1d5e" href= "internal/types/classif/assetTypesSchema.xmi%23code_component" identifier="classif/assetTypesSchema.xmi#code_component" dbid="1016">
<name>Code Component</name>
<description>
Source code files written in any programming language
</description>
<ram:communityAssetType rdf:resource="internal/types/classif/assetTypesSchema.xmi%23code_component/communities/1040">BPAM Reasearch</ram:communityAssetType>
<ram:configuration>
<?xml version="1.0" encoding="UTF-8"?> <com.ibm.ram.common.emf:AssetTypeConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:com.ibm.ram.common.emf="http:///com/ibm/ram/common/emf.ecore"> <constraints xsi:type="com.ibm.ram.common.emf:Attribute751Grouping"> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#com.ram.owners" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#com.ram.community" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#com.ram.type" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#com.ram.guid" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#asset_developer" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#development_context" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#document_list" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#effort_saving_index" required="true"/> <column1 xsi:type="com.ibm.ram.common.emf:AttributeConstraint" attributeName="classif/assetTypesSchema.xmi#execution_context" required="true"/> </constraints> <constraints xsi:type="com.ibm.ram.common.emf:CategoryGrouping"> <classificationSchemaURIs>classif/soamodel.xmi</classificationSchemaURIs> <classificationSchemaURIs>classif/testing.xmi</classificationSchemaURIs> </constraints> </com.ibm.ram.common.emf:AssetTypeConfiguration>
</ram:configuration>
<ram:restricted>true</ram:restricted>
<ram:private>false</ram:private>
</ram:assetType>
</atom:content>
</atom:entry>
<atom:entry xml:base="http://inblr-3dvesrvqa:13080/ram/">
<atom:id>classif/assetTypesSchema.xmi#test_asset_type</atom:id>
<atom:link type="text/xml" rel="alternate" href= "internal/types/classif/assetTypesSchema.xmi%23test_asset_type" />
<atom:summary>
This is a private asset type created by community "BPAM Reasearch."
</atom:summary>
<atom:title>Test Asset type</atom:title>
<atom:updated/>
<atom:content xml:base="http://inblr-3dvesrvqa:13080/ram/" type="application/xml">
<ram:assetType xml:base="com.ibm.ram.internal.rest.RestContext@1d5e1d5e" href= "internal/types/classif/assetTypesSchema.xmi%23test_asset_type" identifier="classif/assetTypesSchema.xmi#test_asset_type" dbid="1035">
<name>Test Asset type</name>
<description>
This is a private asset type created by community "BPAM Reasearch."
</description>
<ram:communityAssetType rdf:resource="internal/types/classif/assetTypesSchema.xmi%23test_asset_type/communities/1040">BPAM Reasearch</ram:communityAssetType>
<ram:restricted>true</ram:restricted>
<ram:private>true</ram:private>
</ram:assetType>
</atom:content>
</atom:entry>
<atom:entry xml:base="http://inblr-3dvesrvqa:13080/ram/">
<atom:id>classif/assetTypesSchema.xmi#tfs_artefact</atom:id>
<atom:link type="text/xml" rel="alternate" href= "internal/types/classif/assetTypesSchema.xmi%23tfs_artefact" />
<atom:summary>
This is a private asset type created by community "BPAM Reasearch."
</atom:summary>
<atom:title>TFS Artefact</atom:title>
<atom:updated/>
<atom:content xml:base="http://inblr-3dvesrvqa:13080/ram/" type="application/xml">
<ram:assetType xml:base="com.ibm.ram.internal.rest.RestContext@1d5e1d5e" href= "internal/types/classif/assetTypesSchema.xmi%23tfs_artefact" identifier="classif/assetTypesSchema.xmi#tfs_artefact" dbid="1033">
<name>TFS Artefact</name>
<description>
This is a private asset type created by community "BPAM Reasearch."
</description>
<ram:communityAssetType rdf:resource="internal/types/classif/assetTypesSchema.xmi%23tfs_artefact/communities/1040">BPAM Reasearch</ram:communityAssetType>
<ram:restricted>true</ram:restricted>
<ram:private>true</ram:private>
</ram:assetType>
</atom:content>
</atom:entry>
</atom:feed>


I will parse through similar responses and get the details I needed like community names etc.

The above response has the attributename tag under ram:configuration. But, it is not having correct attribute name, attribute type etc. I want to know what query i can pass through RESTClient and do an GET operation so that i will get a response which has all the asset attribute information needed. 

The headers added in the RESTClient for the above operation are:

Oslc-Core-Version : 2.0

Accept:application/rdf+xml

OSLC-Asset-Version: 2.0

The authentication used is basic authentication. 


Refer the links below to understand this further:


http://publib.boulder.ibm.com/infocenter/ramhelp/v7r2m0/index.jsp?topic=/com.ibm.ram.doc/topics/t_upload.html

http://publib.boulder.ibm.com/infocenter/ramhelp/v7r5m1/index.jsp?topic=%2Fcom.ibm.ram.doc%2Ftopics%2Fc_rest_api.html

https://jazz.net/wiki/bin/view/Main/RamRestApiMain


Regards,

Kiran

2 answers



permanent link
Rich Kulp (3.6k38) | answered Jul 17 '12, 11:18 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Jul 17 '12, 11:18 a.m.
It's a little confusing but it is explained in the javadocs. Assettypes are retrieved at the global level. But an asset type may have a community level override. Once you get the RAMAssetType you can get the community override using ramAssetType.getCommunityAssetType(communityInfo). If this returns null then there is no community override. If there is then this returns a CommunityAssetType.

If you don't know what community you are interested in you can use ramAssetType.getCommunityAssetTypes() and this will return an array of all community overrides.

Then from either asset type or community asset type you can get the attributeConstraints() that are applicable to the assettype/community override, if any. From the attribute constraint you can see if it is required, and you can then get the RAMAssetAttribute. This is the description of the attribute definition, which is name, type, URI, values, etc.

The javadocs on each these components is available in the RAM documentation. You would use the javadoc to see what methods are available on each object and what you can get from those methods.

Comments
Kangkan Goswami commented Jul 18 '12, 12:36 a.m.

@RichardKulp: The OP clearly mentions that the issue is with REST API and not the Java API that comes bundled.


permanent link
Kiran Kumar R (77810) | answered Nov 23 '12, 2:45 a.m.

We need to do another get operation on http://serverurl: serverport/ram/internal/attributes/classif/assetTypesSchema.xmi%23AttributeName

The AttributeName can be retrieved from the <ram:configuration> tag from the above xml response from the query in the question.

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.