Over a million developers have joined DZone.

Streaming APIs: JSON vs XML and REST is King

DZone's Guide to

Streaming APIs: JSON vs XML and REST is King

· Java Zone ·
Free Resource

Get the Edge with a Professional Java IDE. 30-day free trial.

Streaming APIs are becoming more popular because of the low latency they provide.  What are the common protocols and data formats of these APIs?  To find out I did a simple search on APIhub, the largest repository I found for streaming APIs.  Below are the results of the 104 APIs that came up. The total won't equal 104 because I've removed a few of the very low-count protocols and data formats.

Source: www.APIhub.com

Although ProgrammableWeb had a smaller sample size of streaming APIs (34), their ratios matched what we see in APIhub's numbers.  Over 75% of the APIs used REST, and JSON had only one more than XML.  There were 20 for JSON vs 21 for XML.

When I compared the streaming APIs with the total number of APIs in APIhub, you see some differences in how these streaming APIs are being developed versus the general API pool

Here were my observations about the entire repository on APIhub:

  • SOAP APIs are equal to about half of the number of REST APIs.
  • More APIs use XML for the data format.  About 7000 use XML while approximately 5000 use JSON. 
  • The numbers for other data formats and protocols don't come close to the ones already mentioned in the first two points.
JSON seems to be edging out XML as a data format for streaming APIs, but XML remains firmly in place as the leading data format in the general API population.  So this begs the question… Is the JSON and REST combo going to be the modern best practice for these new, low-latency APIs?  

It seems like the answer for REST is clearly 'yes', but I'm not so sure about XML vs. JSON.  Here's a little qualitative data for you:  Although streaming experts at Salesforce and DataSift use JSON (and PHP as an alternate for DataSift), Twitter uses XML.  So there's no consensus among the major real-time players yet, and maybe that's because neither has the versatility to make the other obsolete.

Get the Java IDE that understands code & makes developing enjoyable. Level up your code with IntelliJ IDEA. Download the free trial.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}