GitLab API: upload projects avatar

2019-07-16 07:11发布

问题:

Is it possible to upload an avatar for a specific project?

I could not find anything about this in the documentation.

回答1:

You can upload a file then set the avatar url.

See edit-project docs for how to set the avatar URL.

https://docs.gitlab.com/ce/api/projects.html#edit-project

...
"avatar_url": "http://example.com/uploads/project/avatar/4/uploads/avatar.png"
... 


回答2:

It is true that 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.



标签: gitlab