Agility, Java programming, New technologies and more…
  • rss
  • Home
  • Management
  • Agile Programming
  • Technology
  • Linux
  • Event
  • Android app
  • Contact
  • About the author
  • English
  • Francais

API, REST, JSON, XML, HTTP, URI… What language do you speak?

Fabian Piau | Monday June 23rd, 2014 - 06:07 PM
  • Click to print (Opens in new window) Print
  • Click to share on X (Opens in new window) X
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on WhatsApp (Opens in new window) WhatsApp

 Version française disponible

Web services

REST (Representational State Transfer) is a standard used for developing web services. As the name suggests, a web service makes available a service through web technologies. In other words, the calling system asks a service to the called system via the web which in turn provides an answer. The answer can be negative if the system called does not or cannot fulfill the requested service. This principle of architecture allows systems to communicate with each other. The interest is even more evident for heterogeneous systems using different technologies with compatibility issues (through “direct” communication).


A standardized… standard

With REST, communication is based on web technologies and more precisely on HTTP (Hypertext Transfer Protocol) and URI used by the WorldWide Web. Messages are transmitted in a standardized format. For the integration of responses, the format generally used is JSON (JavaScript Object Notation), more lightweight and less verbose than XML (eXtensible Markup Language) but XML can, of course, be used.

The following is the representation (deliberately simplified) of a train trip:

Using JSON:

{
	"trainNum": 123456789,
	"departure": {
		"station": "Bruxelles-Central",
		"time": "07:28"
	},
	"arrival": {
		"station": "Liège-Guillemins",
		"time": "08:25"
	}
}

And the XML equivalent:

<trip>
	<trainNum>123456789</trainNum>
	<departure>
		<station>Brussels-Central</station>
		<time>07:28</time>
	</departure>
	<arrival>
		<station>Liège-Guillemins</station>
		<time>08:25</time>
	</arrival>
</trip>

The data interpretation is very simple as these representation formats are easy to read. Complexity is often related to the data itself. Speaking of traveling in train is not very difficult here.

In today’s technologies, REST web services are very popular for several reasons:

  • An obvious simplicity
  • The use of HTTP whose qualities are demonstrated. The current version of this protocol is 1.1, dated of 1999 (even before IE6). In computing, we can say that it is very old…
  • Systems are increasingly modular, the need for interaction and communication continues to grow.


What about “real life”? Are REST and web services useful?

Yes! Perhaps, you use them every day without paying attention. For example, the fact that you connect to an application using your Facebook account involves some calls to a web service. The third party application asks Facebook whether you authorized it to access your information (email, name, friends list), if so, it provides this information to the application. This exchange allows you to authenticate to the third party application. Such an authentication mechanism/account creation is widely used because:

  • Many people use social networks (Twitter, Facebook, Google+)
  • Users don’t have to create another account (and therefore provide yet another password).

It is even more important to properly secure your social account because if it’s getting hacked, all your associated accounts become vulnerable. On this topic, I encourage you to read this previous article “Some basic rules to prevent your accounts from getting hacked”.


Technically, what’s happening under the hood?

Calling a web service is done via a standard HTTP request and a standard HTTP response is received. The request can be of type GET (to retrieve data in read-only), POST (to submit data for modification purpose), you can read the complete list of HTTP methods/verbs here. The response will depend on the request and its associated data, this may be the famous 404 response to indicate that the content has not been found, a 403 status because you do not have enough privileges, you can find the complete list of status codes here. Of course, you also have the status 200 to indicate that everything went well (OK status), with a potential response in XML/JSON.

There are some best practices to follow when implementing web services. Examples of what not to do:

  • Use a POST request to retrieve data while a GET would have been more appropriate (because the data is not modified)
  • Return an empty value (null) with a status 200 when the data has not been found while status 204 or 404 are precisely designed for this.

Also, it is very important that calls are idempotent, i.e. when the same request is sent several times, the response must be consistent. For instance:

  • I send a POST request to modify data, I receive a status 200 confirming me that the data has been modified
  • If I send the same POST request again, I should now receive a status 304 indicating that the data has not been modified.

