tinybucket icon indicating copy to clipboard operation
tinybucket copied to clipboard

Hooks api

Open falexandrou opened this issue 8 years ago • 6 comments

falexandrou avatar Dec 10 '16 16:12 falexandrou

Coverage Status

Coverage increased (+0.2%) to 94.908% when pulling c099a4d8aade545bcc199d6675b6348ff4f44fde on falexandrou:hooks-api into 4f8b64a6d8e4959e2aa95e8bdba3729f34a1134d on hirakiuc:master.

coveralls avatar Dec 10 '16 16:12 coveralls

Coverage Status

Coverage increased (+0.2%) to 94.866% when pulling 08ba235811f38f1d33642ab1be0811735a29a4d2 on falexandrou:hooks-api into 4f8b64a6d8e4959e2aa95e8bdba3729f34a1134d on hirakiuc:master.

coveralls avatar Dec 10 '16 17:12 coveralls

I'll check this after merging #102. 👍

hirakiuc avatar Jan 08 '17 04:01 hirakiuc

Pushed updates regarding your comments. Feel free to review whenever you can

falexandrou avatar Jan 22 '17 19:01 falexandrou

I created a script to test each hooks API with real test repository on Bitbucket.

And I found these points.

(1) Bitbucket pipeline webhook can fetch via Repository#hooks, but can't fetch via Repository#hook.

Always Tinybucket::Error::NotFound raised when I fetch the hook via Repository#hook API.

I think this may be a Bitbucket API issue... 🤔

(2) I can't create my new hook via Repository#hooks#create.

Always error raised. 😳

# access_token is replaced with "my_access_token"
D, [2017-01-28T10:00:09.787664 #65829] DEBUG -- : [api.bitbucket.org] POST /2.0/repositories/altabjpworks/sandbox/hooks?access_token=my_access_token (0.812 s)
E, [2017-01-28T10:00:09.787773 #65829] ERROR -- : Invalid response code:500
/Users/hirakiuc/repos/src/github.com/hirakiuc/tinybucket/lib/tinybucket/response/handler.rb:18:in `on_complete': POST https://api.bitbucket.org/2.0/repositories/altabjpworks/sandbox/hooks?access_token=my_access_token 500 {"type": "error", "error": {"message": "No JSON object could be decoded", "id": "c66366d84f584274a08d01549ad95cb5"}} (Tinybucket::Error::ServiceError)

It looks like that the format of request parameter is invalid.

Can you create new hook to your Bitbucket repository via new Repository#hooks#create API?

hirakiuc avatar Jan 28 '17 01:01 hirakiuc

This looks like a bitbucket issue. in the past i managed to avoid these errors by explicitly setting the Content-Type header to application/json. Will check this though

falexandrou avatar Jan 28 '17 09:01 falexandrou