Hi,

I need to do $subject while implementing Enterprise-Store REST-API. The
exact endpoint is like "../apis/assets/<:id>" which will be used to
retrieve the asset of <:id>.

Currently, I use "*GenericArtifactManager.getGenericArtifact(String
artifactId)*" method to retrieve the asset from registry. In order to
create a *GenericArtifactManager* instance we have to provide the ' 'type'.
Therefore I have to pass 'type' as an URL parameter.
*(ex:
https://localhost:9443/publisher/apis/assets/1dfaac50-a96a-42dc-8f4b-1720bd3d6434?type=site
<https://localhost:9443/publisher/apis/assets/1dfaac50-a96a-42dc-8f4b-1720bd3d6434?type=site>)*

I don't think that passing 'type' as an URL parameter in this kind of
endpoint is acceptable, since the concept of having an 'id' is that we
should be able to refer that resource by 'id' itself. (this might be
confusing in the way registry handles assets).

The other way we can implement "../apis/assets/<:id>" endpoint is as
follows.[01]

   - use "GovernanceUtils.retrieveGovernanceArtifactById" which includes
   following two steps.
   - get 'path' to asset by id (GovernanceUtils.getArtifactPath)
   - retrieve asset using path
   (GovernanceUtils.retrieveGovernanceArtifactByPath)

What would be the best approach. Is there any other way of providing this
such as using indexes etc.
[01]
https://github.com/wso2-dev/carbon-governance/blob/master/components/governance/org.wso2.carbon.governance.api/src/main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java

-- 
*Ayesha Dissanayaka*
Software Engineer,
WSO2, Inc : http://wso2.com
<http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
20, Palmgrove Avenue, Colombo 3
E-Mail: [email protected] <[email protected]>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to