SEOKJUNG KIM Posted March 30, 2023 Posted March 30, 2023 I'd like to make Scala code to upload my dxp file to spetific Spotfire Library.But with below code, I got 405 code.. is it not possile or I missed somthing?<-- my scala code --> val filepath = "d:/spotfire_sample.dxp"val ServerURL = "11.90.11.123"val port = 8555val Library = "spotfire/wp/startPage#/libraryBrowser?id=5c0f525d-42ca-466c-acf8-02b9118ba6b5"; // don't know this Library address is correct val Address = s"http://$ServerURL:$port/$Library"val url = new URL(Address)val connection = url.openConnection().asInstanceOf[HttpURLConnection]val Credentials = java.util.Base64.getEncoder.encodeToString("seokjung.kim:12345678".getBytes)connection.setRequestProperty("Authorization", s"Basic $Credentials")connection.setRequestMethod("POST")connection.setDoOutput(true);connection.setRequestProperty("Content-Type", "application/octet-stream")connection.setRequestProperty("Content-Disposition", "form-data; name="file"; filename="" + filepath + """)val inputStream = new BufferedInputStream(new FileInputStream(filepath))val outputStream = new DataOutputStream(connection.getOutputStream())val buffer = new Array[byte](4096)var bytesRead = -1while ({bytesRead = inputStream.read(buffer); bytesRead != -1}){ outputStream.write(buffer, 0, bytesRead)}inputStream.close()outputStream.flush()outputStream.close()val response = connection.getResponseCode()println("reponse : " + response) // always get 405 but when mehtod is chagned "GET" I got 200 connection.disconnect()
Fredrik Rosell Posted March 31, 2023 Posted March 31, 2023 Hello,There is no public API for uploading dxp files to the Library (there is an existing idea for this that you might want to vote on: https://ideas.tibco.com/ideas/TS-I-5602), so the answer is no - this is currently not possible/supported.Best RegardsFredrik
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now