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

Bitbucket api examples to create a file in bitbucket

samyuktha ramireddy November 18, 2019

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
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 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.

samyuktha ramireddy November 25, 2019

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
AUG Leaders

Atlassian Community Events