Inflectra Customer Forums: Accessing Spira test using rest web services in java (Thread)Hi All, I am new to Spira test and its API. Can anyone help me with a sample java code which authenticates and does request and response using the Spira API. Also I am trying to do a maven repository set up, please provide me dependency if any. Thanks, Manoj en-US(C) Copyright 2006-2024 Inflectra Corporation.support@inflectra.com/Computers/Software/Project_Management//Computers/Software/Quality_Assurance/KronoDesksupport@inflectra.comhttp://www.inflectra.com/kronodesk/forums/threads120/Support/Forum/spirateam/issues-questions/1620.aspxthreadId=1620Manoj Singh (manoj.singh7@tcs.com)java rest web services Spira APIAccessing Spira test using rest web services in javaHi All, I am new to Spira test and its API. Can anyone help me with a sample java code which authenticates and does request and response using the Spira API. Also I am trying to do a maven repository set up, please provide me dependency if any. Thanks, Manoj Thu, 16 Feb 2017 06:54:32 -05002017-02-20T10:40:51-05:00/Support/Forum/spirateam/issues-questions/1620.aspxmessageId=2915David J (support1@inflectra.com) Hi Manoj Please try this out: https://www.inflectra.com/Support/KnowledgeBase/KB49.aspx Regard Hi Manoj Please try this out: https://www.inflectra.com/Support/KnowledgeBase/KB49.aspx Regards Adam Fri, 17 Feb 2017 17:32:27 -05002017-02-17T17:32:27-05:00/Support/Forum/spirateam/issues-questions/1620.aspx#reply2915messageId=2917Manoj Singh (manoj.singh7@tcs.com) Hi Adam, I am going through this example. But this example uses SOAP services. However i am lookin Hi Adam, I am going through this example. But this example uses SOAP services. However i am looking for rest api which i am able to connect through java code. public final String BASE_URL = http://api.inflectra.com/Spira/Services/v4_0/RestService.svc public final String USER_NAME = public final String API_KEY= public static void main( String[] args ) { try { ClientConfig clientConfig = new DefaultClientConfig(); Client client = Client.create(clientConfig); WebResource resource = client.resource(BASE_URL); // resource.header(username, USER_NAME); // resource.header(api-key, API_KEY); resource.queryParam(username, USER_NAME); resource.queryParam(api-key, API_KEY); ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); System.out.println(response.getStatus()); } catch (Exception e) { e.printStackTrace(); } this is my sample code for connecting spira rest url. i am getting exception as fallows com.sun.jersey.api.client.ClientHandlerException: java.net.UnknownHostException: api.inflectra.com at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155) at com.sun.jersey.api.client.Client.handle(Client.java:652) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509) at com.iDRT.controller.SpiraConnection.main(SpiraConnection.java:34) Caused by: java.net.UnknownHostException: api.inflectra.com at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at sun.net.NetworkClient.doConnect(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient.openServer(Unknown Source) at sun.net.www.http.HttpClient. (Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.http.HttpClient.New(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:253) at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153) ... 5 more Mon, 20 Feb 2017 10:40:50 -05002017-02-20T10:40:50-05:00/Support/Forum/spirateam/issues-questions/1620.aspx#reply2917