Forum Discussion

Hafedh_Elfaleh's avatar
6 years ago
Solved

downloading Files via the Aras Innovator REST API

Hello All,

please how to download Files via the Aras Innovator REST API.

thank you .

Best Regards.

  • Hello,

    You can do this by appending $value to the end of a REST call for a File item. For example, we could get the metadata for a File that's related to a Document by performing the following request.

    GET {base url}/Document('8C6CEBD3DF1044CEB0B1658693735130')/Document File('9925FBEFB76346A9B898713A94059342')/related_id

    We can get the actual content of that File to download by just adding $value to the end like so:

    GET {base url}/Document('8C6CEBD3DF1044CEB0B1658693735130')/Document File('9925FBEFB76346A9B898713A94059342')/related_id/$value

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

7 Replies

  • Hello,

    You can do this by appending $value to the end of a REST call for a File item. For example, we could get the metadata for a File that's related to a Document by performing the following request.

    GET {base url}/Document('8C6CEBD3DF1044CEB0B1658693735130')/Document File('9925FBEFB76346A9B898713A94059342')/related_id

    We can get the actual content of that File to download by just adding $value to the end like so:

    GET {base url}/Document('8C6CEBD3DF1044CEB0B1658693735130')/Document File('9925FBEFB76346A9B898713A94059342')/related_id/$value

    Chris


    Christopher Gillis

    Aras Labs Software Engineer

    • christopher_gillis's avatar
      christopher_gillis
      New Member

      As a note on this answer, Subscribers and Partners can go to the Documentation folder of the Aras Innovator CD Image to find the RESTful API.pdf which contains a number of samples for using the API. This example can be found in the section on File Properties

    • Hafedh_Elfaleh's avatar
      Hafedh_Elfaleh
      Ideator I

      thanks Chris that was a useful hint.
      now I can download the files using java client 

      still, I have a problem with the returned file  encoding content
      example :  

      original content : ©1'÷õ"å

      returned content : �1'��"�

      • Hafedh_Elfaleh's avatar
        Hafedh_Elfaleh
        Ideator I

        Even via postman I got the same problem with content-encoding 

    • v-abankar's avatar
      v-abankar
      Ideator I

      Thanks, This code I used for read the image file from  Production server.

  • I have similar questions about the down load of file via the REST interface, I have a little python program which uses the method suggested by Christopher Gillis, below.

    Eli Donahue article title "Uploading Files via Aras RESTful API" is very helpful.

    The documentation does not talk about transaction method for downloading only up loading. Some of the we are playing are very in the order of 500MB so I expect totake quite a while.

     The other question is about the encoding methods which are used you point to W3 page which talks about HTML URL Encode but it does not give it a name like base64 encoding.

     I have downloaded plain text file with no problems, but pdf file have binary character and these cause a problem. Any suggestion as to type of encoding/decoding I should be looking for, it would be nice  down loaded from the body test was a

    json { "encoded": "base64", "data" : "asdfghjk ..etc"

    There is binary data in pdf file which gets corrupted. 

    • Hafedh_Elfaleh's avatar
      Hafedh_Elfaleh
      Ideator I

      same here , I have a problem with the returned file  encoding content
      example :  

      original content : ©1'÷õ"å

      returned content : �1'��"