Join the DZone community and get the full member experience.
there is a long and rich history of using web services to communicate between applications and systems throughout the internet. even before there was an internet or world wide web, there was machine communication. for almost 40 years, companies have had a standard for communicating between computers.
the electronic data interchange (edi) method has had many standards through the years. these methods were created to save money for companies that built networked systems which could communicate in this manner. the downside of using edi was the high cost of time and money required to implement a solution. this allowed adopting edi for very large corporations but for reasons stated above, out of reach for many smaller companies and organizations.
with the creation of the world wide web by english scientist tim berners-lee in the early 1990s, some of the barriers to machine communication were reduced. by leveraging the tcp/ip protocol standard of the internet, berners-lee and his team created the hypertext transfer protocol (http) for allowing applications on the www to exchange or transfer hypertext (or as we call it now, html) effectively and cheaply. the proliferation of the internet by both consumers and business organizations allowed the rise of the early web service methods to make the internet a more valuable resource for companies looking for business optimization and better workflows.
there have been a number of technologies used for creating and implementing web services since the creation of the www. many of the early web service technologies relied on heavy definitions to handle everything that was needed for machine communications: security, encryption, error handling, etc. this made web service technologies like rpc or soap difficult to design, implement and finally test. they all shared the challenges: keeping track of state on the server during the lifetime of the communication with each client and the performance needed for today’s enterprise systems and mobile applications. because of these deficiencies in earlier web service technologies and implementations, new visions were needed in the web 2.0 period of the internet.
rest stands for representational state transfer . it relies on a stateless, client-server, cacheable communications protocol — and in virtually all cases, the http protocol is used.
rest is an architecture style for designing networked applications. the idea is that, rather than using complex mechanisms such as rpc or soap to connect between machines, simple http is used to make calls between machines.
in many ways, the world wide web itself, based on http, can be viewed as a rest-based architecture.
rest applications use http requests to post data (post and put), read data (get), and delete (delete) data. thus, rest uses http for all four crud (create/read/update/delete) operations. in addition, rest uses http status codes to give clients the information for the actions they took. the http status codes (200, 201, 404, etc.) are all very common to developers.
rest is not a “standard.” there will never be a standards recommendation for rest, for example. and while there are rest programming frameworks and 3rd party systems, working with rest is so simple that your organization can often create a custom solution with standard library features in languages like node.js, java, or c#/asp.net web api.
the rest architectural style describes five constraints . these constraints, applied to the architecture, were originally documented by roy fielding in his doctoral dissertation and defines the basis of the rest style.
in short, the constraints are:
despite being simple, rest is fully-featured; there’s basically nothing your organization can do on other web services that can’t be done with a rest architecture.
the necessary state to handle a request is contained in the request itself, whether as part of the uri, query-string parameters, body, or headers. the uri uniquely identifies the resource and the body contains the state (or state change) of that resource. then after the server does its processing, the appropriate state, or the piece(s) of state that matter, are communicated back to the client via headers, status and response body.
as on the world wide web, clients can cache responses. responses must therefore, implicitly or explicitly, define themselves as cacheable, or not, to prevent clients reusing stale or inappropriate data in response to further requests. well-managed caching partially or completely eliminates some client–server interactions, further improving scalability and performance.
the uniform interface separates clients from servers. this separation of concerns means that, for example, clients are not concerned with data storage, which remains internal to each server, so that the portability of client code is improved. servers are not concerned with the user interface or user state so that servers can be simpler and more scalable. servers and clients may also be replaced and developed independently, as long as the interface is not altered.
a client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. intermediary servers may improve system scalability by enabling load-balancing and by providing shared caches. layers may also enforce security policies.
there are many reasons why your organization should embrace and use rest apis for their data and information needs.
despite being simple, rest is fully-featured; there’s basically nothing your organization can do in web services that can’t be done with a rest architecture.
as your organization builds enterprise and mobile apps for customers, partners, and employees, you need apps that perform well over different network types and speeds. and that means your organization needs a great rest api that provides design-time and runtime access to data services hosted by your infrastructure. think of it as “cloud” technology that lets the data inside your datacenter get out and back (securely) to the mobile app that needs it. as mobile apps get more transactional, the need for api management platforms will become even more critical.
but even before you start to do api management, your organization needs to develop the rest api services.
now that most of the companies are starting to think why companies must have a rest api , many of them face the same challenges with one of the biggest challenges is figuring out a winning api strategy. when a company decides to start a new mobile project, they first develop the business requirements, and then start building the actual software. usually there is a client-side team that designs the application, a server-side team that builds the back-end infrastructure and the testing team responsible to test both client-side and server-side outputs. these three or more teams must work together to develop a rest api for the project.
the rest api’s are always changing, with each change the r&d teams are forced to refactor their work which extends development time and delivery dates (time-to-market), communication and collaboration about such changes are not sufficient, consuming valuable time.
in order to get you started with design, development, documentation and testing of your rest apis, enhancing team collaboration and providing tools to rapidly build your api services you can look at restcase – api design, documentation, and testing for teams .
as these enterprise and mobile applications get complex, with transactions, integrated applications, and more and richer content and collaboration, they will need solutions that handle all those integration points. think of it this way: rest interfaces give your organization the means, but now your organization needs a system to handle the sheer number of apis your organization will be building.
you need to stay flexible with mobile platforms. your organization might be able to get away with supporting only android and ios today, but before your organization knows it, you may need to support more form factors or additional platforms like windows 10. and you may need to get data from sensors or internet of things (iot) devices. rest apis gives a consistent, accessible interface with a low bar to entry. as long as a device connects to the web your organization can send and consume data from the device. and if you make your apis public, your organization might not even have to write that new mobile app because another developer could do it for you.
many companies face the same challenges with one of the biggest challenges is figuring out a winning api strategy. when a company decides to start a new mobile project, they first develop the business requirements and then start building the actual software. usually, there is a client-side team that designs the application, a server-side team that builds the back-end infrastructure and the testing team responsible to test both client-side and server-side outputs. these three or more teams must work together to develop a rest api for the project.
the modern enterprise may need hundreds or even thousands of mobile applications and so the api building process continues over a few years with different developers, consultants, and contractors. many companies are already running with hundreds of internal apis that lack management, are difficult to discover and document, and hard to use by internal developers, existing applications and partners.
Published at DZone with permission of Guy Levin, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
CONTRIBUTE ON DZONE
Let’s be friends:
DZone.com is powered by
Join the DZone community and get the full member experience.