{"id":96260,"date":"2020-10-26T11:00:00","date_gmt":"2020-10-26T09:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=96260"},"modified":"2022-07-07T15:20:19","modified_gmt":"2022-07-07T12:20:19","slug":"java-api-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/","title":{"rendered":"Java API Tutorial"},"content":{"rendered":"<p>In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We will also see an example of a REST API.<\/p>\n<p>You can also check this tutorial in the following video:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><a href=\"https:\/\/www.youtube.com\/watch?v=LF2UqR7B6NI\"><img decoding=\"async\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Java-Web-Services-Tutorial-1024x576.jpg\" alt=\"\" class=\"wp-image-113845\" width=\"512\" height=\"288\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Java-Web-Services-Tutorial-1024x576.jpg 1024w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Java-Web-Services-Tutorial-300x169.jpg 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Java-Web-Services-Tutorial-768x432.jpg 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/07\/Java-Web-Services-Tutorial.jpg 1280w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/a><figcaption>Java Web Services Tutorial &#8211; video<\/figcaption><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-1-java-api\">1. Java API<\/h2>\n<p>An API stands for Application Programming Interface, and it is an interface that allows communication between different applications using the packages it comprises. Java API comprises a collection of interfaces, classes, and packages. It helps us to use the packaged classes and interfaces to build our applications and supports reusability. Whenever we write any program in java, we use the Java API to do so. For example, we use JDBC API in java to connect to any database server to perform several transactions using java.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-2-how-to-use-an-api-with-java\">2. How to use an API with Java<\/h2>\n<p>In Java, we use API to access other software applications and build java API&#8217;s to allow other systems to access our resources. In other words, we can either create a client for an existing API or an API service to be used by others.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-1-as-a-client-as-an-api-consumer\">2.1 As a Client(as an API consumer)<\/h3>\n<p>If we want to access an API, we build a java API client for accessing the API based on the rules and controls provided by the API developer. We can access resources that we want from another system using the API exposed\/provided by the other system.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-2-2-as-an-api-provider\">2.2 As an API provider<\/h3>\n<p>We create an API so that the other system can access our resources via the API exposed\/provided by us. To access our API, they have to follow the standards and rules set up and build an API client.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-types-of-api-requests\">3. Types of API Requests<\/h2>\n<p>There are various kinds of API request based on the operation need to be performed. The most commonly used APIs requests are <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-1-get\">3.1 GET<\/h3>\n<p>GET is the most commonly used request and is used to get any resource from the server using an API. When a user requests an API using GET, the server returns the user&#8217;s data if it is available on the server.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-2-post\">3.2 POST <\/h3>\n<p>This request type adds or posts any new data to the server. When a user requests an API using POST, the server adds the data into its resource and returns the status of whether the posting was a success or a failure.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-3-put\">3.3 PUT<\/h3>\n<p>This request type updates\/modifies the data on the server. When a user requests an API using PUT, then the server updates the data into its resource and returns the status whether the update was a success or a failure.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-4-delete\">3.4 DELETE<\/h3>\n<p>This request type deletes the data from the server. When a user requests an API using DELETE, then the server removes the data from the resource and returns the status of whether the delete was successful or a failure.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-what-does-rest-mean\">4. What does REST mean<\/h2>\n<p>REST stands for Representational State Transfer, and it&#8217;s an architectural pattern that defines a set of rules for developing web-services. And the web services built using these constraints are called Restful web service.<br \/>Rest APIs deal with client-server architecture and are stateless, meaning the server doesn&#8217;t store states, and each request is separate and independent.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-5-simple-api-in-java\">5. Simple API in java<\/h2>\n<p>We can create a REST API in java using several ways. And one of the most common way to create the java REST API is using Jersey. Follow the steps below to create the simple REST API<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-1-creating-the-web-project-with-maven\">5.1 Creating the web project with maven<\/h3>\n<p>The first step for creating any application is to have a project. You can do that using any IDE(Integrated Development Tool). I will show the sample using the IntelliJ Idea IDE. You can choose any other as well like one of the alternatives is Eclipse IDE. After creating the maven project, please add the below code into your pom.xml file to get the required dependencies.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Maven dependencies in pom.xml file<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"\n  xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/maven-v4_0_0.xsd\"&gt;\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\n\n  &lt;groupId&gt;demo.jcg.restapi&lt;\/groupId&gt;\n  &lt;artifactId&gt;demoRestAPI&lt;\/artifactId&gt;\n  &lt;packaging&gt;war&lt;\/packaging&gt;\n  &lt;version&gt;1.0-SNAPSHOT&lt;\/version&gt;\n  &lt;name&gt;demoRestAPI&lt;\/name&gt;\n\n  &lt;url&gt;http:\/\/maven.apache.org&lt;\/url&gt;\n  &lt;repositories&gt;\n\t\t&lt;repository&gt;\n\t\t\t&lt;id&gt;maven2-repository.java.net&lt;\/id&gt;\n\t\t\t&lt;name&gt;Java.net Repository for Maven&lt;\/name&gt;\n\t\t\t&lt;url&gt;http:\/\/download.java.net\/maven\/2\/&lt;\/url&gt;\n\t\t\t&lt;layout&gt;default&lt;\/layout&gt;\n\t\t&lt;\/repository&gt;\n\t&lt;\/repositories&gt;\n  &lt;dependencies&gt;\n    &lt;dependency&gt;\n\t\t&lt;groupId&gt;com.sun.jersey&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;jersey-server&lt;\/artifactId&gt;\n\t\t&lt;version&gt;1.19.4&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;com.sun.jersey&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;jersey-core&lt;\/artifactId&gt;\n\t\t&lt;version&gt;1.19.4&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n\t&lt;dependency&gt;\n\t\t&lt;groupId&gt;com.sun.jersey&lt;\/groupId&gt;\n\t\t&lt;artifactId&gt;jersey-servlet&lt;\/artifactId&gt;\n\t\t&lt;version&gt;1.19.4&lt;\/version&gt;\n\t&lt;\/dependency&gt;\n  &lt;\/dependencies&gt;\n  \n  &lt;build&gt;\n    &lt;finalName&gt;demoRestAPI&lt;\/finalName&gt;\n\t    &lt;plugins&gt;\n\t\t    &lt;plugin&gt;\n\t\t      &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n\t\t        &lt;configuration&gt;\n\t\t          &lt;source&gt;1.8&lt;\/source&gt;\n\t\t          &lt;target&gt;1.8&lt;\/target&gt;\n\t\t        &lt;\/configuration&gt;\n\t\t    &lt;\/plugin&gt;\n\t  &lt;\/plugins&gt;\n  &lt;\/build&gt;\n&lt;\/project&gt;\n\n<\/pre>\n<p>With the above configuration, your project will have all the dependencies to create a REST API. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-2-creating-the-java-rest-service-class\">5.2 Creating the java rest service class<\/h3>\n<p>After having all the dependencies setup, we need to create the rest service class where we will write our API. Have a look into the code below<\/p>\n<p><span style=\"text-decoration: underline\"><em>Rest service class<\/em><\/span><\/p>\n<pre class=\"brush:java\">package demo.jcg.restapi;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\n\n@Path(\"\/demo\")\npublic class RestAPIDemo\n{\n\t@GET\n\t@Path(\"\/{name}\")\n\tpublic String greetings(@PathParam(\"name\") String name)\n\t{\n\t\treturn  name.toUpperCase()+ \", from Java Code Geeks\";\n\t}\n}\n\n<\/pre>\n<p>Now let&#8217;s understand the class above, here the class RestAPIDemo is has used certain annotations which are<\/p>\n<p>@Path: This annotation makes your API&#8217;s path into the server resource, i.e. specifies the URI using which this API can be accessed.<\/p>\n<p>@GET:  This annotation specifies the type of request that can be made to this method. As discussed above GET is used to get some resource from the REST API<\/p>\n<p>@PathParam: This annotation tells that the URI path contains a parameter that needs to be passed when accessing this API resource.<\/p>\n<p>In the above program, we are exposing a GET method through our REST API, where the user will access the API by passing the name in the path param. They get the name appended with the greeting. For example &#8220;Shankar, from Java Code Geeks&#8221;. All the annotations are coming from the Jersey API library used.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-3-configuring-the-web-xml\">5.3 Configuring the web.xml<\/h3>\n<p>Now the final step before we can deploy our REST API, we need to do the configuration for our web.xml as shown below<\/p>\n<p><span style=\"text-decoration: underline\"><em>Configuration for web.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&lt;!DOCTYPE web-app PUBLIC\n \"-\/\/Sun Microsystems, Inc.\/\/DTD Web Application 2.3\/\/EN\"\n \"http:\/\/java.sun.com\/dtd\/web-app_2_3.dtd\" &gt;\n\n&lt;web-app&gt;\n\n  &lt;display-name&gt;Archetype Created Web Application&lt;\/display-name&gt;\n  \n  &lt;servlet&gt;\n\t\t&lt;servlet-name&gt;jersey-serlvet&lt;\/servlet-name&gt;\n\t\t&lt;servlet-class&gt;com.sun.jersey.spi.container.servlet.ServletContainer&lt;\/servlet-class&gt;\n\t\t&lt;init-param&gt;\n\t\t     &lt;param-name&gt;com.sun.jersey.config.property.packages&lt;\/param-name&gt;\n\t\t     &lt;param-value&gt;demo.jcg.restapi&lt;\/param-value&gt;\n\t\t&lt;\/init-param&gt;\n\t\t&lt;load-on-startup&gt;1&lt;\/load-on-startup&gt;\n\t&lt;\/servlet&gt;\n \n\t&lt;servlet-mapping&gt;\n\t\t&lt;servlet-name&gt;jersey-serlvet&lt;\/servlet-name&gt;\n\t\t&lt;url-pattern&gt;\/*&lt;\/url-pattern&gt;\n\t&lt;\/servlet-mapping&gt;\n\t\n&lt;\/web-app&gt;\n\n<\/pre>\n<p>In the above web.xml file, we have to make sure that our servlet is added as Jersey&#8217;s servlet container within the servlet-class tags.<\/p>\n<div class=\"wp-block-syntaxhighlighter-code \">\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ncom.sun.jersey.spi.container.servlet.ServletContainer\n<\/pre>\n<\/div>\n<h3 class=\"wp-block-heading\" id=\"h-5-4-deploying-our-application\">5.4 Deploying our application<\/h3>\n<p>The final step to make our REST API running is to deploy the application into a server to serve the request made to this API.<\/p>\n<p>Adding a server in an IDE is very simple. For the above example, we use Apache Tomcat and then deploy the rest API into the server.<\/p>\n<p>Note: If you cannot add the server into the IDE due to some issues. We can directly place our war(Web-Archive) file inside the web apps folder of your tomcat server home directory. The war file is inside the target directory of our project.<\/p>\n<p>You can download the tomcat server <a href=\"https:\/\/tomcat.apache.org\/\">here<\/a><\/p>\n<p>Check the final project structure of the project structure below<\/p>\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"820\" height=\"820\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure.png\" alt=\"\" class=\"wp-image-96532\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure.png 820w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure-300x300.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure-150x150.png 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure-768x768.png 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/ProjectStructure-70x70.png 70w\" sizes=\"(max-width: 820px) 100vw, 820px\" \/><figcaption>Project structure of the REST API<\/figcaption><\/figure>\n<h3 class=\"wp-block-heading\" id=\"h-5-5-testing-your-application\">5.5 Testing your application<\/h3>\n<p>Once deployed, we can test our REST API in any browser using the URL http:\/\/localhost:8080\/demo\/Shankar. As we saw in the rest service class, the path &#8220;demo&#8221; is part of the REST API URL. The output is<\/p>\n<figure class=\"wp-block-image size-large is-resized is-style-default\"><img decoding=\"async\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output.png\" alt=\"\" class=\"wp-image-96534\" width=\"361\" height=\"361\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output.png 800w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output-300x300.png 300w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output-150x150.png 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output-768x768.png 768w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/Output-70x70.png 70w\" sizes=\"(max-width: 361px) 100vw, 361px\" \/><figcaption>Output of the rest call<\/figcaption><\/figure>\n<h2 class=\"wp-block-heading\" id=\"h-6-summary\">6. Summary<\/h2>\n<p>In this article, we saw what Java API is, how we can use APIs with Java. We looked at the different types of API requests and discussed the REST API. We also created a sample REST API and tested it.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-more-articles\">7. More articles<\/h2>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/java-tutorial-for-beginners\/\">Java Tutorial for Beginners<\/a><\/li>\n<li><a href=\"https:\/\/www.javacodegeeks.com\/java-interview-questions.html\">150 Java Interview Questions and Answers<\/a><\/li>\n<li><a href=\"https:\/\/www.javacodegeeks.com\/learn-java-programming-online.html\">Best Way to Learn Java Programming Online<\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/download-and-install-java-development-kit-jdk-13\/\">Download and Install Java Development Kit (JDK) 13<\/a><\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-8-download-the-source-code\">8. Download the source code<\/h2>\n<p>This was the REST API example using java.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/demoRestAPI.zip\"><strong>Java API Tutorial<\/strong><\/a><\/div>\n<p><strong>Last updated on Apr. 28th, 2021<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We will also see an example of a REST API. You can also check this tutorial in the following video: Java Web Services Tutorial &#8211; video 1. &hellip;<\/p>\n","protected":false},"author":236,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-96260","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java API Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java API Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-26T09:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-07T12:20:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-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=\"Shankar Mata\" \/>\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=\"Shankar Mata\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\"},\"author\":{\"name\":\"Shankar Mata\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6ccfe029dad934ef487efab0cfa6ab41\"},\"headline\":\"Java API Tutorial\",\"datePublished\":\"2020-10-26T09:00:00+00:00\",\"dateModified\":\"2022-07-07T12:20:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\"},\"wordCount\":1189,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\",\"name\":\"Java API Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2020-10-26T09:00:00+00:00\",\"dateModified\":\"2022-07-07T12:20:19+00:00\",\"description\":\"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java API Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6ccfe029dad934ef487efab0cfa6ab41\",\"name\":\"Shankar Mata\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/shankar.mata_-96x96.jpeg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/shankar.mata_-96x96.jpeg\",\"caption\":\"Shankar Mata\"},\"description\":\"Shankar works as a Lead Software Engineer in a leading company and has developed several applications. He is one of the decision makers for the design and architecture for all the applications in his team. He along with his team develop and deploy cloud native services. He had been working in the field of Java and cloud technologies. He is also Amazon and Microsoft certified solution architect for AWS and Azure respectively. He has done his Masters in Computer science from University of New Mexico, US and Bachelors from GITAM University India. He is also experienced in Angular Framework and developed several applications.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/mshankarrao\/\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/shankar-mata\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java API Tutorial - Java Code Geeks","description":"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We","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:\/\/examples.javacodegeeks.com\/java-api-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Java API Tutorial - Java Code Geeks","og_description":"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We","og_url":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-10-26T09:00:00+00:00","article_modified_time":"2022-07-07T12:20:19+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Shankar Mata","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Shankar Mata","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/"},"author":{"name":"Shankar Mata","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6ccfe029dad934ef487efab0cfa6ab41"},"headline":"Java API Tutorial","datePublished":"2020-10-26T09:00:00+00:00","dateModified":"2022-07-07T12:20:19+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/"},"wordCount":1189,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/","name":"Java API Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2020-10-26T09:00:00+00:00","dateModified":"2022-07-07T12:20:19+00:00","description":"In this article, we will learn about Java API and working with Java API. We will discuss different types of API requests and what does REST API mean. We","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-api-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"Java API Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/6ccfe029dad934ef487efab0cfa6ab41","name":"Shankar Mata","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/shankar.mata_-96x96.jpeg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/08\/shankar.mata_-96x96.jpeg","caption":"Shankar Mata"},"description":"Shankar works as a Lead Software Engineer in a leading company and has developed several applications. He is one of the decision makers for the design and architecture for all the applications in his team. He along with his team develop and deploy cloud native services. He had been working in the field of Java and cloud technologies. He is also Amazon and Microsoft certified solution architect for AWS and Azure respectively. He has done his Masters in Computer science from University of New Mexico, US and Bachelors from GITAM University India. He is also experienced in Angular Framework and developed several applications.","sameAs":["https:\/\/www.linkedin.com\/in\/mshankarrao\/"],"url":"https:\/\/examples.javacodegeeks.com\/author\/shankar-mata\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/96260","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/236"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=96260"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/96260\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=96260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=96260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=96260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}