Bitbucket cloud v2.0 api's only support reading file contents, but it does not appear to support creating a new file or modifying existing file content. Is that already available in some other form or planned for the future?.
Hello @ksaravan,
POST method on this endpoint allows to create, update and delete files: /2.0/repositories/{username}/{repo_slug}/src
Hope this helps.
Cheers,
Daniil
Thank you so much. I had a look at the documentation link, but i have another question on updating a file by 2 or more people at the same time on the same branch. Does Bitbucket cloud REST api detect and error out appropriately?.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries, happy to help.
I have another question on updating a file by 2 or more people at the same time on the same branch. Does Bitbucket cloud REST api detect and error out appropriately?
Yes, this is possible by specifying parents and branch query parameters accordingly. Some cases from the same endpoint documentation page:
- When a branch name is provided that already exists in the repo, then the commit will be created on top of that branch. In this case, if a parent SHA1 was also provided, then it is asserted that the parent is the branch's tip/HEAD at the time the request is made. When this is not the case, a 409 is returned.
- When a branch name is not specified, but a parent SHA1 is provided, then Bitbucket asserts that it represents the main branch's current HEAD/tip, or a 409 is returned.
- ...
There're more cases described there, this is just to give some context.
Let me know if you have any questions.
Cheers,
Daniil
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.