1

I am trying to write some scripts which will create files(json) in Bitbucket Server and occasionally update these files. Later on I would like to be able to query the changes made to the files and what was added/removed.

For now i have been testing with the CURL examples on the API documentation provided by the product vendor. I have been able to create a new file, however i notice to update this file, you need to specify the sourceCommitId.

My question is, how do I get this sourceCommitId, if I don't know it and just know the file name?

How do I achieve this?

If I look at the documentation, there is an option to specify path, however if i put the file path from bitbucket it returns nothing.

e.g. GET /rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits?path="filepath"

Documentation: https://developer.atlassian.com/server/bitbucket/rest/v811/api-group-repository/#api-api-latest-projects-projectkey-repos-repositoryslug-commits-get

1 Answer 1

1

This is resolved, there needs to be a slash after commits, the query structure is like this -

GET /rest/api/latest/projects/{projectKey}/repos/{repositorySlug}/commits/?path="filepath"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.