Quantcast
Channel: Tech – James' World
Viewing all articles
Browse latest Browse all 190

REST API Client Computer Languages and Frameworks Survey

$
0
0


I recently wrote REST API client programs in several programming languages as a subproject of my Perl REST API Framework, and had some surprises, both good and bad.

I would have gladly just linked to somebody else’s sample clients, but I couldn’t find any remotely complete or professional-grade code (complete working program with error-handling, Basic auth and timeout.)

The closest to useful REST clients that I saw were the Java tutorials by mkyong.com, RESTful Java client with Apache HttpClient

Here’s my notes:

Java

  • tough to find the a working HTTP class for Java 1.8 on Centos7. I couldn’t get Apache HTTPClient imports working, so I ended up using HttpURLConnection
  • first experience with immutable data collections – quite jarring to realize you have to copy anything to change it. And an int is not an Integer, and a String is not a StringBuffer. Hahaha, good one!
  • somewhat of a learning curve for java build process. See make_java.sh for a minimal build tool
  • lint: javac -Xlint:all
  • I wouldn’t be surprised if Java’s legendary slowness and memory bloat are from the above issues, obvious even from a 200-line program.

Python

  • used the requests HTTP module
  • felt comfortable until running Pylint and discovering how freaky the python community can get (scoring my working program -1.5/10, but getting 10/10 after whitespace-only changes. Really?)
  • nice indenting: pindent.py -r -s 4 -e

Ruby

  • used the httparty HTTP framework
  • elegant, beautiful OO code without even trying.

PHP

  • got it working the fastest, but then took longer to polish it
  • wish there was a lint for PHP

curl

  • not bad – straight-forward to do various requests and get responses

wget

  • inadequate for REST API programming, more for manually fetching files only

Perl

  • LWP is mature, well-documented and readily available and made Perl the easiest scripting language to work with overall
  • Perl’s built-in lint checking (strict and diagnostics) is much appreciated after its lack in PHP, Python and bash.

RESTful Java client with Apache HttpClient
Why Pylint is both useful and unusable, and how you can actually use it
Notes on Managing Java in the Cloud
Static typing will not save us from broken software
OpenFeign Java HTTP Client Library


Viewing all articles
Browse latest Browse all 190

Trending Articles