Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,459,226
Community Members
 
Community Events
176
Community Groups

API Error When Creating Pipeline Schedule

Hello everyone,

I'm attempting to create a schedule for one of my repositories pipelines using this request:

curl -X POST -u '$USER:$PASSWORD' \
https://api.bitbucket.org/2.0/repositories/$WORKSPACE/$REPO/pipelines_config/schedules/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"type": "pipeline_schedule",
"enabled": true,
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "stage"
}
},
"cron_pattern": "45 23 28 * *"
}'

However I keep getting this response:

{"error": {"message": "Request entity cannot be processed", "detail": "Unexpected response body", "data": {"key": "unexpected.response.body", "arguments": {}}}}

Does anyone have an idea of what I'm doing wrong?

Thank you

1 answer

1 accepted

Okay was talking to Bitbucket support in a ticket I submitted and with their guidance I was able to get this to work:

1. The Pipeline Schedules use an extended cron format (this is not documented in the API reference):

sec min hour day-of-month month day-of-week year

2. You need to use the "?" symbol instead of the "*" when leaving day-of-month or day-of-week blank

Armed with that knowledge the following request actually works and creates a pipeline schedule that runs at 4:45 UTC on the 28th day of every month

curl -X POST -u '$USER:$PASSWORD' \
https://api.bitbucket.org/2.0/repositories/$WORKSPACE/$REPO/pipelines_config/schedules/ \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"type": "pipeline_schedule",
"enabled": true,
"target": {
"ref_type": "branch",
"type": "pipeline_ref_target",
"ref_name": "master",
"selector": {
"type": "custom",
"pattern": "stage"
}
},
"cron_pattern": "0 45 4 28 * ? *"
}'

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events