Sending the same request several times should never be a problem, you must ensure that the system manages it without side effects.


Let’s talk API

So far we have seen that web services are used to make existing systems communicate with each other, actually there is another main use case. Developers can rely on available web services to develop new features or even build a complete application. In this case, we are talking about API: Application Programming Interface.

To continue with social networks example, let’s take the Twitter API now. Twitter provides a set of REST-based methods to retrieve and manipulate tweets. There are many services available, you can take a look at the complete list of Twitter web services here.

Let’s use a Twitter web service based on a GET. Requests of type GET are easier to test, especially because a click in the browser is enough to create and send the request. The following URL creates a GET to retrieve the list of French tweets concerning this year’s World Cup.

  • https://api.twitter.com/1.1/search/tweets.json?q=worldcup2014&lang=fr

Actually, you’ll figure out that the response is not a list of tweets but some error message. You must also add the authentication parameters (ultimately, the click was not enough). In fact, APIs are usually protected and require to be registered before being used. At least, you get the picture and received a JSON response from Twitter (even if it was an access denied…).

We have talked mainly about the Twitter API, but there are thousands of web services and API available. The Google Maps API allows the developer to integrate custom maps. No doubt this openness was one of the ingredients of such success. Indeed, many applications and websites use the Google mapping data to provide new services. Google has a real business plan for companies.

Finally and if you are curious, you can take a look at ProgrammableWeb, a collaborative website that references many API.

Related posts

devoxxDevoxx UK 2018 – Day 2 BotBot Attacks: You are not alone… IT jobsComputing jobs simplified overview microservices-legoMicroservices architecture – Best practices
Comments
No Comments »
Categories
Agile programming
Tags
api, http, json, rest, uri, url, urn, webservice, xml
Comments rss Comments rss

Developer, more than writing code

Fabian Piau | Monday April 28th, 2014 - 01:00 PM
  • Click to print (Opens in new window) Print
  • Click to share on X (Opens in new window) X
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on WhatsApp (Opens in new window) WhatsApp

 Version française disponible

Here is an unpretentious article that agrees with more and more articles on the web facing preconceptions of developers (especially in Europe). You will see that this job is much more than writing code.

Developer

Multisectoral job

Firstly, Information Technology is cross-disciplinary so there are no limits in areas developers can work in. In my case, I worked on different projects of various sectors including automotive, energy, telephony or healthcare. Of course, every time you have to adapt, gain an understanding of the functional side and the business logic, both are essential in the success of a project. The ability to work in different sectors is a great freedom, you can meet people with different backgrounds, it is very rewarding. Also, you can build your own opinion on each sector and focus on areas that interest you the most. It is not given to all professions.

Global vision of a project

Developers are usually taking part to the development phase of an IT project, but they must understand all the components and steps involved. Actually, the implementation represents a very small part in the life of an IT project. Of course, there is no need to be a project expert, but just have some notions of all the activities revolving around. Indeed, there are many steps between the coming up of an idea and selling the solution, and it does not stop there.

Autonomy & Communication

It is true that developers stand most of their time in front of a screen and rarely attend meetings, autonomy is a quality often required. However, communication and collaboration are not left out, it is essential to have good interpersonal skills: be able to work in a team, understand and discuss with the customer or the team leader. An IT project is rarely achieved alone so good communication is paramount. There are many collaborative tools available in the toolbox of a developer.

Software Architecture

No doubt that programming is a technical job and that developers will spend most of their time writing lines of code. But, writing series of instructions with statements like “if”, “else” is an outdated view. Code is thought and follows specific software architecture. Programming is object, functional, architectures are modular, use design patterns and the model must be well thought as early as possible. The software architecture can quickly become complex on large projects. That is why writing a maintainable code is critical and components must be written to evolve easily.

Software Quality

