[API v4] "Create project": Tags parameter is missing in the API
1.Without Tags: successfull API call
git_repository_description="This is a test"
# Replacing all reserved characters by percent encoded ones in string variable
git_repository_description=$(http-encode-url.sh "$git_repository_description")
curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_API_PRIVATE_TOKEN}" "https://gitlab.com/api/v4/projects?name=Test1&issues_enabled=true&visibility=private&description=${git_repository_description}"
{"id":3387827,"description":"This is a test","default_branch":null,"tag_list":[],"archived":false,"visibility":"private","ssh_url_to_repo":"git@gitlab.com:jean-christophe-manciot/test1.git","http_url_to_repo":"https://gitlab.com/jean-christophe-manciot/test1.git","web_url":"https://gitlab.com/jean-christophe-manciot/test1","owner":{"name":"Jean-Christophe Manciot","username":"jean-christophe-manciot","id":465038,"state":"active","avatar_url":"https://gitlab.com/uploads/user/avatar/465038/Visage_250x250.jpg","web_url":"https://gitlab.com/jean-christophe-manciot"},"name":"Test1","name_with_namespace":"Jean-Christophe Manciot / Test1","path":"test1","path_with_namespace":"jean-christophe-manciot/test1","container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"created_at":"2017-05-27T13:26:53.061Z","last_activity_at":"2017-05-27T13:26:53.061Z","shared_runners_enabled":true,"lfs_enabled":true,"creator_id":465038,"namespace":{"id":547098,"name":"jean-christophe-manciot","path":"jean-christophe-manciot","kind":"user","full_path":"jean-christophe-manciot"},"avatar_url":null,"star_count":0,"forks_count":0,"open_issues_count":0,"runners_token":"WYHzWJuJiai1Q4KupWue","public_jobs":true,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"approvals_before_merge":0}
2.With Tags: dismissed tags in the API response
git_repository_description="This is a second test"
git_repository_tags="tags, test2"
# Replacing all reserved characters by percent encoded ones in string variables
git_repository_description=$(http-encode-url.sh "$git_repository_description")
git_repository_tags=$(http-encode-url.sh "$git_repository_tags")
curl --request POST --header "PRIVATE-TOKEN: ${GITLAB_API_PRIVATE_TOKEN}" "https://gitlab.com/api/v4/projects?name=Test2&issues_enabled=true&visibility=private&description=${git_repository_description}&tag_list=${git_repository_tags}"
{"id":3387832,"description":"This is a second test","default_branch":null,"tag_list":[],"archived":false,"visibility":"private","ssh_url_to_repo":"git@gitlab.com:jean-christophe-manciot/test2.git","http_url_to_repo":"https://gitlab.com/jean-christophe-manciot/test2.git","web_url":"https://gitlab.com/jean-christophe-manciot/test2","owner":{"name":"Jean-Christophe Manciot","username":"jean-christophe-manciot","id":465038,"state":"active","avatar_url":"https://gitlab.com/uploads/user/avatar/465038/Visage_250x250.jpg","web_url":"https://gitlab.com/jean-christophe-manciot"},"name":"Test2","name_with_namespace":"Jean-Christophe Manciot / Test2","path":"test2","path_with_namespace":"jean-christophe-manciot/test2","container_registry_enabled":true,"issues_enabled":true,"merge_requests_enabled":true,"wiki_enabled":true,"jobs_enabled":true,"snippets_enabled":true,"created_at":"2017-05-27T13:28:09.894Z","last_activity_at":"2017-05-27T13:28:09.894Z","shared_runners_enabled":true,"lfs_enabled":true,"creator_id":465038,"namespace":{"id":547098,"name":"jean-christophe-manciot","path":"jean-christophe-manciot","kind":"user","full_path":"jean-christophe-manciot"},"avatar_url":null,"star_count":0,"forks_count":0,"open_issues_count":0,"runners_token":"KaW83uMFyEaxMRFpq1yc","public_jobs":true,"shared_with_groups":[],"only_allow_merge_if_pipeline_succeeds":false,"request_access_enabled":false,"only_allow_merge_if_all_discussions_are_resolved":false,"approvals_before_merge":0}
As you can see, the "tag_list" is empty in the response and in the API documentation, but present on the browser project settings page in a manually created project:
Edited by Jean-Christophe Manciot