Hi every one, Thank you Mike, Elmar for your response.
I’m having an exception when doing a post to client/work/rest-ID/distrubution2target with setting a form with the form parameters : leftEndpoint, rightEndpoint, leftCardinality, rightCardinality The exception is <p>Problem accessing /client/work/rest-1/distribution2target. Reason: <pre> Unable to parse repository object!</pre></p><h3>Caused by:</h3><pre>java.io.IOException: Unable to parse repository object! at org.apache.ace.client.rest.RESTClientServlet.getRepositoryValueObject(RESTClientServlet.java:486) at org.apache.ace.client.rest.RESTClientServlet.doPost(RESTClientServlet.java:353) …..Caused by: com.google.gson.JsonParseException: Expecting object found: "leftEndpoint" Also when I do I post to Client/work, I’m getting this with no sessionID : ["artifact", "feature", "distribution", "target", "artifact2feature", "feature2distribution", "distribution2target"] How to get the new Workspace with the sessionID, what I’m missing in my post? Any idea how to fix this error? Thank you again for your response, My Best Regards, Ghania ________________________________ De : Elmar Zeeb <[email protected]> À : [email protected] Envoyé le : vendredi 6 Septembre 2013 3h15 Objet : Re: How to query the distributions/targets with the Client Rest API? Hi Ghania, Am 05.09.2013 19:04, schrieb ghania ferrag: > Hi all, > > I’m working on new web UI ( I used Vaadin for this UI) to allow our users to > send distributions to specific targets. > In our UI we have just to display all existing distributions and I wonder how > to query the distributions with the Client Rest API? > I read the following link: > https://cwiki.apache.org/confluence/display/ACE/Client+REST+API > > > > Some one can tell me what is wrong with this REST-client code (I used Jersey): > 1) I suspect the path is wrong: "ace/workspaceID/distribution" ? > 2) or may be REST-server is not set ? > > import javax.ws.rs.core.UriBuilder; > import com.sun.jersey.api.client.Client; > import com.sun.jersey.api.client.WebResource; > import com.sun.jersey.api.client.config.ClientConfig; > import com.sun.jersey.api.client.config.DefaultClientConfig; > public class ClientTest{ > public static void main(String[] args) { > getDistributions(); > } > > public static void getDistributions() { > ClientConfig config = new DefaultClientConfig(); > Client client = Client.create(config); > WebResource service = client.resource(getBaseURI()); > // Get JSONfor application > >System.out.println(service.path("workspaceID").path("distribution").accept(MediaType.APPLICATION_JSON).get(String.class)); > // Get XML for application > >System.out.println(service.path("workspaceID").path("distribution").accept(MediaType.APPLICATION_XML).get(String.class)); > } > private static URI getBaseURI() { > return UriBuilder.fromUri("http://localhost:8080/ace").build(); > } > > Thanks and Regards, > Ghania You should create a association between a distribution and a target, this is called distribution2target and is a resource that can be created with a post to ace/workspaceID/distribution2target (see http://ace.apache.org/user-doc/restapi.html). Regards, Elmar