Developers have also some testing responsibilities. They are not end users, but writing tests is part of their job (we talk about technical tests: unit and integration). Tests ensure that the delivered product functionality meet the needs and that the existing one is still working (non-regression). Developers have also the knowledge and mastery of several code quality metrics. And they are aware of the technical debt and manage to decrease it by refactoring the code when necessary.

Tools Master

Developers know many tools that help them to achieve their daily tasks, it can be application tools (IDE, versioning and bugtracking software, continuous integration platform, code analyzers, etc.) or purely technical tools (frameworks, utilities libraries, databases, etc.). It is very rare to start a project from scratch, existing tools are used as much as possible. The choice of tools is also something that has been carefully considered.

Technical intelligence

Developers must learn, learn and always learn to avoid being technically outdated. It is vital to stay updated, this can be done by following training on new technologies, reading blogs, testing new tools. But don’t go in the extreme and it is not because you does not spend your free time to go to Devoxx, listen to the Java Posse podcast or take courses on Coursera that you are not a passionate developer or that you are a bad developer. Also, note that some developers decide to specialize on old programming languages, need for updates is quite limited because the technology is very little to change. It is a career choice.

Close to the machine

Programming is a technical activity, but it is usually done with high-level programming languages. Developers must have notions of what is happening under the hood, ask questions about the frameworks they are using, the underlying concepts, understand the mechanisms of compilation, memory management, performance, understand the information storage, the management of floating-point numbers, etc. Although they don’t need to master all of these concepts, but having some knowledge will help them a lot.


Developer is a job quite complex and multifaceted. Beyond that, I think that attitudes in France and in other European countries are evolving in the right direction. And developer is becoming a profession increasingly valued. Finally, it will be difficult not to do a comparison with what is happening overseas. In the United States, developers are highly considered and some of them are among the richest people on the planet… Something to think about!

Let’s wrap-up this article with some entertainment.

Related posts

IT jobsComputing jobs simplified overview devoxxDevoxx UK 2018 – Day 2 GoogleGoogle at JUG Maven siteMaven Site, one step further
Comments
2 Comments »
Categories
Management
Tags
developer, computing, job, programmer
Comments rss Comments rss
Page 15 of 501…10…1314151617…203040…50
Download CarmaBlog App

RSS feeds

  • RSS feed RSS - Posts
  • RSS feed RSS - Comments

Most viewed posts

  • Changing the language in Firefox - 116,549 views
  • Using Google Forms / Drive / Docs to create an online survey - 64,658 views
  • FAQ – Online survey with Google Forms / Drive / Docs - 56,775 views
  • Customizing Gnome 3 (Shell) - 30,976 views
  • The meaning of URL, URI, URN - 18,617 views
  • Java EE & CDI vs. Spring - 16,083 views
  • Open Street Map, better map than Google Maps? - 16,051 views
  • Comparing NoSQL: Couchbase & MongoDB - 14,832 views
  • API, REST, JSON, XML, HTTP, URI… What language do you speak? - 14,006 views
  • First steps with Apache Camel - 13,818 views

Recent Comments

  • Fabian Piau on FAQ – Online survey with Google Forms / Drive / DocsOui, dans Google Forms, vous pouvez empêcher les p…
  • BENECH Fabien on FAQ – Online survey with Google Forms / Drive / DocsBonjour, J'ai crée 1 questionnaire via Forms,…
  • SANKARA TIDIANE on Free online MongoDB trainingJ'aimerai suivre
  • Pauline on FAQ – Online survey with Google Forms / Drive / DocsMerci Fabian, mais le but étant que nos clients pu…
  • Fabian Piau on FAQ – Online survey with Google Forms / Drive / DocsProbablement mais ces options sont en général paya…

