I have the following code that takes path parameters;
def candlesRange: Route = (path("candles" / Segment / Segment / IntNumber / LongNumber / LongNumber) & get) {
(a1, a2, tf, t1, t2) => complete(apiController.apiGetCandlesRange(a1, a2, tf, t1, t2))
}
But I want to change some of the parameters to be Query Parms. So the URL will follow a format like this;
/candles/Asset1/Asset2/timeStart=1507198441000&timeEnd=1512382501000&interval=60m
And pass them through to the same method (Perhaps even removing the 'm' from the minutes as the param on the method is an int)
How can change this route to do this in Scala Akka Http. The only examples I can find use Path params
Read about parameters
here: https://doc.akka.io/docs/akka-http/current/routing-dsl/directives/parameter-directives/parameters.html
val candlesRange: Route = (path("candles" / Segment / Segment / )) { (a1, a2) =>
get {
parameters('timeStart, 'timeEnd, 'interval) { (timeStart, timeEnd, interval) =>
complete(apiController.apiGetCandlesRange(a1, a2, timeStart, timeEnd, interval))
}
}