Skip to main content
Solved

How download file in resources path using rest api

  • January 8, 2019
  • 5 replies
  • 176 views

I try download file in resources path using rest api, using get method:

http://myhost/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/geodados/Bairro_Popular.zip?fmetoken=2c537eb21c3ff7b5e0d64be0d6a02b10f149a5b5

 

but my response is:

"message":"null for uri: http://myhost/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/geodados/Bairro_Popular.zip?fmetoken=2c537eb21c3ff7b5e0d64be0d6a02b10f149a5b5"}

My file is in Resources > Data geodados > Bairro_Popular.zip

My user has permissions.

 

Does anyone know the reason for the error?

Best answer by david_r

I do it using the following API endpoint:

http://<host>/fmerest/v3/resources/connections/<resource>/filesys/<filename>

Notice the "filesys" part between the resource name and the filename. And I'm also using the following headers:

Authorization: fmetoken token=...
Accept: application/octet-stream

Note that I do not put the token in the URL.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

david_r
Celebrity
  • Best Answer
  • January 8, 2019

I do it using the following API endpoint:

http://<host>/fmerest/v3/resources/connections/<resource>/filesys/<filename>

Notice the "filesys" part between the resource name and the filename. And I'm also using the following headers:

Authorization: fmetoken token=...
Accept: application/octet-stream

Note that I do not put the token in the URL.


itay
Supporter
Forum|alt.badge.img+18
  • Supporter
  • January 8, 2019

Hi @tiagocnorberto,

The REST API training manual is a good place to start with FME Server REST.

Hope this helps,

Itay


david_r
Celebrity
  • January 8, 2019

I do it using the following API endpoint:

http://<host>/fmerest/v3/resources/connections/<resource>/filesys/<filename>

Notice the "filesys" part between the resource name and the filename. And I'm also using the following headers:

Authorization: fmetoken token=...
Accept: application/octet-stream

Note that I do not put the token in the URL.

More details in the API documentation: https://docs.safe.com/fme/html/FME_REST/apidoc/v3/#!/resources/download_get_9


danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • January 8, 2019

Hi @tiagocnorberto

I agree with @itay and @david_r.

The API documentation and the REST API training manual are very interesting to help in this case.

 

Please, tell us the solution or not your Question.

 

Thanks,

Danilo

 


In my url, was missing "filesys". Now is working!! Thank you!!

My correct url is:

Using get method:

http://myserver/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/geodados/Bairro_Popular.zip?fmetoken=mytoken

Using post

http://myserver/fmerest/v3/resources/connections/FME_SHAREDRESOURCE_DATA/filesys/geodados/Bairro_Popular.zip

Headers:

  1. Authorization: fmetoken token=...
  2. Accept: application/octet-stream

 

My file it's at : Resources > Data > geodados > Bairro_Popular.zip

 

Thanks,