I have successfully modified pipeline variables with the API. Now I am trying to create a new pipeline variable using the API.
According to the documentation you should be able to create a new one using /2.0/repositories/{workspace}/{repo_slug}/pipelines_config/variables/
The "request example" shows the inclusion of a pipeline variable uuid but since the variable does not exist, I do not have a uuid.
$ echo $request_body{ "key": "test", "value": "setMe", "secured": "false" }$ curl -X PUT -u "$BB_API_AUTH" https://api.bitbucket.org/2.0/repositories/workspace/repo/pipelines_config/variables -d "$request_body"{"type": "error", "error": {"message": "Resource not found", "detail": "There is no API hosted at this URL.\n\nFor information about our API's, please refer to the documentation at: https://developer.atlassian.com/bitbucket/api/2/reference/"}}
I've tried with and without a slash after 'variables'.
$ curl -X PUT -u "$BB_API_AUTH" https://api.bitbucket.org/2.0/repositories/workspace/repo/pipelines_config/variables/ -d "$request_body"{"type": "error", "error": {"message": "Method not allowed"}}
How can I create a new pipeline variable?
@Mary Sipple in the second case you're using right url with / (https://api.bitbucket.org/2.0/repositories/workspace/repo/pipelines_config/variables/) , but somewhy use PUT http method.
PUT method is for existing resource, that means, for existing variable, if you want to change its value, for example.
To create a variable you have to use POST method for that
Regards, Galyna
Of course! Thank you so much. It's working now.
Regards, Mary
It looks like you're new here. Sign in or register to get started.