-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API V3 : A complete reimagining of what the Travis CI API should be #6
Comments
This is great! I'm definitely loving the new API -- it's definitely cleaner and more consistent than the old API. I do have a couple suggestions/feature requests though:
All in all though, great work! The eager loading in particular is super exciting 🎆. |
Hey @alanhdu thanks so much for the feedback. We're glad you're liking things so far. Regarding your suggestions/requests:
|
Hi @carlad! I'm glad this was helpful 😹. So my use-case for (2) and (3) is trying to deserialize the JSON responses into a Rust struct -- basically, I'd love to know whether to deserialize a field into a One more thing that I just noticed -- when I click on one of the links in the sidebar, the page doesn't scroll to the top -- that means if I click on something like |
Hi Any plans to adopt GraphQL as api provider? |
Hi @alorma. Thanks for the question. We don't have plans for GraphQL at this stage. I'm not sure if we will implement GraphQL support, but it may be something for us to look into once our V3 API has had wider adoption. |
With v3 API released and working smoothly, I'm going to close this Beta Feature issue 🎉 If you have any thoughts/feedback/issues/concerns/dance-moves you would like to share with us, please open an issue at https://github.com/travis-ci/travis-ci/issues Huzzah! |
Hi everyone! Where can I find the documentation for eager loading and the https://developer.travis-ci.com/eager-loading#eager%20loading Thanks! |
Hey @isabellachen The page you link to is the documentation we currently have. More information about what attributes are available for each resource can be found on the individual resource page. For example, when querying the You can test this in the API Explorer like so: or https://developer.travis-ci.org/explore/repo/59/branch/master?include=build.commit Does that help? Was there specific information you were wanting to eager load/include in a request? |
What I would like to have the the github_id of the person that created the build, is that possible? Could I also load several attributes? Like both the build.created_by and build.jobs at the same time? How would I do it? Thank you :) |
I'm not sure about the github_id of the build creator - I can check on that, however https://developer.travis-ci.org/explore/build/86601346 Is that the endpoint are you querying? |
Right now I'm able to get either the |
Try this It might not be the most efficient query, depending on how many requests are being returned, and how many jobs each of those requests has. You can see an example of the time this query takes: |
Dear Travis, I have been trying to create a new environment twice and it is impossible: Without it, it is impossible to automatically configure travis automatically for all our repos that we want release opensource. I dont understand but travis+coveralls close their API but that would benefit the community at every point so please allow me to ask why? |
Hi @kopax - thanks for the comment. |
@carlad, I want to push from gitlab/gitlab-ci to github/travis-ci We need to create variables and travis documentation only show how to update. We have seen in the developer tools on travis website that the query used to create env by travis is using We changed all our # Request that create
curl "https://api.travis-ci.org/settings/env_vars?repository_id=${scope}/${name}" \
-H "Authorization: token ${TRAVIS_CI_TOKEN}" \
-H 'Content-Type: application/json; charset=UTF-8' \
--data-binary '{"env_var":{"name":"NPM_TOKEN","value":"'${NPM_TOKEN}'","public":false,"repository_id":"'${scope}/${name}'"}}' \
--compressed
curl "https://api.travis-ci.org/settings/env_vars?repository_id=${scope}/${name}" \
-H "Authorization: token ${TRAVIS_CI_TOKEN}" \
-H 'Content-Type: application/json; charset=UTF-8' \
--data-binary '{"env_var":{"name":"GH_TOKEN","value":"'${GH_TOKEN:-GITHUB_TOKEN}'","public":false,"repository_id":"'${scope}/${name}'"}}' \
--compressed
# # Request that update
# curl -sS -X PATCH \
# -H "Content-Type: application/json" \
# -H "Travis-API-Version: 3" \
# -H "Authorization: token ${TRAVIS_CI_TOKEN}" \
# -d '{ "env_var.value": "'${NPM_TOKEN}'", "env_var.public": false }' \
# https://api.travis-ci.com/repo/${scope}/${name}/NPM_TOKEN
#
# curl -sS -X PATCH \
# -H "Content-Type: application/json" \
# -H "Travis-API-Version: 3" \
# -H "Authorization: token ${TRAVIS_CI_TOKEN}" \
# -d '{ "env_var.value": "'${GH_TOKEN:-GITHUB_TOKEN}'", "env_var.public": false }' \
# https://api.travis-ci.com/repo/${scope}/${name}/GH_TOKEN The thing is those |
Thanks for the additional info @kopax. It's also possible to use the repository 'slug' in the request uri. An example for the (see the second example at: https://developer.travis-ci.com/resource/env_vars#create) Note that the 'slug' is a combination of the organisation/user name and the repo name, with the Does that help at all? |
@carlad not really, we have tried the slugs and we were having This did the trick: travisRepositoryId=$(curl -sS https://api.travis-ci.org/repos/${scope}/${name} -H "Authorization: token ${TRAVIS_CI_TOKEN}" | jq -r .id)
# Now create
curl "https://api.travis-ci.org/settings/env_vars?repository_id=${travisRepositoryId}" \
-H "Authorization: token ${TRAVIS_CI_TOKEN}" \
-H 'Content-Type: application/json; charset=UTF-8' \
--data-binary '{"env_var":{"name":"NPM_TOKEN","value":"'${NPM_TOKEN}'","public":false,"repository_id":"'${scope}/${name}'"}}' \
--compressed
curl "https://api.travis-ci.org/settings/env_vars?repository_id=${travisRepositoryId}" \
-H "Authorization: token ${TRAVIS_CI_TOKEN}" \
-H 'Content-Type: application/json; charset=UTF-8' \
--data-binary '{"env_var":{"name":"GH_TOKEN","value":"'${GH_TOKEN:-GITHUB_TOKEN}'","public":false,"repository_id":"'${scope}/${name}'"}}' \
--compressed |
@kopax also check that the uri is requesting the correct platform (either I can see in the example requests you've posted that sometimes you are requesting .com and sometimes .org. The |
I'm not sure if this is the right place to comment, as this issue is closed. Still, https://developer.travis-ci.com/ links here so I'll leave my feedback here. I have a command line tool - also named
The tool is available from here: https://github.com/kevinburke/travis. How this works when you type
I'm running into problems when trying to get builds for a branch when the # Build on merges to master
branches:
only:
- master Basically if I have a pull request open on a branch named, say, I see a In theory I guess I could also hit the Github API and figure out which pull request correlates with which branch, but that's a huge pain, and requires 1 request per Travis build in the response. Also it would require me to ask console users for a Github token as well which seems unnecessary. If there's a pull request open for a Git branch it would be nice if there was some way to correlate the Travis build for the pull request with the Git branch that opened the PR/triggered that build. |
Hi @kevinburke Sorry for our lack of response. I think it would be best to ask this question on https://travis-ci.community so we can make sure it is escalated and tracked, especially as this issue for the API is closed. |
Good work |
Perfect work |
https://developer.travis-ci.com/ tells me I should leave feedback here, so here it is: |
Hey @carlad , I am building one GitHub app to monitor travisCI's build info, and I use my travis token to request API v3. However, I found that I can only get results from myself, not from others (other users who installed my GitHub app). So, do I have to use other users' tokens to get their respective data? For example, I am A, other user who installed my GitHub app are B and C. I can get my travis data (like buildInfo, builds, etc) with my travis token, but get If I do not use travis API, but visit travis.org manually, I can see B or C's travis data. Please tell me, thanks! |
Hi Jian,
I no longer work at Travis-CI, but I believe you do need the tokens
corresponding to the other users to see their builds.
I suggest emailing support@travis-ci.com to confirm this.
Have a great day.
Carla
…On Tue, 14 Jan 2020 at 19:30, Jian GU ***@***.***> wrote:
Hey @carlad <https://github.com/carlad> , I am building one GitHub app to
monitor travisCI's build info, and I use my travis token to request API v3.
However, I found that I can only get results from myself, not from others
(other users who installed my GitHub app). So, do I have to use other
users' tokens to get their respective data?
For example, I am A, other user who installed my GitHub app are B and C. I
can get my travis data (like buildInfo, builds, etc) with my travis token,
but get Error requesting Travis API StatusCodeError: 403 - "access denied"
when try to get travis data of B or C. So, do I have to get B's travis
token to request API to get B's travis data and get C's travis token to
request API to get C's travis data?
If I do not use travis API, but visit travis.org manually, I can see B or
C's travis data. Please tell me, thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6?email_source=notifications&email_token=AANMOX27HNML34YNXHBOVGTQ5YAETA5CNFSM4DCIPMZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI5UP7Q#issuecomment-574310398>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANMOX6P5O4VK4DJ6CB36JLQ5YAETANCNFSM4DCIPMZA>
.
|
Not able to access API explorer. Asks me to log in, when I log in though, it takes me to https://app.travis-ci.com/ and when I go to docs it automatically gets logged out. |
After many months of amazing work by the entire Travis team, we're super excited to announce the release of the Travis CI API Version 3!
Central to this release is an improved and modernized API experience, with faster response times, and a dramatically cleaner code base.
As our UI is based on Ember, and as such is a rich javascript codebase, so a great API is even more important to us!
Some of the topics we focused on during development were:
We could go on for pages about why we love this API so much, but why not try it out for yourself! You can head over to our documentation for more information, or read our Blog post announcement which has more information about our API explorer.
Please leave all feedback as comments here, or if you run into a bug, please report it to our support team.
The text was updated successfully, but these errors were encountered: