-
-
Save laverboy/0d9ffe9990ebff42695ce4b0f319dc02 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.parsing.json.JSON | |
import scalaj.http.Http | |
// Assumes a list of objects. If response i only as single object, the last | |
// .asInstanceOf[Seq[Map[String, Any]]] could be changed to .asInstanceOf[Map[String, Any]] | |
def getService(serviceURL: String, serviceAuthToken: String): Seq[Map[String, Any]] = { | |
JSON.parseFull( | |
Http(serviceURL) | |
.timeout(connTimeoutMs = 600000, readTimeoutMs = 10000) | |
.headers(Seq(("Auth", s"Bearer ${serviceAuthToken}"))) | |
.asString.body | |
).get | |
.asInstanceOf[Seq[Map[String, Any]]] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment