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

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

Bitbucket api examples to create a file in bitbucket Edited

Trying to use post method to create a file in bitbucket using bitbucket api and getting 415  unsupported media.

please find the curl command 

Curl  command:  curl -X POST \
https://bitbucket-fof.appl.******/rest/api/1.0/projects/DCP/repos/policies \
-H 'Accept: */*' \
-H 'Accept-Encoding: gzip, deflate' \
-H 'Authorization: Basic ********' \
-H 'Cache-Control: no-cache' \
-H 'Connection: keep-alive' \
-H 'Content-Length: 169' \
-H 'Content-Type: multipart/form-data; boundary=--------------------------919644441165932680909311' \
-H 'Host: bitbucket-fof.appl.******' \
-H 'cache-control: no-cache' \
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW' \
-F file=/nss/1.txt

 

Response:

415Unsupported Media Type

1 answer

0 votes
DPK J Community Leader Nov 18, 2019

@samyuktha ramireddyWelcome to the community.

  • This error occur when incorrect or no 'Content-Type' is defined for API call.
  • So I suggest you to add, 'Content-Type' header to your API request.

If this doesn't help, please share your API request (CURL or Code you are using to make request) for swift diagnosis and resolution.

i have added the curl command above. i have provided the accurate content-type header but still the response is 415 un supported media type.

Suggest an answer

Log in or Sign up to answer
TAGS
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 ...

1,892 views 0 7
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