Hello everyone!
I am having trouble figuring out how one can reference branches with the forward slash / character in the name while making API calls.
When using URL encoding, Bitbucket will assume that the encoded forward slash (%2F) is a path parameter delimiter.
A simple example: trying to access README.md on a branch called "feature/test" with the following command will fail, as Bitbucket will try to access it on the non-existent "feature" branch, and will assume "test" is part of the path.
Request: curl 'https://api.bitbucket.org/2.0/repositories/my-workspace/myrepository/src/feature%2Ftest/README.md'
Response: {"data":{"shas":["feature"]},"type":"error","error":{"message":"Commit not found","data":{"shas":["feature"]}}}
Is there any workaround for this? Because I've been searching for similar issues and so far haven't come up with anything.
Oh, probably shouldn't be holding my breath over this one...
https://jira.atlassian.com/browse/BCLOUD-20223
Anyone know of a workaround?
Work around is to make 2 API calls. Use the branch API to get the current commit of that branch, then use the current commit to call the source API.
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.
@seanaty Thank you very much, it worked for me.
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.