0

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 Answers1

0

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"