GraphQL: How Easy Is It?
Spire Maritime Sales Engineering Manager Shanu Suman talks about her experience learning and using GraphQL. She also explains the differences between GraphQL and REST.
Join the DZone community and get the full member experience.Join For Free
Did you know that over 90% of goods are delivered by ships? Managing ship operations and vessel tracking are essential and the maritime industry is going through a massive transformation, using data from space, land, and sea to build more efficient operations, manage fuel usage, and identify safer routes. With this came a tidal wave of data that challenged our need to help our customers and developers to iterate quickly, so we created a new Spire Maritime 2.0 Platform using GraphQL.
The Spire Maritime 2.0 release is the first satellite AIS maritime data solution to offer GraphQL, an open-source query language. Since Facebook released GraphQL, the technology has introduced major breakthroughs that simplify how developers can access and iterate on data. GraphQL enables customers and application service providers to innovate quicker and leverage the power of Spire’s trusted data. GraphQL has already been deployed on leading enterprise technology platforms including Atlassian, GitHub, New Relic, Intuit, and Shopify.
We’re sitting down with Spire Maritime Sales Engineering Manager Shanu Suman to discuss her experience using GraphQL in an effort to learn more about its potential and the impact it could have on maritime operations.
Interview With Shanu Suman, Spire Maritime Sales Engineering Manager
Introduction: Good morning, Shanu. Thank you for taking the time to talk with us today. The maritime industry is in growth mode and this growth has spurred an interest in digitalization and technology tools. Maritime solutions have evolved beyond just vessel tracking and now are built to scale and are fueled by clean, high-quality data. These solutions are being developed to help organizations capture better fuel economy, plan accurate port arrival times, and navigate efficiently through crowded shipping lanes. Earlier this year, Spire Maritime announced that beta testing had begun for an upgraded API that offers GraphQL.
Question: What makes this so unique and what are the main benefits of this query language?
Answer: GraphQL is a faster and more efficient query language, which makes it much more powerful compared to REST. GraphQL helps us get the exact data we need by reducing the overhead. This gives clients full control of the data volume being returned, contrary to REST API, where a fixed data set is returned. Consumers need to save the whole data and then filter what they need. GraphQL is a faster and more flexible way to use APIs where you can query exactly what you need. This saves time, as you might not need to query 3-4 different APIs to get what you need; rather, you can make just one request to fetch all that is needed. REST APIs don't have this flexibility. Sometimes we under-fetch, as there is not all the data we need in the same API; or we over-fetch - we might not need the full dataset returned by the API.
Question: How easy is GraphQL to use? How long did it take you to feel confident using it?
Answer: I was a complete newbie to GraphQL until the beta version of Maritime 2.0 was launched in August, but now I am totally confident using it, which did not take much time. The only challenge is to understand the schema and learn how to use it. Any GraphQL API query has 3 basic components:
Selection of fieldset requested
Query argument to filter the data and the value of this argument
Question: In what specific ways does GraphQL improve the user experience? How does it specifically benefit maritime operations?
Answer: Going forward we want to use one single endpoint to provide all the core Maritime API services. It will act as a single endpoint for different types of data to be queried. For now, we have migrated the vessel's live tracking data and predicting route capabilities. Eventually, we will be migrating the vessel's characteristics, and historical data, as well as Port Events. This will greatly improve the user experience compared to what we have now where customers have to query our Vessels API to get the vessel tracking id and then the Historical Positions API using the id to fetch the history. In the future, all of this will be possible on a single endpoint using a single query. It also improves the user experience by reducing the data you have to manage.
Question: How do you think GraphQL will change or impact the maritime industry?
Answer: What the maritime industry needs is faster, cleaner, and more reliable data. GraphQL greatly enables us to do this. We want to give customers the benefit of using an API with a quicker response time and an architecture where we can implement the most sought-after product features easily and quickly.
Question: What is the most exciting thing about Maritime 2.0 using this technology?
Answer: I am most excited about two things:
1. We have implemented a new vessel identification algorithm that helps us detect vessels separately even if they are transmitting the same MMSI or IMO number. This will greatly benefit customers who are having difficulties due to duplicate MMSI or IMO issues as there is no industry-wide standard to stop it.
2. The response time of our new API has greatly reduced in comparison to our current REST API service.
Conclusion: Thank you for taking the time to meet with us today, Shanu. Your experience using GraphQL and maritime data provided some great insights.
Opinions expressed by DZone contributors are their own.