Appendix A1: A short list of REST/JSON libraries

The following list is by no means exhaustive of all available implementations. In most cases REST/JSON implementation are embedded in the language itself and are logically split between a network library that will take care of the HTTP request and a JSON library that will unmarshal the response.

Java

The excellent Jackson library will help you parse and create JSON - see https://github.com/FasterXML/jackson - while the embedded class java.net.URLConnection will take care of the connection.

JavaScript / NodeJS

The http module - especially http.request - will take care of the connection while JSON.parse will decode the output.

Python

The json and urllib2 libraries should be immediately available.

Go

Can be done natively leveraging the encoding/json and net/http packages.

Elixir

In Elixir you can use req as a simple HTTP client, and jason to translate a JSON payload into a native structure.

Ruby

The modules json and open-uri are available in the standard library.

C# / .Net

Can be done natively - see example at http://msdn.microsoft.com/en-us/library/hh674188.aspx

Perl

You can use the JSON module and LWP::UserAgent for accessing the remote QM instance.

PHP

You can usually read a remote URL with php_curl and retry the JSON structure with json_decode . Here’s an example of a GET query with php:

----
$url = "http://queuemetrics-server:8080/queuemetrics/agent/73/jsonEditorApi.do
$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
print_r(json_decode($output, true));
----