Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to create tag request in Atlassian Bitbucket using curl REST API

Vladut Moraru
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 1, 2022

I want to create a tag for a specific branch, but I have the following error:

{"errors":[{"context":null,"message":"Can not instantiate value of type [map type; class com.atlassian.stash.internal.rest.repository.RestCreateTagRequest, [simple type, class java.lang.String] -> [simple type, class java.lang.Object]] from JSON String; no single-String constructor/factory method","exceptionName":"org.codehaus.jackson.map.JsonMappingException"}]}== Info: Closing connection 0 == Info: schannel: shutting down SSL/TLS connection with code.waters.com port 443

I using this curl command for posting the tag:

curl -X POST -u <<USER>>:<<PASSWORD>> -H "Content-Type: application/json" -v --trace - -d """{"name":"TAG_CURL_TEST_01","target":{"hash":"dd0ad6f53a9ca318b1441ed1XXXXXXXX"}}""" https://HOSTNAME/bitbucket/rest/api/1.0/projects/{project-id}/repos/{repo-id}/tags

Json:

size 25 limit 25 isLastPage false values 0
id "refs/tags/NG930_WSM210_20220712_B15" displayId "NG930_WSM210_20220712_B15" type "TAG" latestCommit "c85f121e9841489949baa789a2090c37c2826485" latestChangeset "c85f121e9841489949baa789a2090c37c2826485" hash "2fef60e14fa60462e00673150b658cf6b910a841"

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 11, 2022

Hi Vladut,

Welcome to the Bitbucket Cloud community!

Based on the request, you are wanting to create a tag in Bitbucket Cloud using our API endpoint.
The endpoint you are using is incorrect however, you will need to use the endpoint contained here:
https://developer.atlassian.com/cloud/bitbucket/rest/api-group-refs/#api-repositories-workspace-repo-slug-refs-tags-post

Hope this helps.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

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

Atlassian Community Events