{"id":46752,"date":"2023-04-19T00:00:00","date_gmt":"2023-04-19T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/"},"modified":"2025-11-13T12:56:30","modified_gmt":"2025-11-13T20:56:30","slug":"create-a-java-web-api-using-griddb-and-spring-boot","status":"publish","type":"post","link":"https:\/\/griddb.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/","title":{"rendered":"Create a Java Web API using GridDB and Spring Boot"},"content":{"rendered":"<p>Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the distinction of being its sole native connector. And because it is the native connector, we have decided we would write an article on how to write a CRUD API using Java&#8217;s <a href=\"https:\/\/spring.io\/\">Spring Boot<\/a>.<\/p>\n<p>With the Spring Boot library, we can easily spin up a server which will accept <a href=\"https:\/\/restfulapi.net\/\">REST Interface<\/a> commands to accomplish our tasks. So in this article, we will be writing some Java code which allows for a user to Create, Read, Update, and Delete from their GridDB database.<\/p>\n<p>There are many benefits to accessing our database through a RESTful buffer, but the biggest benefit comes in the form of security. As you probably can imagine, allowing users to directly interact with a production database is always a risk; we want to limit what sorts of information and access users can have with our data, especially if we are housing user&#8217;s private information.<\/p>\n<p>Creating a RESTful API with Spring Boot helps to limit our exposure and allows for us to only allow users to read, write, update, and delete exactly what we want them to. The way it works is that we create functions with Java which have pre-set query statements which can take in one or two user-generated parameters to interact with the database. By only allowing users to change one or two parameters, we can directly block them from accessing GridDB containers which they can contain sensitive information.<\/p>\n<p>The basic premise of using an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Web_API\">API endpoints<\/a> to interact with the database is as follows: when a user makes an <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\">HTTP Request<\/a>, depending on the method used (GET, POST, PUT, DELETE, etc), will call a different Java function which will accomplish the task.<\/p>\n<p>So, in this article, we will go over the source code included with this project which creates API endpoints which allow for a user to interact with GridDB through a safe buffer. The source code will also show you to write Java code which can accomplish fundamental GridDB tasks in an efficient way.<\/p>\n<h2>Prequisites and Following Along<\/h2>\n<p>If you would like to follow along with this blog, you can clone the publically available GitHub repo here:<\/p>\n<p>You will also need some of the prereqs:<\/p>\n<ol>\n<li><a href=\"https:\/\/docs.griddb.net\/gettingstarted\/using-apt\/\">GridDB Installed and Running<\/a><\/li>\n<li><a href=\"https:\/\/maven.apache.org\/install.html\">Maven<\/a><\/li>\n<\/ol>\n<p>And then you can run the project using the following command <code>$ mvn spring-boot:run<\/code>. If everything goes well, your terminal will have an instance of Spring Boot running in the foreground and can be located at your server&#8217;s ip address on port 8081 &#8212; for example: http:\/\/localhost:8081.<\/p>\n<h2>Device Class<\/h2>\n<p>Before we dive into the all-important GridDB Class, we will first start with the Device Class.<\/p>\n<p>This class is responsible for housing the schema for the data used in this article, as well as some other helper methods<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">class Device {\n\n    @RowKey String id;\n    Double lat;\n    Double lon;<\/code><\/pre>\n<\/div>\n<p>And indeed, when writing GridDB Java applications, we set the schema for our container by creating a class and placing the schema inside.<\/p>\n<h2>The GridDB Class<\/h2>\n<p>Before getting into the actual server endpoints, we will need to discuss the source code for the GridDB Class. The GridDB Class is responsible for all of the basic functionality &#8212; when an endpoint is called, it simply calls for a GridDB class method to be run.<\/p>\n<p>To start, the GridDB Class will connect to your instance of GridDB running, whether it be locally running or somewhere else.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">public GridDB() {\n        try {\n        Properties props = new Properties();\n        props.setProperty(\"notificationMember\", \"127.0.0.1:10001\");\n        props.setProperty(\"clusterName\", \"myCluster\");\n        props.setProperty(\"user\", \"admin\"); \n        props.setProperty(\"password\", \"admin\");\n        store = GridStoreFactory.getInstance().getGridStore(props);\n        devCol = store.putCollection(\"sbDEVICES\", Device.class);\n        } catch (Exception e) {\n            System.out.println(\"Could not get Gridstore instance, exitting.\");\n            System.exit(-1);\n        }\n    }<\/code><\/pre>\n<\/div>\n<p>As explained before, our class here is called <code>GridDB<\/code>, and in this case, our default contructor houses our host machine&#8217;s GridDB server to which we would like to connect. So this means, when you instantiate a new instance of the GridDB Class, your object should already be able to communicate with your running GridDB database.<\/p>\n<p>We also create a new container (if not yet exists) called <code>sbDEVICES<\/code> which will house our data for this article with a schema provided by the <code>Device.class<\/code><\/p>\n<p>With that out of the way, next up are the functions responsible for our basic CRUD commands.<\/p>\n<h2>Device Controller<\/h2>\n<p>On top of the two previous classes, with Spring Boot, we need to also create a Device Controller class which will house the endpoints we intend to use with our project. In this file, we will set the specific endpoint, the method, and finally what the code should do.<\/p>\n<p>So, for example, the default constructor of our controller will create an instance of our GridDB class:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@RestController\npublic class DeviceController {\n\n    GridDB gridDb;\n\n    public DeviceController() {\n        super();\n        gridDb = new GridDB();\n    }<\/code><\/pre>\n<\/div>\n<p>From this point, we simply create functions and associate them with certain endpoints and HTTP Methods, which will then call our GridDB class&#8217;s methods to accomplish what we need.<\/p>\n<h2>Creating And Calling API Endpoints<\/h2>\n<p>Now that we know a bit more about how these endpoints will be called, let&#8217;s actually try running our server and creating some rows, reading from our database, and then finally deleting some rows.<\/p>\n<p>Because we do not have a working frontend with this project, we can play around with our API with <a href=\"https:\/\/www.postman.com\/\">Postman<\/a> or simply through a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Command-line_interface\">CLI<\/a> and curl commands.<\/p>\n<h3>POST Method<\/h3>\n<p>To begin, we will need to create some rows of data into our database. This of course means we will need to use a POST request to send an object data to our server.<\/p>\n<p>First, we will look at actually putting rows of data into our database using this <code>putDevice<\/code> java function<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">public void putDevice(Device dev) {\n\n        try {   \n            System.out.println(\"dev=\"+dev);\n            devCol.setAutoCommit(false);\n            devCol.put(dev);\n            devCol.commit();\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n\n    }<\/code><\/pre>\n<\/div>\n<p>Here we are simply using the Java API to <code>.put<\/code> the user-generated data found in the HTTP request&#8217;s body directly into our GridDB server. The function expects a device as the parameter, meaning the <code>POST<\/code> request should have a device object (id, lat, lon) in the body.<\/p>\n<h3>POST Request<\/h3>\n<p>Let&#8217;s take a look at the actual API Endpoint&#8217;s code in the Device Controller<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@PostMapping(\"\/device\")\n    @ResponseStatus(HttpStatus.CREATED)\n    public ResponseEntity&lt;?&gt; postDevice(@RequestBody Device dev) {\n        if (gridDb.getDevice(dev.getId()) == null) {\n            gridDb.putDevice(dev);\n            return new ResponseEntity&lt;Device&gt;(dev, HttpStatus.CREATED);\n        } else {\n            return new ResponseEntity&lt;string>(\"Device already existsn\", HttpStatus.BAD_REQUEST);\n        }\n    }&lt;\/string><\/code><\/pre>\n<\/div>\n<p>The very top of this code snippet tells our controller what HTTP Method we are associating with this function. So, when a user calls <code>http:\/\/localhost:8081\/device<\/code> with a POST, the code which proceeds that line will be called.<\/p>\n<p>In this case, we grab the body of the request and use that information to run our griddb class method <code>.putDevice<\/code> and make a new row in our <code>sbDEVICES<\/code> collection container. Here is that code using a curl command:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">curl --location 'localhost:8081\/device' \n--header 'Content-Type: application\/json' \n--data '{\n    \"id\": \"1\",\n    \"lat\": 0,\n    \"lon\": 0\n}'<\/code><\/pre>\n<\/div>\n<p>Running this command should result in a 201 response from the server and our row of data should be available now.<\/p>\n<h3>GET Methods<\/h3>\n<p>Next up, let&#8217;s take a look at the functions called by the HTTP Method of <code>GET<\/code>; GET is the most used and simple method (think: making a request to open a web page and the repsonse being the webpage).<\/p>\n<p>With a GET, will be able to verify that our row was actually saved into our database.<\/p>\n<p>First up here&#8217;s our GridDB Class&#8217;s methods called <code>getDevices<\/code> and <code>getDevice<\/code>.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">public List&lt;Device&gt; getDevices() {\n        List&lt;Device&gt; retval= new ArrayList&lt;Device&gt;();\n        try {\n            Query&lt;Device&gt; query = devCol.query(\"select *\");\n            RowSet&lt;Device&gt; rs = query.fetch(false);\n            while(rs.hasNext()) {\n                Device dev = rs.next();\n                retval.add(dev);\n            }\n        } catch(Exception e) {\n            e.printStackTrace();\n        }\n        return retval;\n\n    }\n    public Device getDevice(String id) {\n        try {\n            Query&lt;Device&gt; query = devCol.query(\"select * where id='\"+id+\"'\");\n            RowSet&lt;Device&gt; rs = query.fetch(false);\n            if (rs.hasNext()) {\n                Device dev = rs.next();\n                return dev;\n            }\n        } catch(Exception e) {\n            e.printStackTrace();\n        }\n        return null;\n\n    }<\/code><\/pre>\n<\/div>\n<p>These two functions are obviously extremely similar, the top one will grab every single row inside our selected container, while the second function will look up a specifc row with the user-generated row key.<\/p>\n<h3>GET Requests<\/h3>\n<p>To make sure that our row of data is available, we can use our GET methods to READ from our database.<\/p>\n<p>First, the endpoint to get ALL rows of data<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@GetMapping(\"\/devices\")\n    public List&lt;Device&gt; getDevice() {\n        return gridDb.getDevices();\n    }<\/code><\/pre>\n<\/div>\n<p>And then the one to get a specific row:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@GetMapping(\"\/device\/{id}\")\n    public ResponseEntity&lt;?&gt; getDevice(@PathVariable String id) {\n        Device dev = gridDb.getDevice(id);\n        if (dev == null)\n            return new ResponseEntity&lt;string>(\"Device not foundn\", HttpStatus.NOT_FOUND);\n        else\n            return new ResponseEntity&lt;Device&gt;(dev, HttpStatus.OK);\n    }&lt;\/string><\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">$ curl --location 'localhost:8081\/devices'<\/code><\/pre>\n<\/div>\n<p>This should result in a 200 http response along with the data you requested:<\/p>\n<pre><code>[{\"id\":\"1\",\"lat\":0,\"lon\":0}]\n<\/code><\/pre>\n<p>And though we only have one row of data, let&#8217;s try our second endpoint where we give our server a specific rowkey to lookup.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">$ curl --location 'localhost:8081\/device\/1'<\/code><\/pre>\n<\/div>\n<pre><code>{\"id\":\"1\",\"lat\":0,\"lon\":0}\n<\/code><\/pre>\n<p>Also you may notice that the 2nd query is not enveloped in side square brackets &#8220;[]&#8221;. This is because the second query responds with a singular row, whereas the above functions returns all available rows.<\/p>\n<h3>PUT Method<\/h3>\n<p>Okay, now let&#8217;s say we want to update the lat and lon of our row. We can&#8217;t use the POST request because it will spit out the error <code>400 -- Device already exists<\/code>. If we want to update our row&#8217;s data, we will need to use the PUT Request.<\/p>\n<p>And the convenient thing here is that we actually use the exact same function as the POST method for PUTs, so we can skip to the next section. The main caveat is that we need to tell our Device Controller to change the HTTP method to use.<\/p>\n<h3>PUT Request<\/h3>\n<p>Here is the actual Device Controller API endpoint which will handle our PUT requests.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@PutMapping(\"\/device\")\n    public ResponseEntity&lt;?&gt; putDevice(@RequestBody Device dev) {\n        Device dbdev = gridDb.getDevice(dev.getId());\n\n        if (dbdev == null)\n            return new ResponseEntity&lt;string>(\"Device not foundn\", HttpStatus.NOT_FOUND);\n\n        if(dev.getLat() != null)\n            dbdev.setLat(dev.getLat());\n        if(dev.getLon() != null)\n            dbdev.setLon(dev.getLon());\n        \n        gridDb.putDevice(dev);\n        return new ResponseEntity&lt;Device&gt;(dbdev, HttpStatus.OK);\n    }&lt;\/string><\/code><\/pre>\n<\/div>\n<p>And now let&#8217;s call it and set some values<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">curl --location --request PUT 'localhost:8081\/device' \n--header 'Content-Type: application\/json' \n--data '{\n    \"id\": \"1\",\n    \"lat\": 33.8121,\n    \"lon\": 117.9190\n}'<\/code><\/pre>\n<\/div>\n<p>If our server responds with a 200 code, we can assume our row was updated with the new values. We can also run a <code>GET<\/code> to make sure:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">$ curl --location 'localhost:8081\/device\/1'<\/code><\/pre>\n<\/div>\n<pre><code>{\"id\":\"1\",\"lat\":33.8121,\"lon\":117.919}\n<\/code><\/pre>\n<p>Our row was updated!<\/p>\n<h3>DELETE Method<\/h3>\n<p>Similar to the previous function, we have the DELETE method which will delete a row based on the user-generated row key<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">    public void deleteDevice(String id) {\n\n        try {   \n            System.out.println(\"deleting dev=\"+id);\n            devCol.setAutoCommit(false);\n            devCol.remove(id);\n            devCol.commit();\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }<\/code><\/pre>\n<\/div>\n<p>By supplying this function with the proper ID, GridDB will remove that row of data directly inside the <code>sbDEVICES<\/code> container.<\/p>\n<h3>DELETE Request<\/h3>\n<p>Finally let&#8217;s delete our row and wrap up.<\/p>\n<p>The delete method is very similar to our GET of a specific row because the underlying information needed is the same: we just need the row key (ID).<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-java\">@DeleteMapping(\"\/device\/{id}\")\n    public ResponseEntity&lt;?&gt; deleteDevice(@PathVariable String id) {\n        if (gridDb.getDevice(id) != null) {\n            gridDb.deleteDevice(id);\n            return new ResponseEntity&lt;string>(\"device deletedn\", HttpStatus.ACCEPTED);\n        } else {\n            return new ResponseEntity&lt;\/string>&lt;string>(\"Device does not yet exist. Nothing deleted.n\", HttpStatus.BAD_REQUEST);\n        }\n    }&lt;\/string><\/code><\/pre>\n<\/div>\n<p>Once we run this with the proper ID, we will remove the row from our container and be left with an empty conainer:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">curl --location --request DELETE 'localhost:8081\/device\/1' \n--data ''<\/code><\/pre>\n<\/div>\n<p>And one more check with our GET:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-sh\">$ curl --location 'localhost:8081\/devices'<\/code><\/pre>\n<\/div>\n<pre><code>[]\n<\/code><\/pre>\n<h2>Conclusion<\/h2>\n<p>And with that, we have shown the benefits of creating a Spring Boot CRUD API endpoint to safely interact with your GridDB server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the distinction of being its sole native connector. And because it is the native connector, we have decided we would write an article on how to write [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":29539,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46752","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-19T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:56:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/griddb.net\/wp-content\/uploads\/2023\/04\/springboot.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1160\" \/>\n\t<meta property=\"og:image:height\" content=\"653\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Israel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Israel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\"},\"author\":{\"name\":\"Israel\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/c8a430e7156a9e10af73b1fbb46c2740\"},\"headline\":\"Create a Java Web API using GridDB and Spring Boot\",\"datePublished\":\"2023-04-19T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:56:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\"},\"wordCount\":1561,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2023\/04\/springboot.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\",\"name\":\"Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2023\/04\/springboot.png\",\"datePublished\":\"2023-04-19T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:56:30+00:00\",\"description\":\"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2023\/04\/springboot.png\",\"contentUrl\":\"\/wp-content\/uploads\/2023\/04\/springboot.png\",\"width\":1160,\"height\":653},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/c8a430e7156a9e10af73b1fbb46c2740\",\"name\":\"Israel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4df8cfc155402a2928d11f80b0220037b8bd26c4f1b19c4598d826e0306e6307?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4df8cfc155402a2928d11f80b0220037b8bd26c4f1b19c4598d826e0306e6307?s=96&d=mm&r=g\",\"caption\":\"Israel\"},\"url\":\"https:\/\/griddb.net\/en\/author\/israel\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT","description":"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the","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:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/","og_locale":"en_US","og_type":"article","og_title":"Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT","og_description":"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the","og_url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2023-04-19T07:00:00+00:00","article_modified_time":"2025-11-13T20:56:30+00:00","og_image":[{"width":1160,"height":653,"url":"https:\/\/griddb.net\/wp-content\/uploads\/2023\/04\/springboot.png","type":"image\/png"}],"author":"Israel","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"Israel","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#article","isPartOf":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/"},"author":{"name":"Israel","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/c8a430e7156a9e10af73b1fbb46c2740"},"headline":"Create a Java Web API using GridDB and Spring Boot","datePublished":"2023-04-19T07:00:00+00:00","dateModified":"2025-11-13T20:56:30+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/"},"wordCount":1561,"commentCount":0,"publisher":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2023\/04\/springboot.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/","name":"Create a Java Web API using GridDB and Spring Boot | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2023\/04\/springboot.png","datePublished":"2023-04-19T07:00:00+00:00","dateModified":"2025-11-13T20:56:30+00:00","description":"Though GridDB can be used with a variety of programming languages, Java is the one language which works out of the box with the database as it has the","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/blog\/create-a-java-web-api-using-griddb-and-spring-boot\/#primaryimage","url":"\/wp-content\/uploads\/2023\/04\/springboot.png","contentUrl":"\/wp-content\/uploads\/2023\/04\/springboot.png","width":1160,"height":653},{"@type":"WebSite","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/c8a430e7156a9e10af73b1fbb46c2740","name":"Israel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4df8cfc155402a2928d11f80b0220037b8bd26c4f1b19c4598d826e0306e6307?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4df8cfc155402a2928d11f80b0220037b8bd26c4f1b19c4598d826e0306e6307?s=96&d=mm&r=g","caption":"Israel"},"url":"https:\/\/griddb.net\/en\/author\/israel\/"}]}},"_links":{"self":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46752","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46752"}],"version-history":[{"count":1,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46752\/revisions"}],"predecessor-version":[{"id":51419,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46752\/revisions\/51419"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/media\/29539"}],"wp:attachment":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46752"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46752"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46752"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}