Hi, Is it possible to use OAuth2.0 to trigger a pipeline like this:
curl --location --request POST 'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/' \
--header 'Authorization: Bearer XXXXXXX' \
--header 'Content-Type: application/json' \
--data-raw '{
"target": {
"type": "pipeline_ref_target",
"ref_type": "branch",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "my-custom-pipeline"
}
}
}'
Hi @Ikram Karouche and welcome to the community!
It is possible to use OAuth, but you also need to use the API URL in your call. So, instead of
'https://bitbucket.org/{workspace}/{repo_slug}/pipelines/'
you need to use
'https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/pipelines/'
Please feel free to let me know if this works for you or if you experience any issues. If you get any errors, please post the call you are using (make sure to mask any private/sensitive values) and the output of the call, so we can better help you.
Kind regards,
Theodora
Thank you for your response, it works !
but I m not sure if I can receive automatic email notification when the triggered pipeline fails. I can't find this in the documentation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
That's good to hear and you are very welcome!
Notifications are sent if you subscribe to them.
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.