Does anyone know the parameters to create a POST service through the BitBucket API?

Currently the documentation is missing and there is an open ticket to write it. It follows the same format as the rest of the API, hoping someones figured it out.

So far the only parameter I can create is the type:

curl --user name:pw https://api.bitbucket.org/1.0/repositories/{account}/{repository}/services --data 'type={POST/Twitter/AgileZen/etc}'

Successfully creates an empty POST service.

Here's a link to the docs in case it helps.

有帮助吗?

解决方案

It's kinda shoddy that we failed to document that properly. Anyway, here's how you add a POST service that posts to google.com:

$ curl -X POST https://username:passwd@bitbucket.org/api/1.0/repositories/evzijst/interruptingcow/services \
    -d type=POST -d URL=http://google.com
{
    "id": 507781,
    "service": {
        "fields": [
            {
                "name": "URL",
                "value": "http://google.com"
            }
        ],
        "type": "POST"
    }
}

The way this endpoint works is that you always specify the "type" parameter which must contain the name of the service (as presented in the dropdown menu) and then configure it by passing additional post parameters.

Each service has its own configuration parameters. You can find out by simply adding the service on a repo and looking at the fields. Your parameters must match the available fields:

Configuration parameters

Individual parameters can be modified by doing a PUT.

其他提示

This is documented; just got lost in the shuffle when I revised everything:

https://confluence.atlassian.com/display/BITBUCKET/services+Resource

You can also test it out in our REST browser:

http://restbrowser.bitbucket.org/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top