Solved

How download file in resources path using rest api

  • 8 January 2019
  • 5 replies
  • 43 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?

icon

Best answer by david_r 8 January 2019, 16:22

View original

5 replies

Userlevel 4

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.

Badge +16

Hi @tiagocnorberto,

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

Hope this helps,

Itay

Userlevel 4

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

Userlevel 4
Badge +30

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,

Reply