Questions tagged [scalaj-http]
17 questions
4
votes
0 answers
How to stream downloads using Scalaj-Http and Hadoop HttpFs
My question is how to use a Buffered stream when using Scalaj-Http.
I have written the following code which is a complete working example that will download a file from Hadoop HDFS using HttpFS. My goal is to handle very large files and this will…

John Hanley
- 74,467
- 6
- 95
- 159
2
votes
1 answer
HTTP error fetching URL. Status=500 while getting data from a website
I'm trying to get data from a website using Jsoup, the website is taking payload in Json ({"SEARCH_VALUE":"ab","STARTS_WITH_YN":false,"ACTIVE_ONLY_YN":false,"ELECTRONIC_NOTARY_ONLY_YN":false,"REMOTE_NOTARY_ONLY_YN":false}) with post request but it…

Asif
- 198
- 10
2
votes
1 answer
Is synchronous HTTP request wrapped in a Future considered CPU or IO bound?
Consider the following two snippets where first wraps scalaj-http requests with Future, whilst second uses async-http-client
Sync client wrapped with Future using global EC
object SyncClientWithFuture {
def main(args: Array[String]): Unit = {
…

Mario Galic
- 47,285
- 6
- 56
- 98
1
vote
1 answer
Unable to access Rest URL using scalaj-Http client with SSL certificates(JKS File)
I am new to Scala. I am trying to access REST API URl and trying to get json data from there using Scalaj-Http with Spark framework in local vm(Intellij). But with the following Code I am always getting Http error code 401 from code and the server…

Avik
- 41
- 4
1
vote
0 answers
Proper consumption of difficult nested JSON objects in Scala using spray-json and scalar.http
My problem is basically to deserialize a complex json string to an object.
This is the case classes with implicits:
import spray.json.{RootJsonFormat, _}
case class OpenCageDataDocumentation(value: String) extends AnyVal
case class…

Ахтем Вейс
- 11
- 2
1
vote
1 answer
How to extract SSO cookie when using scalaj http library
I have a HTTP response. I am trying to get the value for one of the header from it using scala.
My code looks similar to below:
import scalaj.http.Http
val result = Http("http:///sample.com")
…

Vaishak
- 607
- 3
- 8
- 30
1
vote
1 answer
HTTP Post Request in Scala using variables in JSON body
I'm trying to make a HTTP Post request in Scala which uses a JSON body for example:
{
"x": "hello",
"y": "goodbye",
"z": "hi"
}
where I'm storing "hello" and "goodbye" in variables that I am passing into the function making the…

codee
- 31
- 1
- 4
1
vote
1 answer
Scalaj Data Urlencode
When I execute a POST request using curl, it looks this way:
curl -k -X POST \
--header "Content-Type: application/x-www-form-urlencoded" \
--header "Accept: application/json" \
--data-urlencode…

Sparker0i
- 1,787
- 4
- 35
- 60
0
votes
0 answers
Unable to download large files via allowing insecure urls using scala/java
I am trying to download large files from internet using insecure urls bypass. But its throwing error.
No X509TrustManager implementation available
This is what I tried
val trustAllCerts = Array[TrustManager] {
new TrustManager() {
def…

Sudipto Das
- 151
- 1
- 2
- 14
0
votes
0 answers
Spark Scala HTTP Response from Rest Api Timeout Exception
I have to read the JSON response from REST API using Spark Scala, I have written code (both using scala.io.Source.fromInputStream as well Scalaj HTTP) but the Job is not running on HDFS, everytime its giving me Timeout exception though I have…

Ayush
- 83
- 3
- 10
0
votes
1 answer
scalaj-http - 'execute' method is returninig "stream is closed"
I want to use the scalaj-http library to download a byte content file with 31gb size from a http connection. 'asBytes' is not an option because it retuns a byte array.
I tried to use the 'execute' method returning an input stream, but when I execute…

Heitor Barbieri
- 135
- 8
0
votes
1 answer
Parse HTTP POST Response JSON Body in scala
I'm sending an http post request as such:
def Token(url: String, Id: String, key: String): String = {
val body =
s"""
| "id": ${Id}
| "key": ${key}
|""".stripMargin
val request = Http(url).postData(body)
…

codee
- 31
- 1
- 4
0
votes
1 answer
Scalaj HTTP endpoint that requires a JSON-formatted body
I am trying to make a POST request using scalaj, but I am getting the following error
{"code":40010000,"message":"request body format is invalid"} java.lang.Exception: HTTP ERROR: 400
I am trying to access the Alpaca Broker API to make an order and…

HashBr0wn
- 387
- 1
- 11
0
votes
1 answer
How do I post json data in scalaj?
I am using scalaj to make a Http post request
How can I pass lat,long and radius as arguments in the postData field
val result =…

roamer0627
- 91
- 2
- 10
0
votes
1 answer
scalaj Http header not being recognized
I'm trying to invoke an API using scalaj. I need to have a Authorization as type Bearer Token passed with the request. When I try to execute this API using Postman as well as curl, I'm able to get a valid response.
curl -H "Authorization: Bearer…

Sparker0i
- 1,787
- 4
- 35
- 60