O'Reilly logo

RESTful Web Services with Scala by Jos Dirksen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Processing request parameters and customizing the response

In this section, we'll dive a bit deeper into how we can extract query parameters from requests and how to customize the response you send back to the client. In this section, we'll look a bit closer at how to implement the following requests:

  • Create a task: We'll use a set of query parameters to create a new task
  • Get all tasks: We will return all the tasks that have been created
  • Get a task: We will return a specific task based on the provided ID

For each of these requests, we'll first show the call from Postman and then how it is implemented with Akka HTTP. First, start up the correct server with the sbt runCH05-runCH05Step2 command:

$ sbt runCH05-runCH05Step2
[info] Loading project definition ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required