I was following the API docs https://docs.atlassian.com/bitbucket-server/rest/6.10.0/bitbucket-rest.html?_ga=2.33858657.1166200213.1595259633-444055661.1594387875#idp347. but it seems that is not working for Private Enterprise Bitbucket Servers.
What I found that for Enterprise, the API access is formed in the way
{my-private-bibucket-server}//rest/api/latest/projects/{project-id}/repos/{repo-id}/
I was able to fetch tags by using
GET {my-private-bitbucket-server}/rest/api/latest/projects/{project-id}/repos/{repo-id}/tags
However, when I try to do a POST
post {my-private-bitbucket-server}/rest/api/latest/projects/{project-id}/repos/{repo-id}/tags
with the body
{
"name" : "test-tag",
"startPoint
" : {
"hash" : "<some hash value>"
}
}
it doesn't work
I am using powershell
Hi there!
I'd love to help out here but am interested in what error you're getting. Fairly regularly when people try to switch from a GET to a POST (at least in Postman), the Content-Type header doesn't get set. If it isn't there, Bitbucket will respond with a 415 Unsupported Media Type error.
If you're using the Invoke-RestMethod cmdlet in Powershell, adding the ContentType flag should patch up error 415:
-ContentType 'application/json'
Now if you're getting a 500 Internal Server Error for your request, I think it's because the structure isn't quite what Bitbucket Server is looking for. Try this body instead:
{
"name" : "test-tag",
"startPoint" : "<some hash value>"
}
I did get it working - Ended up being you can not have any spaces in the tag name.
Would be nice to have better error handling, Or have that info in the documentation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,I was following the API docs https://docs.atlassian.com/bitbucket-server/rest/6.10.0/bitbucket-rest.html?_ga=2.33858657.1166200213.1595259633-444055661.1594387875#idp347 to create tag.
I was able to fetch tags by using GET in postman
But when I try to do POST, I get 500 Internal Server Error
I was confused
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.