•  
      request #14775 Get artifact_files data from API and decode
    Infos
    #14775
    Theo Seohs (seohs.theo)
    2023-10-05 17:14
    2020-04-10 08:16
    16047
    Details
    Get artifact_files data from API and decode
    Hi,

    I'm trying to retrieve artifacts attachments files via API (route /api/artifact_files/{id}), I get the data but my attempts to decode didn't work.

    Is there an easier way to decode the artifact_files correctly and recovery the attachment object outside tuleap?

    Thanks very much.
    API
    Empty
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    Closed
    2023-10-05
    Attachments
    Empty
    References
    References list is empty

    Follow-ups

    User avatar
    Thomas Gerbet (tgerbet)2020-04-10 10:22
    Hi,

    You could indeed retrieve the attachment via the endpoint GET /artifact_files/:id. The content you get is Base64 encoded and is paginated. That means you will need to iterate over the whole collection and concatenate each part to get the whole blob.

    These days thre is however an easier way, the API exposes an URL in the file_descriptions in the field html_url. This URL can be called like a standard REST endpoint and it returns the whole file.
    User avatar
    Theo Seohs (seohs.theo)2020-04-10 09:09
    Hi,

    It would be nice to hear your opinion, but it seems that using python base64.b64decode(attch_data) and saving it works for me. I have to try with all my files but it already worked with .png and excel.

    Thanks.