Search code examples
javatravis-cirest-client

How to start build Travis CI project with HTTP API request


I've uploaded on GitHub a very simple Maven Project written in Java including .yml file to integrate Travis CI. The project is buildable manually from the appropriate button "Restart Build" on the travis-ci platform but I want to start the build with API requests as explained in this link: https://developer.travis-ci.com/resource/build#Build.

I'm using the RestClient Firefox Plugin but those commands doesn't work.


Solution

  • Does not matter what http client you are using. You can access travis v3 API.

    Request example from Travis API v3 docs [link]

    body='{
       "request": {
       "branch":"master"
    }}'
    
    curl -s -X POST \
       -H "Content-Type: application/json" \
       -H "Accept: application/json" \
       -H "Travis-API-Version: 3" \
       -H "Authorization: token xxxxxx" \
       -d "$body" \
    https://api.travis-ci.org/repo/...