16 questions
2
votes
1
answer
315
views
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,&...
1
vote
1
answer
655
views
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 ...
0
votes
0
answers
824
views
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 ...
1
vote
0
answers
247
views
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: ...
0
votes
1
answer
172
views
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' ...
2
votes
1
answer
1k
views
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 ...
1
vote
1
answer
140
views
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")
....
0
votes
1
answer
2k
views
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 ...
1
vote
1
answer
4k
views
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 ...
0
votes
1
answer
674
views
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 ...
0
votes
1
answer
2k
views
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 = Http("http:xxxx/xxx/xxxxx").postData("""{"latitude":"39.6270025","...
1
vote
1
answer
922
views
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-...
0
votes
1
answer
974
views
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 ...
0
votes
0
answers
904
views
How to fix 'Malformed class name' error in Spark Scala?
In Qubole notebook I am trying to get certain string from API response. It seems to be working just fine for sample data but fails when I use the full set. Spark version: 2.3.1; Scala version: 2.11; ...
0
votes
1
answer
961
views
Mockito mock HttpResponse[Array[Byte]] for unit test in Scalaj-Http
I have a function that makes a request gets the response in bytes and writes to file. A part of the function is given below.
val bytes = Http(url).timeout(connTimeout, readTimeout).method("GET")....
4
votes
0
answers
528
views
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 ...