Skip to content
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

Added docs and js example for REST API usage #104

Merged
merged 8 commits into from
May 18, 2022

Conversation

gwynjudd
Copy link
Contributor

@gwynjudd gwynjudd commented May 17, 2022

Fixes #38.

Created documentation example showing usage for the REST API

@gwynjudd gwynjudd requested a review from a team as a code owner May 17, 2022 23:01
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to document, though the example presumes familiarity with what I presume is Node.js.

// Like: curl -u $auth -F FILE=@/tmp/f $jenkins/job/myjob/buildWithParameters
gives a more succinct tip which requires no programming knowledge, just ability to use a terminal, so I would suggest starting with that before giving examples using assorted programming languages (or the Powershell equivalent with Invoke-WebRequest).

README.md Outdated Show resolved Hide resolved
@jglick jglick added the documentation Improvements or additions to documentation label May 17, 2022
README.md Outdated
Comment on lines 87 to 89
## Usage with REST API

You can pass file parameters to the REST API:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildWithParameters, especially with file uploads, seems to strain the definition of https://en.wikipedia.org/wiki/Representational_state_transfer#Architectural_constraints. https://www.jenkins.io/doc/book/using/remote-access-api/ does refer to a REST-like style though actually this refers to the read-only “export” system https://javadoc.jenkins.io/component/stapler/org/kohsuke/stapler/export/package-summary.html + https://javadoc.jenkins.io/hudson/model/Api.html. Nitpicking but maybe the wording can be relaxed to just say a “remote” or “HTTP” API?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can certainly do that. Although since Jenkins itself seems to refer to buildWithParameters as part of their REST API, it will probably be a good idea to at least have that name in a parenthetical note to help people to land in a successful conclusion

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left some minor suggestions.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
gwynjudd and others added 4 commits May 19, 2022 09:40
Change file parameter name for consistency

Co-authored-by: Jesse Glick <[email protected]>
Used a better name for the job URL variable

Co-authored-by: Jesse Glick <[email protected]>
Tidy up the code example for bash

Co-authored-by: Jesse Glick <[email protected]>
Co-authored-by: Jesse Glick <[email protected]>
@jglick jglick merged commit 14cc541 into jenkinsci:master May 18, 2022
@gwynjudd gwynjudd deleted the rest-docs branch July 26, 2022 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to send a file when triggering a job via REST
2 participants