Skip to content

Instantly share code, notes, and snippets.

@ORESoftware
Created May 21, 2019 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ORESoftware/1ef3abe66dba23039ddd90fef1093318 to your computer and use it in GitHub Desktop.
Save ORESoftware/1ef3abe66dba23039ddd90fef1093318 to your computer and use it in GitHub Desktop.
push event payload from Bitbucket API

Here is a sample push payload from bitbucket API:

{
    "push": {
      "changes": [
        {
          "forced": false,
          "old": {
            "name": "master",
            "links": {
              "commits": {
                "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commits/master"
              },
              "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/refs/branches/master"
              },
              "html": {
                "href": "https://bitbucket.org/ntrs/jenkins-jobs/branch/master"
              }
            },
            "default_merge_strategy": "merge_commit",
            "merge_strategies": [
              "merge_commit",
              "squash",
              "fast_forward"
            ],
            "type": "branch",
            "target": {
              "rendered": {},
              "hash": "10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114",
              "links": {
                "self": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                },
                "html": {
                  "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                }
              },
              "author": {
                "raw": "Alexander Mills <alex@alexs-mac.local>",
                "type": "author"
              },
              "summary": {
                "raw": "conflict free\\n",
                "markup": "markdown",
                "html": "<p>conflict free</p>",
                "type": "rendered"
              },
              "parents": [
                {
                  "hash": "4cxxxx03e075d808b9241ec760087e114d6d0ccf",
                  "type": "commit",
                  "links": {
                    "self": {
                      "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/4cxxxx03e075d808b9241ec760087e114d6d0ccf"
                    },
                    "html": {
                      "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/4cxxxx03e075d808b9241ec760087e114d6d0ccf"
                    }
                  }
                }
              ],
              "date": "20xx-x5-15T23:09:07+00:00",
              "message": "conflict free\\n",
              "type": "commit",
              "properties": {}
            }
          },
          "links": {
            "commits": {
              "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commits?include=6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42&exclude=10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
            },
            "html": {
              "href": "https://bitbucket.org/ntrs/jenkins-jobs/branches/compare/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42..10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
            },
            "diff": {
              "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/diff/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42..10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
            }
          },
          "created": false,
          "commits": [
            {
              "rendered": {},
              "hash": "6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42",
              "links": {
                "self": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                },
                "comments": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42/comments"
                },
                "patch": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/patch/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                },
                "html": {
                  "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                },
                "diff": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/diff/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                },
                "approve": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42/approve"
                },
                "statuses": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42/statuses"
                }
              },
              "author": {
                "raw": "Alexander Mills <alex@alexs-mac.local>",
                "type": "author"
              },
              "summary": {
                "raw": "conflict free\\n",
                "markup": "markdown",
                "html": "<p>conflict free</p>",
                "type": "rendered"
              },
              "parents": [
                {
                  "hash": "10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114",
                  "type": "commit",
                  "links": {
                    "self": {
                      "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                    },
                    "html": {
                      "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                    }
                  }
                }
              ],
              "date": "20xx-x5-15T23:39:43+00:00",
              "message": "conflict free\\n",
              "type": "commit",
              "properties": {}
            }
          ],
          "truncated": false,
          "closed": false,
          "new": {
            "name": "master",
            "links": {
              "commits": {
                "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commits/master"
              },
              "self": {
                "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/refs/branches/master"
              },
              "html": {
                "href": "https://bitbucket.org/ntrs/jenkins-jobs/branch/master"
              }
            },
            "default_merge_strategy": "merge_commit",
            "merge_strategies": [
              "merge_commit",
              "squash",
              "fast_forward"
            ],
            "type": "branch",
            "target": {
              "rendered": {},
              "hash": "6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42",
              "links": {
                "self": {
                  "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                },
                "html": {
                  "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/6fxxxxe8d3bd93e2a2ab6de332867def8fbccf42"
                }
              },
              "author": {
                "raw": "Alexander Mills <alex@alexs-mac.local>",
                "type": "author"
              },
              "summary": {
                "raw": "conflict free\\n",
                "markup": "markdown",
                "html": "<p>conflict free</p>",
                "type": "rendered"
              },
              "parents": [
                {
                  "hash": "10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114",
                  "type": "commit",
                  "links": {
                    "self": {
                      "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs/commit/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                    },
                    "html": {
                      "href": "https://bitbucket.org/ntrs/jenkins-jobs/commits/10xxxxaf0c2daf86d429c22f6a8c34d8a6ab9114"
                    }
                  }
                }
              ],
              "date": "20xx-x5-15T23:39:43+00:00",
              "message": "conflict free\\n",
              "type": "commit",
              "properties": {}
            }
          }
        }
      ]
    },
    "actor": {
      "username": "ntrs_alex",
      "display_name": "Alex Mills",
      "uuid": "{c0xxxxb2-26dd-4e94-811e-f89afe7b1b2c}",
      "links": {
        "self": {
          "href": "https://api.bitbucket.org/2.0/users/%7Bxxxx9bb2-26dd-4e94-811e-f89afe7b1b2c%7D"
        },
        "html": {
          "href": "https://bitbucket.org/%7Bxxxx9bb2-26dd-4e94-811e-f89afe7b1b2c%7D/"
        },
        "avatar": {
          "href": "https://bitbucket.org/account/ntrs_alex/avatar/"
        }
      },
      "nickname": "ntrs_alex",
      "type": "user",
      "account_id": "5cxxxx15c4966f0ffe44c597"
    },
    "repository": {
      "scm": "git",
      "website": "",
      "name": "jenkins-jobs",
      "links": {
        "self": {
          "href": "https://api.bitbucket.org/2.0/repositories/ntrs/jenkins-jobs"
        },
        "html": {
          "href": "https://bitbucket.org/ntrs/jenkins-jobs"
        },
        "avatar": {
          "href": "https://bytebucket.org/ravatar/%7Bxxxx95ff-36e7-4aad-a17b-32eb64d935b9%7D?ts=default"
        }
      },
      "project": {
        "key": "DEVOPS",
        "type": "project",
        "uuid": "{2dxxxxbd-54b7-46ad-bf41-7997eaa244d9}",
        "links": {
          "self": {
            "href": "https://api.bitbucket.org/2.0/teams/ntrs/projects/DEVOPS"
          },
          "html": {
            "href": "https://bitbucket.org/account/user/ntrs/projects/DEVOPS"
          },
          "avatar": {
            "href": "https://bitbucket.org/account/user/ntrs/projects/DEVOPS/avatar/32"
          }
        },
        "name": "devops"
      },
      "full_name": "ntrs/jenkins-jobs",
      "owner": {
        "username": "ntrs",
        "display_name": "Interos",
        "type": "team",
        "uuid": "{d4xxxxc3-04c5-412d-8056-a69fce894572}",
        "links": {
          "self": {
            "href": "https://api.bitbucket.org/2.0/teams/%7Bxxxx7ec3-04c5-412d-8056-a69fce894572%7D"
          },
          "html": {
            "href": "https://bitbucket.org/%7Bxxxx7ec3-04c5-412d-8056-a69fce894572%7D/"
          },
          "avatar": {
            "href": "https://bitbucket.org/account/ntrs/avatar/"
          }
        }
      },
      "type": "repository",
      "is_private": true,
      "uuid": "{4cxxxxff-36e7-4aad-a17b-32eb64d935b9}"
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment