im trying to add labels with MR update API Merge requests API | GitLab
Invoke-RestMethod -Method PUT -Headers @{ 'PRIVATE-TOKEN'= $CI_TOKEN } -Body @{ add_labels = "Needs Version Bump"} -Uri "$CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID" -ContentType 'application/json'
But server returns
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
Does anybody know what’s wrong?
gitlab 14.2
$CI_MERGE_REQUEST_IID = 185
$CI_TOKEN is ok I’m using it successfully for POST and GET requests from CI
edit:
proper call is
Invoke-RestMethod -Method PUT -Headers @{ ‘PRIVATE-TOKEN’= $CI_TOKEN } -Body (@{ add_labels = “Needs Version Bump”} | ConvertTo-JSON) -Uri “$CI_API_V4_URL/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID” -ContentType ‘application/json’