Hi,
I am trying create deploy-keys for a certain repository but it keeps giving me this response:
<Response [400]>
{"key": [{"message": "This field is required.", "code": "required"}]}
There is no reference in the documentation about this: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/deploy-keys#post
my setup:
NOTE: the ssh-key is the same as in the docs so no harm in showing, it is for testing.
import requests
import json
user = "******"
password = "*******"
repo = "******"
auth = requests.auth.HTTPBasicAuth(user, password)
host = "https://api.bitbucket.org"
headers = {"content-type": "application/json"}
payload = {
"code": 1,
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAK/b1cHHDr/TEV1JGQl+WjCwStKG6Bhrv0rFpEsYlyTBm1fzN0VOJJYn4ZOPCPJwqse6fGbXntEs+BbXiptR+++HycVgl65TMR0b5ul5AgwrVdZdT7qjCOCgaSV74/9xlHDK8oqgGnfA7ZoBBU+qpVyaloSjBdJfLtPY/xqj4yHnXKYzrtn/uFc4Kp9Tb7PUg9Io3qohSTGJGVHnsVblq/rToJG7L5xIo0OxK0SJSQ5vuId93ZuFZrCNMXj8JDHZeSEtjJzpRCBEXHxpOPhAcbm4MzULgkFHhAVgp4JbkrT99/wpvZ7r9AdkTg7HGqL3rlaDrEcWfL7Lu6TnhBdq5 mleu@C02W454JHTD8",
"label": "mydeploykey",
}
post = "/2.0/repositories/wegroupwolves/{repo}/deploy-keys".format(repo=repo)
r = requests.post(host + post, auth=auth, data=json.dumps(payload))
print(r, r.text