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

Rest API deployment is not working

Saman Priyantha September 22, 2019

Rest API endpoint for deployment details

https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/deployments/

I tried to call to above api endpoint using my workspace id but it returned

{"type": "error", "error": {"message": "workspace"}}

 Could someone please help me to resolve this issue?

Basically I want to get deployment details of the pipeline through API endpoint for my deployment rate report. 

My GET url : https://api.bitbucket.org/2.0/repositories/{workspace id}/{repo_slug}/deployments/

1 answer

1 accepted

1 vote
Answer accepted
Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 3, 2019

Hi Saman,

Is your workspace id the same as your username? If not, could you try using your username instead of your workspace id in the url and let me know if that makes any difference?

Saman Priyantha October 7, 2019

Hi Steven,

Thanks for the reply.

I tried with my username instead of my workspace id, but it returned same error.

This is the url I have tried.

/2.0/repositories/{workspace}/{repo_slug}/deployments/

If my workspace is "saman"and repo_slug is "project1.git" then url will be 

/2.0/repositories/saman/project1.git/deployments/

Is it correct? 

It is not clearly mention in the document too. It says path parameters are username and repo_slug. and description of username is "The account."

 

Deployment API.jpg

I tried deployment endpoint with the sample project of the bitbucket API documentation and it worked as expected.

https://api.bitbucket.org/2.0/repositories/jeroendr/meat-demo2/deployments/

Could you please help me to resolve this issue?

Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 7, 2019

Can you see your deployments from the "deployments" page in the Bitbucket UI, or does that also fail? The UI uses the same endpoint that you're trying to use, so if the UI works then you should be able to find the correct URL by looking at the request that the UI makes (eg. using your browser's "dev tools" window).

Like Saman Priyantha likes this
Saman Priyantha October 8, 2019

Hi Steven,

I found the issue, when analyzing the api requests of UI.

I used repo_slug as "project1.git", but it should be passed as "project1".

Thank you very much for your support.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events