Recent posts

  • How to write a blog post? At least my way! - 2 years and 11 months ago
  • Bot Attacks: You are not alone… - 4 years and 7 months ago
  • Flagger – Monitor your Canary deployments with Grafana - 5 years and 4 months ago
  • Flagger – Canary deployments on Kubernetes - 5 years and 6 months ago
  • Flagger – Get Started with Istio and Kubernetes - 5 years and 6 months ago
  • Expedia CoderDojo in London - 6 years and 4 months ago
  • Volunteering at Devoxx4Kids - 6 years and 6 months ago
  • A Java 11 migration successful story - 6 years and 10 months ago
  • Tips to make your WordPress website secure - 7 years and 1 month ago
  • Devoxx UK 2018 – Day 2 - 7 years and 5 months ago
  • Devoxx UK 2018 – Day 1 - 7 years and 6 months ago
  • Wise, Revolut and Monzo, a small revolution for travelers and expats - 7 years and 10 months ago
  • Autocomplete for Git - 8 years and 6 months ago
  • Swagger, the automated API documentation - 8 years and 8 months ago
  • Microservices architecture – Best practices - 9 years and 1 month ago
Buy me a coffee

Language

  • Français
  • English

Follow me!

Follow me on Linkedin
Follow me on Twitter
Follow me on Stackoverflow
Follow me on Github
Follow me on Rss
Link to my Contact

Email subscription

Enter your email address to receive notifications of new posts.

Tags

.net agile agility android bash best practices blog cache cloud computing conference continuous integration css developer devoxx docker eclipse extreme programming firefox flagger google helm hibernate istio java job jug kubernetes london mobile computing overview performance plugin programmer script security sharing society spring tdd test tool ubuntu windows wordpress

Links

  • Blog Ippon Technologies
  • Blog Publicis Sapient
  • Blog Zenika
  • Classpert
  • CommitStrip
  • Coursera
  • Le Touilleur Express
  • Les Cast Codeurs Podcast
  • OCTO talks !
  • The Twelve-Factor App

Categories

  • Event (15)
  • Linux (3)
  • Management (8)
  • Agile programming (29)
  • Technology (45)

Archives

  • December 2022 (1)
  • April 2021 (1)
  • June 2020 (1)
  • May 2020 (2)
  • July 2019 (1)
  • May 2019 (1)
  • December 2018 (1)
  • October 2018 (1)
  • June 2018 (1)
  • May 2018 (1)
  • January 2018 (1)
  • May 2017 (1)
  • March 2017 (1)
  • October 2016 (1)
  • April 2016 (2)
  • March 2016 (1)
  • November 2015 (1)
  • May 2015 (1)
  • February 2015 (1)
  • December 2014 (1)
  • November 2014 (1)
  • September 2014 (2)
  • August 2014 (1)
  • July 2014 (2)
  • June 2014 (1)
  • April 2014 (1)
  • March 2014 (1)
  • February 2014 (2)
  • January 2014 (1)
  • December 2013 (1)
  • November 2013 (1)
  • October 2013 (3)
  • September 2013 (5)
  • July 2013 (1)
  • June 2013 (1)
  • May 2013 (1)
  • April 2013 (1)
  • March 2013 (2)
  • February 2013 (1)
  • January 2013 (2)
  • December 2012 (2)
  • October 2012 (1)
  • September 2012 (1)
  • July 2012 (1)
  • May 2012 (1)
  • April 2012 (1)
  • March 2012 (1)
  • February 2012 (1)
  • January 2012 (2)
  • December 2011 (1)
  • November 2011 (2)
  • October 2011 (2)
  • September 2011 (1)
  • July 2011 (1)
  • June 2011 (2)
  • April 2011 (1)
  • March 2011 (1)
  • February 2011 (1)
  • January 2011 (2)
  • November 2010 (2)
  • September 2010 (1)
  • August 2010 (1)
  • July 2010 (1)
  • June 2010 (1)
  • May 2010 (1)
  • April 2010 (1)
  • March 2010 (1)
  • February 2010 (1)
  • December 2009 (1)
  • November 2009 (1)
  • October 2009 (2)
  • September 2009 (2)
  • August 2009 (3)
  • July 2009 (1)
  • June 2009 (2)
Follow me on Twitter
Follow me on Linkedin
Follow me on Stackoverflow
Follow me on Rss
Link to my Contact
Follow me on Github
 
Fabian Piau | © 2009 - 2025
All Rights Reserved | Top ↑