API: can't seem to create repositories (BB-1356)

Issue #2548 resolved
Steve Streeting
created an issue

I can list repositories over the API (including private ones) just fine, but I've been trying to use it to create repositories with no luck.

I've tried following the docs, but it never seems to work. For example this:

curl -uuser:password -X POST -d "name=testapicreate" https://api.bitbucket.org/1.0/repositories/

.. just dumps a stack trace: {{{


Piston/0.2.3rc1 (Django 1.2.5) crash report:

Traceback (most recent call last):

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/local/env/lib/python2.7/site-packages/django_piston-0.2.3rc1-py2.7.egg/piston/utils.py", line 91, in wrap if form.is_valid():

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/local/env/lib/python2.7/site-packages/django/forms/forms.py", line 121, in is_valid return self.is_bound and not bool(self.errors)

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/local/env/lib/python2.7/site-packages/django/forms/forms.py", line 112, in _get_errors self.full_clean()

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/local/env/lib/python2.7/site-packages/django/forms/forms.py", line 267, in full_clean self._clean_fields()

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/local/env/lib/python2.7/site-packages/django/forms/forms.py", line 287, in clean_fields value = getattr(self, 'clean%s' % name)()

File "/opt/python/domains/bitbucket.org/2010-09-28/bitbucket/../bitbucket/apps/bb/forms.py", line 44, in clean_name if Repository.objects.filter(owner=self.user,

AttributeError: 'RepositoryForm' object has no attribute 'user' }}}

Assistance would be welcome.

Comments (7)

  1. Steve Streeting reporter

    Thanks for the response!

    Do you have a rough idea of when this might be addressed? I'm releasing a product (or rather and update to a product) which will support the Bitbucket/Kiln/GitHub APIs later this month and this is quite an important part of it. If your release schedules mean it will be more than a week or two before it's fixed then I know I need to plan around that and disable this feature for Bitbucket for the moment.

    Cheers Steve

  2. Steve Streeting reporter

    Awesome, thanks! I just tested it here and it worked.

    FYI, the docs here seem to have changed: http://confluence.atlassian.com/display/BBDEV/Repositories, and I believe they're now incorrect. They now say 'this will create a private repository' for the example that just provides a 'name' parameter, but this in fact creates a public one. To create a private one you have to set 'is_private=1'. I also discovered you can set other values like 'description', it would be worth mentioning this in the docs.

  3. Log in to comment