Requesting a build through the API can be done by sending a POST request to a /repo/{slug|id}/requests
path.
Here is script for sending minimal request to a travis-ci/travis-core
repository, for a master branch:
body='{
"request": {
"branch":"master"
}'