Set project avatar via GitLab API

howto
api

#1

Is it possible to upload an avatar for a specific project with the GitLab API?

I could not find anything about this in the documentation.

There is a parameter avatar_url within the response of an edit or list request but it is not included as a valid edit parameter.

The allowed parameters (referred to the docu) are the following:

  • id
  • name
  • path
  • default_branch
  • description
  • issues_enabled
  • merge_requests_enabled
  • builds_enabled
  • wiki_enabled
  • snippets_enabled
  • container_registry_enabled
  • shared_runners_enabled
  • public
  • visibility_level
  • import_url- id
  • name
  • path
  • default_branch
  • description
  • issues_enabled
  • merge_requests_enabled
  • builds_enabled
  • wiki_enabled
  • snippets_enabled
  • container_registry_enabled
  • shared_runners_enabled
  • public
  • visibility_level
  • import_url
  • public_builds
  • only_allow_merge_if_build_succeeds successful
  • only_allow_merge_if_all_discussions_are_resolved merged
  • lfs_enabled
  • request_access_enabled
  • public_builds
  • only_allow_merge_if_build_succeeds successful
  • only_allow_merge_if_all_discussions_are_resolved merged
  • lfs_enabled
  • request_access_enabled

I can not find any possibility to set an avatar_url.


#2

There is a field here --> https://docs.gitlab.com/ee/api/projects.html#create-project-for-user called avatar but I’m not clear about which format the file needs to be uploaded (Fileblob, url, data64). Docs only says mixed and I always get 400 Bad Request


#3

This might help: