Closed ashitabh closed 1 year ago
@ashitabh have you solved this yet? I'm running into the same issue. I can only successfully authenticate when the keys are held as query params. Header params are not working for me
@sourav-mazumder any help with that?
Hi Mike, I did some changes in RestConnectorUtil.scala. Line no: 53 for Get method
var httpc = (method: @switch) match {
//case "GET" => Http(addQryParmToUri(uri, data)).header("contenty-type",
// "application/x-www-form-urlencoded")
case "GET" => Http(addQryParmToUri(uri, data)).header("Authorization",authToken)
case "PUT" => Http(uri).put(data).header("content-type", contentType)
case "DELETE" => Http(uri).method("DELETE")
case "POST" => Http(uri).postData(data).header("content-type", contentType)
}
and then from notebook/ spark code I used the following
val sodauri = "https://somesrestapi.com/v4/entity/user"
val parmg = Map("url" -> sodauri, "input" -> "sodainputtbl", "method" -> "GET","authType"->"Basic","authToken"->"Auth-Token xxxxx","readTimeout" -> "200000", "connectionTimeout" -> "200000", "partitions" -> "10")
val sodasDf = spark.read.format("org.apache.dsext.spark.datasource.rest.RestDataSource").options(parmg).load()
@ashitabh okay cool, I was expecting something similar. Unfortunately the headers in most of the apis I use are very different... so will have to build a header builder util or something
the authorization header key-value can be added for the POST method as well
case "POST" => Http(uri).postData(data).header("Content-Type", contentType).header("Authorization",authToken)
How do I pass header -> Authorization : Bearer xxxyyyzzz" in notebook