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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

rest api to retrieve content of file

I am trying to migrate code that we wrote against gitlab to stash (3.1), one of these is a rest request to get the content as a file.


 This return the content as a set of lines: 

  "lines": [
      "text": "{"
      "text": "  \"name\": \"my-project\","
  "start": 0,
  "size": 3,
  "isLastPage": false

Is there a way to return the raw contents(text, base64) of the file instead of having text-text lines?

Also i can't tell from the rest api how to create or update just a file. 

2 answers

1 vote
Jeff Thomas Atlassian Team Dec 15, 2015

You may not be able to get the raw contents of the file from the REST API, but it's available if you tack on ?raw to the full URL of the file. For example, hitting https://{my-host}/projects/CLOUD/repos/myrepo/browse/package.json?raw should return the raw contents of that file.

Thanks!  Spent a lot of time trying to use the REST API to get the raw file, until I read this post.

0 votes

Just use 'raw' in place of 'browse' and it should work. 


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

2,564 views 1 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you