Trouble with message attachment downloads via the API

Discussion in 'LiquidFiles General' started by Alan Bowsher, Jan 15, 2019.

  1. Alan Bowsher

    Alan Bowsher New Member

    Joined:
    Jan 15, 2019
    Messages:
    2
    Likes Received:
    0
    I am a Java developer. When using Apache HttpClient, I can get messages from our LiquidFiles server no problem.

    However, when I take the url ('direct URL' inside the attachment part of the JSON response) for the attachment belonging to the message and try to download it, I can't get it to work.

    Even though I use the exact same header syntax for authorization using my user api key as I did to get the full message, I get an 'Authentication Failure' when trying to get the attachment.

    For any Java developers out there, it looks like this:

    HttpGet req = new HttpGet(attachmentUrl)
    req.addHeader('Authorization', "Basic " + DatatypeConverter.printBase64Binary(accessToken.getBytes()))

    where accessToken is my API key.

    Any suggestions?

    Thanks
     
  2. Alan Bowsher

    Alan Bowsher New Member

    Joined:
    Jan 15, 2019
    Messages:
    2
    Likes Received:
    0
    Ah, so I was getting the list of messages and using the attachment url from there. At the bottom of the doc it mentions viewing the specific message first, so I took that to mean I have to get the messageId and pull each one individually in the UI before getting the attachment(s) for each one. That worked. Seems strange from an API perspective. Still need to try various attachment types but hopeful...
     

Share This Page