GitHub » Post-Receive Hooks » Payload Testing With Curl

We use GitHub to host some of our projects and GitHub Post-Receive Hooks for automatic update notifcations.

We use the notifications to do automatic deployments, integration testing, email alerts, and more.

To learn about GitHub Post-Receive Hooks:
http://help.github.com/post-receive-hooks/

GitHub JSON Payload

The GitHub Post-Receive Hook sends information in JSON format.

We typically want to know the GitHub URL, which includes the user name and repo name.

The URL is contained in the JSON payload, like this snippet:

  payload={
    "repository": {
      "url": "http://github.com/username/reponame",
     }
  }

Testing with Curl

To test our side of the hook, we can use the curl command line utility to simulate a form post. To connect and post a payload:

  curl -d 'payload={"repository":{"url":"http://github.com/username/reponame"}}' http://example.com && echo '' 



What's Next?

blog comments powered by Disqus