Skip to content

Instantly share code, notes, and snippets.

@dragonfax
Created May 2, 2018 01:29
Show Gist options
  • Save dragonfax/66fdf822a7d1ae1340500e599c313b19 to your computer and use it in GitHub Desktop.
Save dragonfax/66fdf822a7d1ae1340500e599c313b19 to your computer and use it in GitHub Desktop.
travis api examples
Here is an example query and output. The `jq` command is just to format the JSON so its readable.
17245-jstillwell:~ jstillwell$ curl -s https://api.travis-ci.com/repos?limit=100 -H "Authorization: token XXXXXXXXX" | jq '.' | head -30
[
{
"id": 302275,
"slug": "zendesk/embeddable_framework",
"description": "Home of the Embeddable Web Widget",
"last_build_id": 72266014,
"last_build_number": "9681",
"last_build_status": null,
"last_build_result": null,
"last_build_duration": null,
"last_build_language": null,
"last_build_started_at": "2018-05-02T01:25:14Z",
"last_build_finished_at": null,
"active": true
},
{
"id": 50388,
"slug": "zendesk/zendesk_browser_tests",
"description": "A finely curated collection of browser integration tests.",
"last_build_id": 72265980,
"last_build_number": "15887",
"last_build_status": null,
"last_build_result": null,
"last_build_duration": null,
"last_build_language": null,
"last_build_started_at": "2018-05-02T01:23:50Z",
"last_build_finished_at": null,
"active": true
},
...
we get 50 items max. regardless of limit value.
17245-jstillwell:~ jstillwell$ curl -s https://api.travis-ci.com/repos?limit=100 -H "Authorization: token XXXXX" | jq '.[] | .id' | wc
50 50 368
This endpoint returns a seemingly random list of repos. Its different every time I run this query. So I can't tell if pagination even works with this endpoint. And even if it does, it wouldn't be useful. As the pages themselves wouldn't be consistent.
I can't find any docs on how to use a 'sort' option. So I can't tell if that works either.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment