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

Create a commit by uploading a file API with query params won't work

Hi,

I'm trying to use the following API in order to update an existing feature branch's file.

I'm using Postman with the following request URL:  https://api.bitbucket.org/2.0/repositories/{workspace}/{repo_slug}/src?branch=<my-branch> with content-type as "application/x-www-form-urlencoded" as a header and with body as "x-www-form-urlencoded" with the following key-value for the desired file which I want to modify:
key: "/README.md"

value: "new-value"

when initiating the request I'm getting back 201 created status but the file that was modified is the readme file located on my "main" branch and not on my feature branch.

what am I missing here?

 

 

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 14, 2023

Hello @Nimrod Golan and thank you for reaching out to Community! 

The Create a commit by uploading a file endpoint expects the branch name to come as one of the key/value pair when using application/x-www-form-urlencoded. You can try to specify the key as branch and the value as the branch name : 

  • key: "branch"
  • value: "branch_a"

This should make the commit to be created on the top of the branch provided. 

Could you try that suggestion and let us know how it goes? 

Thank you, @Nimrod Golan !

Patrik S

That worked, thanks! maybe it's better refine it on the endpoint documentation.

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events