{"id":6367,"date":"2013-01-01T10:25:01","date_gmt":"2013-01-01T08:25:01","guid":{"rendered":"http:\/\/www.javacodegeeks.com\/?p=6367"},"modified":"2013-01-05T12:53:48","modified_gmt":"2013-01-05T10:53:48","slug":"get-post-with-restful-client-api","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html","title":{"rendered":"GET \/ POST with RESTful Client API"},"content":{"rendered":"<p>There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are hurdles, especially for beginners.<br \/>\nIn this post I will try to summarize my know-how, how I did this in real projects. I usually use Jersey (reference implementation for building RESTful services). See e.g. <a href=\"http:\/\/ovaraksin.blogspot.de\/2011\/10\/draw-masked-images-with-java-2d-api-and.html\">my other post<\/a>. In this post, I will call a real remote service from JSF beans. Let&#8217;s write a session scoped bean RestClient.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<pre class=\" brush:java\">package com.cc.metadata.jsf.controller.common;\r\n\r\nimport com.sun.jersey.api.client.Client;\r\nimport com.sun.jersey.api.client.ClientResponse;\r\nimport com.sun.jersey.api.client.WebResource;\r\n\r\nimport java.io.Serializable;\r\nimport javax.annotation.PostConstruct;\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.SessionScoped;\r\nimport javax.faces.context.FacesContext;\r\n\r\n\/**\r\n * This class encapsulates some basic REST client API.\r\n *\/\r\n@ManagedBean\r\n@SessionScoped\r\npublic class RestClient implements Serializable {\r\n\r\n    private transient Client client;\r\n\r\n    public String SERVICE_BASE_URI;\r\n\r\n    @PostConstruct\r\n    protected void initialize() {\r\n        FacesContext fc = FacesContext.getCurrentInstance();\r\n        SERVICE_BASE_URI = fc.getExternalContext().getInitParameter('metadata.serviceBaseURI');\r\n\r\n        client = Client.create();\r\n    }\r\n\r\n    public WebResource getWebResource(String relativeUrl) {\r\n        if (client == null) {\r\n            initialize();\r\n        }\r\n\r\n        return client.resource(SERVICE_BASE_URI + relativeUrl);\r\n    }\r\n\r\n    public ClientResponse clientGetResponse(String relativeUrl) {\r\n        WebResource webResource = client.resource(SERVICE_BASE_URI + relativeUrl);\r\n        return webResource.accept('application\/json').get(ClientResponse.class);\r\n    }\r\n}<\/pre>\n<p>In this class we got the service base URI which is specified (configured) in the web.xml.<\/p>\n<pre class=\" brush:xml\">&lt;context-param&gt;\r\n   &lt;param-name&gt;metadata.serviceBaseURI&lt;\/param-name&gt;\r\n   &lt;param-value&gt;http:\/\/somehost\/metadata\/&lt;\/param-value&gt;\r\n&lt;\/context-param&gt;<\/pre>\n<p>Furthermore, we wrote two methods to receive remote resources. We intend to receive resources in JSON format and convert them to Java objects. The next bean demonstrates how to do this task for GET requests. The bean HistoryBean converts received JSON to a Document object by using GsonConverter. The last two classes will not be shown here (they don&#8217;t matter). Document is a simple POJO and GsonConverter is a singleton instance which wraps <a href=\"http:\/\/code.google.com\/p\/google-gson\/\">Gson<\/a>.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\" brush:java\">package com.cc.metadata.jsf.controller.history;\r\n\r\nimport com.cc.metadata.jsf.controller.common.RestClient;\r\nimport com.cc.metadata.jsf.util.GsonConverter;\r\nimport com.cc.metadata.model.Document;\r\n\r\nimport com.sun.jersey.api.client.ClientResponse;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\nimport javax.annotation.PostConstruct;\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.ManagedProperty;\r\nimport javax.faces.bean.ViewScoped;\r\n\r\n\/**\r\n * Bean getting history of the last extracted documents.\r\n *\/\r\n@ManagedBean\r\n@ViewScoped\r\npublic class HistoryBean implements Serializable {\r\n\r\n    @ManagedProperty(value = '#{restClient}')\r\n    private RestClient restClient;\r\n\r\n    private List&lt;Document&gt; documents;\r\n    private String jsonHistory;\r\n\r\n    public List&lt;Document&gt; getDocuments() {\r\n        if (documents != null) {\r\n            return documents;\r\n        }\r\n\r\n        ClientResponse response = restClient.clientGetResponse('history');\r\n\r\n        if (response.getStatus() != 200) {\r\n            throw new RuntimeException('Failed service call: HTTP error code : ' + response.getStatus());\r\n        }\r\n\r\n        \/\/ get history as JSON\r\n        jsonHistory = response.getEntity(String.class);\r\n\r\n        \/\/ convert to Java array \/ list of Document instances\r\n        Document[] docs = GsonConverter.getGson().fromJson(jsonHistory, Document[].class);\r\n        documents = Arrays.asList(docs);\r\n\r\n        return documents;\r\n    }\r\n\r\n    \/\/ getter \/ setter\r\n ...\r\n}<\/pre>\n<p>The next bean demonstrates how to communicate with the remote service via POST. We intent to send the content of uploaded file. I use the <a href=\"http:\/\/primefaces.org\/\">PrimeFaces&#8217;<\/a> FileUpload component, so that the content can be extracted as InputStream from the listener&#8217;s parameter FileUploadEvent. This is not important here, you can also use any other web frameworks to get the file content (also as byte array). More important is to see how to deal with RESTful Client classes FormDataMultiPart and FormDataBodyPart.<\/p>\n<pre class=\" brush:java\">package com.cc.metadata.jsf.controller.extract;\r\n\r\nimport com.cc.metadata.jsf.controller.common.RestClient;\r\nimport com.cc.metadata.jsf.util.GsonConverter;\r\nimport com.cc.metadata.model.Document;\r\n\r\nimport com.sun.jersey.api.client.ClientResponse;\r\nimport com.sun.jersey.api.client.WebResource;\r\nimport com.sun.jersey.core.header.FormDataContentDisposition;\r\nimport com.sun.jersey.multipart.FormDataBodyPart;\r\nimport com.sun.jersey.multipart.FormDataMultiPart;\r\n\r\nimport org.primefaces.event.FileUploadEvent;\r\n\r\nimport java.io.IOException;\r\nimport java.io.Serializable;\r\nimport javax.faces.application.FacesMessage;\r\nimport javax.faces.bean.ManagedBean;\r\nimport javax.faces.bean.ManagedProperty;\r\nimport javax.faces.bean.ViewScoped;\r\nimport javax.faces.context.FacesContext;\r\n\r\nimport javax.ws.rs.core.MediaType;\r\n\r\n\/**\r\n * Bean for extracting document properties (metadata).\r\n *\/\r\n@ManagedBean\r\n@ViewScoped\r\npublic class ExtractBean implements Serializable {\r\n\r\n    @ManagedProperty(value = '#{restClient}')\r\n    private RestClient restClient;\r\n\r\n    private String path;\r\n\r\n    public void handleFileUpload(FileUploadEvent event) throws IOException {\r\n        String fileName = event.getFile().getFileName();\r\n\r\n        FormDataMultiPart fdmp = new FormDataMultiPart();\r\n        FormDataBodyPart fdbp = new FormDataBodyPart(FormDataContentDisposition.name('file').fileName(fileName).build(),\r\n                event.getFile().getInputstream(), MediaType.APPLICATION_OCTET_STREAM_TYPE);\r\n        fdmp.bodyPart(fdbp);\r\n\r\n        WebResource resource = restClient.getWebResource('extract');\r\n        ClientResponse response = resource.accept('application\/json').type(MediaType.MULTIPART_FORM_DATA).post(\r\n                ClientResponse.class, fdmp);\r\n\r\n        if (response.getStatus() != 200) {\r\n            throw new RuntimeException('Failed service call: HTTP error code : ' + response.getStatus());\r\n        }\r\n\r\n        \/\/ get extracted document as JSON\r\n        String jsonExtract = response.getEntity(String.class);\r\n\r\n        \/\/ convert to Document instance\r\n        Document doc = GsonConverter.getGson().fromJson(jsonExtract, Document.class);\r\n\r\n        ...\r\n    }\r\n\r\n    \/\/ getter \/ setter\r\n ...\r\n}<\/pre>\n<p>Last but not least, I would like to demonstrate how to send a GET request with any query string (URL parameters). The next method asks the remote service by URL which looks as http:\/\/somehost\/metadata\/extract?file=&lt;some file path&gt;<\/p>\n<pre class=\" brush:java\">public void extractFile() {\r\n WebResource resource = restClient.getWebResource('extract');\r\n ClientResponse response = resource.queryParam('file', path).accept('application\/json').get(\r\n   ClientResponse.class);\r\n\r\n if (response.getStatus() != 200) {\r\n  throw new RuntimeException('Failed service call: HTTP error code : ' + response.getStatus());\r\n }\r\n\r\n \/\/ get extracted document as JSON\r\n String jsonExtract = response.getEntity(String.class);\r\n\r\n \/\/ convert to Document instance\r\n Document doc = GsonConverter.getGson().fromJson(jsonExtract, Document.class);\r\n\r\n ...\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p><strong><em>Reference: <\/em><\/strong><a href=\"http:\/\/ovaraksin.blogspot.com\/2012\/12\/get-post-with-restful-client-api.html\">GET \/ POST with RESTful Client API<\/a> from our <a href=\"http:\/\/www.javacodegeeks.com\/p\/jcg.html\">JCG partner<\/a> Oleg Varaksin at the <a href=\"http:\/\/ovaraksin.blogspot.com\/\">Thoughts on software development<\/a> blog.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are hurdles, especially for beginners. In this post I will try to summarize my know-how, how I did this in real projects. I usually use Jersey (reference implementation &hellip;<\/p>\n","protected":false},"author":200,"featured_media":174,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[293,453,54],"class_list":["post-6367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-jsf","tag-primefaces","tag-restful-web-services"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>GET \/ POST with RESTful Client API<\/title>\n<meta name=\"description\" content=\"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GET \/ POST with RESTful Client API\" \/>\n<meta property=\"og:description\" content=\"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2013-01-01T08:25:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-01-05T10:53:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Oleg Varaksin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleg Varaksin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html\"},\"author\":{\"name\":\"Oleg Varaksin\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/ac096549ff51a73f2e15f128920ed7e0\"},\"headline\":\"GET \\\/ POST with RESTful Client API\",\"datePublished\":\"2013-01-01T08:25:01+00:00\",\"dateModified\":\"2013-01-05T10:53:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html\"},\"wordCount\":332,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"keywords\":[\"JSF\",\"PrimeFaces\",\"RESTful Web Services\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html\",\"name\":\"GET \\\/ POST with RESTful Client API\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"datePublished\":\"2013-01-01T08:25:01+00:00\",\"dateModified\":\"2013-01-05T10:53:48+00:00\",\"description\":\"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/jsf-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2013\\\/01\\\/get-post-with-restful-client-api.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"GET \\\/ POST with RESTful Client API\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/ac096549ff51a73f2e15f128920ed7e0\",\"name\":\"Oleg Varaksin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g\",\"caption\":\"Oleg Varaksin\"},\"sameAs\":[\"http:\\\/\\\/ovaraksin.blogspot.com\\\/\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/Oleg-Varaksin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GET \/ POST with RESTful Client API","description":"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html","og_locale":"en_US","og_type":"article","og_title":"GET \/ POST with RESTful Client API","og_description":"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are","og_url":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2013-01-01T08:25:01+00:00","article_modified_time":"2013-01-05T10:53:48+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","type":"image\/jpeg"}],"author":"Oleg Varaksin","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Oleg Varaksin","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html"},"author":{"name":"Oleg Varaksin","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/ac096549ff51a73f2e15f128920ed7e0"},"headline":"GET \/ POST with RESTful Client API","datePublished":"2013-01-01T08:25:01+00:00","dateModified":"2013-01-05T10:53:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html"},"wordCount":332,"commentCount":1,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","keywords":["JSF","PrimeFaces","RESTful Web Services"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html","url":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html","name":"GET \/ POST with RESTful Client API","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","datePublished":"2013-01-01T08:25:01+00:00","dateModified":"2013-01-05T10:53:48+00:00","description":"There are many stuff in the internet how to work with RESTful Client API. These are basics. But even though the subject seems to be trivial, there are","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/jsf-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2013\/01\/get-post-with-restful-client-api.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"GET \/ POST with RESTful Client API"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/ac096549ff51a73f2e15f128920ed7e0","name":"Oleg Varaksin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/fda1ce47105421f7a352a13dbefec14ab59d59ffae99c6c3002e5841578979d3?s=96&d=mm&r=g","caption":"Oleg Varaksin"},"sameAs":["http:\/\/ovaraksin.blogspot.com\/"],"url":"https:\/\/www.javacodegeeks.com\/author\/Oleg-Varaksin"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/200"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=6367"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/6367\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/174"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=6367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=6367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=6367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}