Image URL permission denied with API

I have just started to use the SeaTable API and I have been able to return rows from my tables. I have hit an issue where I receive the image URL but if I use the url, I get a permission denied error. What I am confused about is how can I use the provided URL and display it in my application using the API? Is there a way to add parameters to the url to make this work? Another API call required? Thanks in advance for your help!

SeaTable is not intended for hosting and serving images for your web pages. So, to achieve what you want, you can store the images in public image hosting service (like AWS S3), and store the link in SeaTable. In this way, you can use the links directly in your web pages.

Yes, I completely agree if I was creating a website. I am using the API for an application and the images are thumbnails. The URLs are there from the image type column. If you access those url strings, you will receive a permissions denied error.
I have to assume I need to download them first using the API and the given url?

Yes. There is an API to get download link from the URL with your access token.

What is the API endpoint?? i looked through the docs and could not find an API endpoint that gave you a download URL… The only thing I found was how to use python to do this…

Side question. Is the same restriction in place for attachments.?

Hey tomt92,

let me attempt to explain how SeaTable and API works here.

Image you have a simple base with two columns and you have an api token to get access to this base.
image

Now you want to use these pictures at a website - like we do on Templates - SeaTable. These pages are generated from a seatable base.

Here is what you have to do:

Step 1: get the base access token from the api-token

Your first api call is to get the access_token and the dtable_uuid from this base you want to access. Here is the link to the api documentation of SeaTable: SeaTable API Reference

Here is how the call will look like…

curl --location --request GET 'https://cloud.seatable.io/api/v2.1/dtable/app-access-token/' \
--header 'Accept: application/json; charset=utf-8; indent=4' \
--header 'Authorization: Token c6326fed58becfb89d960269ea0baf80a0f8607a'

Step 2: get all the rows from the base

now with these access_token and the dtable_uuid you can get all the rows of the base. Here is the link to the documentation: SeaTable API Reference

This is how the call could look like:

curl --location --request GET 'https://cloud.seatable.io/dtable-server/api/v1/dtables/13f8a577-4377-4d0c-bf0c-d1ffcb4a5ad0/rows/?table_name=Table1' \
--header 'Authorization: Token here-comes-the-long-access-token'

As a result, you get the URLs to the images, but these do not help. Only If you are logged in, you get access to these images. These urls can not be used to show the images on the homepage.

... {"rows":[{..."Image":["https://cloud.seatable.io/workspace/13/asset/13f8a577-4377-4d0c-bf0c-d1ffcb4a5ad0/images/2022-03/receipt_plan.jpg"]},...}

Step 3: get the real download links of these images

You need the first api-token and the file url to get a download-link for these images. Here is the link to the documentation: SeaTable API Reference.

This is how such a call will look like

curl --location --request GET 'https://cloud.seatable.io/api/v2.1/dtable/app-download-link/?path=/images/2022-03/receipt_plan.jpg' \
--header 'Authorization: Token c6326fed58becfb89d960269ea0baf80a0f8607a' \
--header 'Accept: application/json; indent=4'

This will give you a “download link” to the images. This link can be used to show the images on the website.

{
    "download_link": "https://cloud.seatable.io/seafhttp/files/b67995fa-dc80-4146-a7bc-6e2d3b1864a6/receipt_plan.jpg"
}

Important hint regarding API limits

Now I hope it becomes clearer to you. Please be aware that as soon as you have many images, you have to watch out not to reach the API limits: System Limitations - SeaTable Admin Manual

Imagine you have 30 pictures you want to show on your website that are downloaded from SeaTable. If you download the pictures every time the page is loaded, then you can only show the page 20 times per hour. After that, the API limit will kick in.

Therefore: try to cache or download the pictures instead of requesting every time the download link.

Best regards
Christoph

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.