restful

A Scala JSON (Gson) HTTP POST RESTful client example

While working on a Scala project recently I created the following example Scala code to test a variety of things, including:

  • Scala case classes
  • The Apache HttpClient classes, including HttpPost
  • Creating JSON with Gson
  • Sending the JSON object/string to my POST RESTful server

Given that brief introduction, here's the source code for my Scala HTTP client, which uses POST (Apache HttpPost) to send data to a RESTful web service:

Syndicate content