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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


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
Community Members
Community Events
Community Groups

How to retrieve the contents of a file from a feature branch using the REST api?


Hello. This is probably simple, but for some reason it's got me stymied.

I have a repo with three branches.

I have a branch called "master"
If I curl against
I get the contents of my file for the master branch.
That's good.

I have a branch called "dev"
If I curl against
I get the contents of my file for the dev branch.
That's good.

I have a branch called "feature/my-new-feature"
If I curl against
I get 404 NOT FOUND, and the body of the returned message contains an error saying "message": "Commit not found"
That's confusing.

If I look at the documentation for the form of the API I'm trying to use:
/repositories/{username}/{repo_slug}/src/{node}/{path} described at
And look at the Path Parameters section where "node" is described (which in my case I assume maps to "feature/my-new-feature"?)
The description says "(No Description)", which doesn't get me anywhere.

If I curl
I get back json that includes information on the latest commit (I think), I can dig the commit SHA1 out of the target.hash value and then
curl{commit SHA}/
and get the, but I need to be able to accomplish this with a single URL (It's an input to a deployment tool and I don't have the option of digging around the json and formatting a 2nd request).

Does anybody know why I can't do the above?


2 answers

1 accepted

0 votes
Answer accepted
seanaty Atlassian Team Apr 03, 2022

Hey @NickP I just happened on this issue and the reason it wasn't working was because of the slash in the branch name. There's a public issue for it here with a ton more information about why it exists, some workarounds and some possible long term fixes.

Oh, wow. It's been a while. Thanks and I'll accept this as the answer. We're not trying to deploy feature branches at this point anyway (at least not via the mechanism that I was testing when I posted this).

An update on this, for anyone who might be interested. I discovered that if I create my new branch my-new-feature as NOT a "feature" branch (In the Create Branch window leave the default Type as Other). I can then then curl my files, works. So it seems to be something to do with it being a "feature" branch. I haven't tried with Bugfix, Hotfix, or Release.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events