The Create a commit by uploading a file endpoint doesn't return anything. I need the commit hash that it has created. Is there a workaround for this?
Hi @Jonathan Li!
With curl, it is possible to add the -v option, as follows:
curl -u BitbucketUsername:AppPassword -v https://api.bitbucket.org/2.0/repositories/workspace-id/repo/src \
-F myFile.txt=@myFile.txt
When the -v option is added, the output will return, among other things, a line that looks like this:
< location: https://api.bitbucket.org/2.0/repositories/workspace-id/repo/commit/361fbb45757afc4056a400730bd6cf6fe3e77c07
The last part is the commit hash of the commit created by the API call.
Kind regards,
Theodora
If it doesn't return it, maybe you could get the refs from the repo right after you created the commit. Because you know to which branch you created the commit, you need the hash of the head of that branch.
(You could even get the branch itself from the REST API, but as far as I saw it won't return the hash either?!)
Anyway, it should give you an idea.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.