0

Using LiveLink Server 16.2.9 (2019-06), build 851

This is the code I use to download a LiveLink file named Active_Time.xlsx. If I paste the link below in the browser, then the file is downloaded. However, when using this code the result is a small XML file (see bottom)

Dim remoteUri As String = "https://OurServer.com/livelink/livelink.exe?func=ll&objId=33100345&objAction=download"

Using client = New Net.WebClient()
      client.Credentials = New Net.NetworkCredential(username, password, domain)
      client.DownloadFile(remoteUri, "C:\temp\Active_Time.xlsx)           
      Console.WriteLine("File extracted.")
      client.Dispose()
    End Using

Something is downloaded but not the Excel file I expected. This is what I get if I edit the file with Notepad.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script src="./jquery.min.js?v=16.6.0.2315"></script>
    <script src="./login1/getfragment.js?v=16.6.0.2315"></script>
</head>
<body>
<noscript>
    <p><strong>Note:</strong>Since your browser does not support Javascript, you must press the Continue button once to proceed.</p>
</noscript>
<form action="login" method="get">
<div>

    <input type="hidden" name="RFA" value="eyJhbGciOiJub25lIn0.eyJwb3N0VGlja2V0Ijp0cnVlLCJwb3N0UGFyYW1zIjp0cnVlLCJsb2dvblN0eWxlIjoic2lnbmluLWNzIiwidXhWZXJzaW9uIjoxLCJmb3J3YXJkQWRkcmVzcyI6Imh0dHBzOi8vY2Rtcy50YXMtY2FuLmNvbS9saXZlbGluay9saXZlbGluay5leGU_ZnVuYz1vdGRzaW50ZWdyYXRpb24ucmVkaXJlY3QmTmV4dFVSTD1odHRwcyUzQSUyRiUyRmNkbXMlMkV0YXMlMkRjYW4lMkVjb20lMkZsaXZlbGluayUyRmxpdmVsaW5rJTJFZXhlJTNGZnVuYyUzRGxsJTI2b2JqSWQlM0QzMzY1MjI3MSUyNm9iakFjdGlvbiUzRGRvd25sb2FkJTI2bmV4dHVybCUzRCUyNTJGbGl2ZWxpbmslMjUyRmxpdmVsaW5rJTJFZXhlJTI1M0ZmdW5jJTI1M0RsbCUyNTI2b2JqSWQlMjUzRDMzMTQwMzE1JTI1MjZvYmpBY3Rpb24lMjUzRGJyb3dzZSUyNTI2bG9nU3RvcENvbmRpdGlvbklEJTI1M0QxMTYwODAxXzEzOTA1Mzg5MF8xX2xvYyIsInJlc291cmNlSUQiOiIxYTEzYzg2Mi0zZGY2LTRhNGYtYWU3MC1kYThhNmY0ZGI4YzIifQ">

    <input type="hidden" name="fragment" id="fragment">
</div>
<noscript>
    <div><input type="submit" value="Continue"></div>
</noscript>
</form>
</body>

1 Answers1

0

Looks like you're not authenticated? You should use the rest api.

Example

https://<server.ext>/<livelink-root>/api/v2/nodes/2000
Steffen Roller
  • 3,464
  • 25
  • 43
  • You mean using this url: "https://OurServer.com/api/v2/node/301832" ? I am getting "The remote server returned an error: (404) Not Found." Please advise how to build the URL using /api/v2/node/.? –  Nov 20 '19 at 19:48
  • I edited my response. You'll also need a SDK license. There you will find all the rest calls. – Steffen Roller Nov 20 '19 at 19:54
  • Not sure about an SDK license, everything worked perfectly until last week when they upgraded LiveLink server. Prior to this I was downloading the file using this URL and it always worked: https: //OurServer.com/csdav/nodes/33140315 –  Nov 20 '19 at 19:59
  • Maybe I can change this one above using api/v2/nodes ? –  Nov 20 '19 at 20:02
  • you might try this: `https://OurServer.com/livelink/livelink.exe/api/v2/nodes/301832` – Steffen Roller Nov 20 '19 at 20:15
  • This is the url after I login https: //wtrs.taw-tpp.com/livelink/livelink.exe?func=llworkspace –  Nov 20 '19 at 20:15
  • I tried the URL you suggested and now I get ""The remote server returned an error: (401) Unauthorized." –  Nov 20 '19 at 20:17
  • you need to get an authentication token first. Perform a *POST* to ../api/v1/auth with username=xxx&password=xxx. Keep the cookie for the following calls. – Steffen Roller Nov 20 '19 at 20:23
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/202753/discussion-between-steffen-roller-and-user-123). – Steffen Roller Nov 20 '19 at 20:24
  • Just opened chat –  Nov 20 '19 at 20:33