I rely on Bitbucket’s API heavily to manage repositories at iThemes. Recently, some of the API calls started to fail and returned nonsensical error messages.
When making a PUT
request to the /1.0/repositories/TEAM/SLUG
endpoint, I received an error response with a status code of 400 and the following message:
<ul class="errorlist"><li>project<ul class="errorlist"><li>Select a valid choice. That choice is not one of the available choices.</li></ul></li></ul>
This message makes no sense as the documentation for that endpoint has no mention of a parameter named project
.
Going directly to bitbucket.org and trying to create a new repository there revealed that a new, required Project input is now on the form. This explains where the error message is coming from. It looks as though they added the new parameter to the repositories, made it mandatory, and updated the API endpoint to reflect this new mandatory parameter, but failed to update the documentation or to have any backwards-compatible support.
I found that supplying the project
parameter with a value of PROJ
(the default value in the form) got rid of the error message.
Did I help you?