Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
Level
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Cannot add known host via BitBucket API

Using the BitBucket API, I'm trying to

POST repositories/{user}/{slug}/pipelines_config/ssh/known_hosts/

with this json in the body:

{"hostname":"my.hostname.nl"} 

 The API responds with a

HTTP 400 Bad Request
{"error": {"message": "Bad request", "detail": "The request body contains invalid properties", "data": {"key": "variable-service.request.validation-error", "arguments": {}}}}

I also tried to include the fields that I get when I GET known hosts added manually, but the response stays the same. 

1 answer

1 accepted

0 votes
Answer accepted

Hello @John van Terheijden,

The payload looks incomplete, besides hostname it should also contain the metadata about the public key of that hostname, for instance:

{
"hostname": "bitbucket.org",
"public_key": {
"key": "AAAAB3NzaC1yc2EAAAABIwAAAQEAubiN81eDcafrgMeLzaFPsw2kNvEcqTKl/VqLat/MaB33pZy0y3rJZtnqwR2qOOvbwKZYKiEO1O6VqNEBxKvJJelCq0dTXWT5pbO2gDXC6h6QDXCaHo6pOHGPUy+YBaGQRGuSusMEASYiWunYN0vCAI8QaXnWMXNMdFP3jHAJH0eDsoiGnLPBlBp4TNm6rYI74nMzgz3B9IikW4WVK+dc8KZJZWYjAuORU3jc1c/NPskD2ASinf8v3xnfXeukU0sJ5N6m5E8VLjObPEO+mN2t/FZTMZLiFqPWc/ALSqnMnnhwrNi2rbfg/rd/IpL8Le3pSBne8+seeFVBoGqzHM9yXw==",
"key_type": "ssh-rsa",
"md5_fingerprint": "md5:97:8c:1b:f2:6f:14:6b:5c:3b:ec:aa:46:46:74:7c:40",
"sha256_fingerprint": "SHA256:zzXQOXSRBEiUtuE8AikJYKwbHaxvSc0ojez9YXaGp1A",
"type": "pipeline_ssh_public_key"
}
}

Hope this helps.

Cheers,
Daniil

Hi @Daniil Penkin

Yea, that works! I tried before with those fields, but it returned an internal error. Are there any checks on the values that could cause that?

Thanks anyway!

By internal error did you mean 500 HTTP response? If so, it would be interesting to find out and fix/improve error reporting. Can you advise when did you try this, roughly?

I'm not sure about the validation for this endpoint, need to clarify with the team next week.

Cheers,
Daniil

May the api repo wiki should mention what is mandatory and what is not, I am not sure where a user can find 

"type": "pipeline_ssh_public_key"

This details are not available in the API wiki. 

Screenshot 2020-04-28 at 4.14.00 PM.png

 

"public_key": {

 

 

Can't find where it mentioned the public_key section in the request sample.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Calling any interview participants for Bitbucket Data Center

Hi everyone,  We are looking to learn more about development teams’ workflows and pain points, especially around DevOps, integrations, administration, scale, security, and the related challeng...

505 views 6 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you