Download image from API

Hi !

I’d like to know if there is a way to fetch an image (mostly issue images).

When fetching data from the API, I get the image URL but this image can not be displayed, let’s say in a web front.

If I try a curl command with my API token, I get an authentication error (witch is kind of normal, given that the images are not on a “API url”)

$ curl --header "Private-Token: MyPrivateToken" https://gitlab.example.com/uploads/622ce6444a3c55ef88888d597ba444444/image.jpg
You need to sign in or sign up before continuing.

Any way to do that ?

Thanks

1 Like

+1
I can’t manage to have this working, nor with the PRIVATE-TOKEN authentification, nor Authorization + bearer…

Can anyone help us ?

This used to work before… I can’t manage to see when this stopped working…

With GitLab 15.5, you can enable direct access (i.e. without authentication) to media content , including issue images:

  • On project page, click on Settings/General
  • Go to " Visibility, project features, permissions" section, expand if needed
  • Unselect the checkbox “Require authentication to view media files”
1 Like

Hey,

What if we want to maintain authentication but still fetch the images? Is there any way?

I tried to make some authenticated request without success