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

Repository REST API #118

Closed
denelon opened this issue May 11, 2020 · 22 comments · Fixed by #969
Closed

Repository REST API #118

denelon opened this issue May 11, 2020 · 22 comments · Fixed by #969
Assignees
Labels
Experimental This experimental feature can be enabled in settings Issue-Feature This is a feature request for the Windows Package Manager client.

Comments

@denelon
Copy link
Contributor

denelon commented May 11, 2020

I'd like to be able to have a repository accessible via REST APIs rather than a signed MSIX package.

The API will need a full design. This will also have an impact on client behavior. The MSIX index package can become a backup mechanism if the APIs are offline, or the client is unable to connect.

Notes:
The client needs to be able to get the list of packages to enable "search"
The client needs to be able to get the manifest so it can "install"
This implies that the client will build a local cache of packages after retrieving the list so they can perform a local search.
In the future we may create a web based search API (TBD).
The contents of the Microsoft Community Package manager should be available via this API once it's built.

@svmastersamurai
Copy link

This aspect is super interesting to those of us in orgs that build and deploy internally built software.

As someone who has to manage chocolatey infrastructure: please please please keep this design simple.

As an operator I would love to be able to run a tool over "packages" to generate a static website. Assuming the API is of trivial complexity, the server might be about 20 or 30 lines of code in Go or I could use something like apache or nginx to serve the content. I could more easily leverage a CI/CD system to handle rebuilding the repo metadata when there is a change.

For example we looked into sleet but chocolatey speaks an older dialect of nuget and that ended up being non-viable.

I think other package managers like RPM and apt are great examples to draw inspiration from.

The tools for repo management should ideally be cross-platform so we could build or manage changes to repo metadata on either POSIX-based OSes or Windows.

@denelon
Copy link
Contributor Author

denelon commented May 21, 2020

@svmastersamurai That's great feedback. I like the idea of running the tool over the packages. Would you think in terms of UNC style path's to the binaries or would HTTP still be OK?

I'm thinking about a concept where you might have the installers in a structure that looks like the manifests directory in the repository here, and then having the manifests able to co-locate in the same structure. If the installers are MSIX, we can pull nearly all of the meta-data to generate the manifest based on what is found.

@svmastersamurai
Copy link

@denelon I think to generate a static website that makes perfect sense. This assumes that there will be adequate saturation of MSIX usage of course! There are a lot of legacy installers out there, so would this be able to also handle the usual suspects we know about?

Our team manages multiple operating systems so we tend to prefer HTTP since it is usable cross platform. We use the same webservers to serve installers for Windows that we do for Munki packages on MacOS and RPMs for our fedora fleet.

One thing we do for redundancy is have a few locations to retrieve the installers from. It appears the package spec supports this, so from a tooling perspective if I have 5 mirrors with different hostnames it would be nice to be able to have the tool aware of the mirrors (in a simplistic sense, I can just give it a list in a file for example) and be able to append those sources to the specs if they don't exist. From the winget-cli's perspective it could cycle through the mirrors until it finds one that is accessible. This would probably lead to templating within the package spec, which I admittedly haven't dived too much into this project to know if that's supported or if there was a plan for that already 😄.

@denelon denelon added this to the Package Manager Backlog milestone May 23, 2020
@majkinetor
Copy link

As an operator I would love to be able to run a tool over "packages" to generate a static website.

This deserves a separate ticket IMO and has nothing to do with REST interface to repository. Such tool would indeed be great for multiple reasons, one of which is that it allows anybody to keep their public list of packages and host it anywhere (i.e. github pages and friends).

Such tool might not be practical in producing all desired functionality of REST backend such as versioning and dependencies although it could go long way into that direction.

@denelon denelon modified the milestones: Package Manager Backlog, Package Manager v0.3 Jun 5, 2020
@denelon denelon modified the milestones: Package Manager v0.3, Package Manager v0.4 Jul 1, 2020
@denelon
Copy link
Contributor Author

denelon commented Mar 2, 2021

We are actively working on the REST API and our initial implementation in the client. The schemas for validating the new YAML syntax have been checked in, but may very well churn a bit. https://github.com/microsoft/winget-cli/tree/master/schemas/JSON/manifests/v1.0.0

The REST API will have it's own object structure, but is expected to be essentially conforming to the same meta-data.

@denelon denelon added Issue-Feature This is a feature request for the Windows Package Manager client. and removed Issue-Scenario labels Mar 8, 2021
@denelon
Copy link
Contributor Author

denelon commented Apr 15, 2021

We have a prototype with install and search. The Windows Package Manager v0.2.10771 Preview has an experimental implementation for install and search. As soon as we round out the other commands, we will share the swagger YAML.

@jedieaston
Copy link
Contributor

I was wondering, in this first pass of the API spec, is there anything about authentication? Something that would be a dream feature is if there is a way it can use Azure AD SSO (or another SSO provider that uses the Windows Credential Provider API) to authenticate, so that we don't have to have the repo open to everyone on the network (or the internet). For now, of course, we could probably use the custom headers stuff to send a secret we get some other way, but at some point it would be nice to have something a bit more robust.

@denelon
Copy link
Contributor Author

denelon commented Apr 26, 2021

@jedieaston we don't currently have anything for authentication in the API yet. We've had several different suggestions for which mechanisms to use. I expect to create an "Issue-Feature" as soon as we open up the reference implementation repository. This is clearly a high-value use case. We do have a "getInformation" endpoint to query a source for the protocol versions supported. This may be a reasonable place to provide authentication mechanisms as well.

@denelon denelon removed this from the Package Manager v0.4.x milestone May 3, 2021
@denelon denelon added this to the Package Manager v1.0 milestone May 3, 2021
@denelon denelon added the Experimental This experimental feature can be enabled in settings label May 14, 2021
@denelon denelon linked a pull request May 18, 2021 that will close this issue
@denelon denelon closed this as completed May 20, 2021
@ghost1372
Copy link

Hi @denelon
Is there any documentation to use Rest API?

@denelon
Copy link
Contributor Author

denelon commented May 25, 2021

It's coming soon [TM] with a reference implementation.

@ghost1372
Copy link

Thanks, where can we find the documentation when it was published?

@denelon
Copy link
Contributor Author

denelon commented May 25, 2021

It's another GitHub repository. I'll have copious documentation updates to make as soon as we flip the repository to public, Think in terms of days not weeks. It does include Swagger documentation.

@denelon
Copy link
Contributor Author

denelon commented May 26, 2021

@ghost1372 https://github.com/microsoft/winget-cli-restsource is where the reference implementation is.

@ghost1372
Copy link

ghost1372 commented May 27, 2021

Thank you

@mherrmann
Copy link

Hi @denelon, may I ask out of curiosity what the motivation for the REST API is vs. a UNC source of offline manifest files (#160)? What I don't understand is that it seems to me that a UNC source will always be easier to create and deploy than a REST API. What does the REST API give us in return, in terms of use cases that can be implemented?

Thank you!
Michael

@denelon
Copy link
Contributor Author

denelon commented Jun 28, 2021

@mherrmann we had more asks for a REST API during early feedback cycles with Microsoft MVPs and ISVs than a UNC implementation. The two primary use cases at the time were hosting repositories for software distribution by ISVs (to the public), and enterprise customers hosting internal repositories for a distributed workforce.

@mherrmann
Copy link

@denelon I see, thank you very much for the prompt response. I am working in a tangential space and would love to get a better feel for the industry opinion. Is there any chance the feedback cycles you mentioned are public or documented somewhere? If not, can you recommend people (eg. Microsoft MVPs) I might reach out to to find out more?

Thank you again!
Best,
Michael

@denelon
Copy link
Contributor Author

denelon commented Jun 28, 2021

@mhermann those early discussions were under NDA before the preview launched. I'd be willing to reach out via Twitter if you have some specific questions to get some feedback.

@mherrmann
Copy link

mherrmann commented Jun 28, 2021

@denelon I understand, and thank you. I'd like to understand why people asked for REST APIs, when static files would be easier to host. I would love to understand which features people want that require a dynamic approach such as REST and cannot be implemented with static files.

My twitter is @m_herrmann if you want to include it. Thank you 🙏

@matsmcp
Copy link

matsmcp commented Oct 11, 2021

@denelon I understand, and thank you. I'd like to understand why people asked for REST APIs, when static files would be easier to host. I would love to understand which features people want that require a dynamic approach such as REST and cannot be implemented with static files.

My twitter is @m_herrmann if you want to include it. Thank you 🙏

I also would like to upvote a more static approach on a Webserver.
The scenario is both for the MSP use case where multiple Customers would use the MSP:s server for MSP created packages and for larger organisations with multiple domains where a fileshare is unpractical. Having a webserver provide a static site with the packages and a contentfile (ie packages.tgz in a Unix world) would be very simple to implement and also be completly plattform independant.

This also needs a Winget client that is usable over SSH/winrm to be usefull

@denelon
Copy link
Contributor Author

denelon commented Oct 11, 2021

@mherrmann I think I must have missed an e-mail notification from GitHub on this. A couple of other features in the works related to Delivery Optimization are likely to have an impact on the API and subsequently a UNC driven approach. I believe it's still possible to generate a static site with the appropriate values to support the client search, install, upgrade, and list behaviors. We just went down the dynamic path due to the scope/scale of duplicating the Windows Package Manager Community App Repository. We have some active development in the area currently, and we're also looking at possibly refactoring the search interface.

@mherrmann
Copy link

@denelon I see. Thank you for clarifying :-)

jedieaston added a commit to jedieaston/winget-cli that referenced this issue Nov 17, 2021
2dfc7499 Update Authors file
6dab4978 Update README and tweak syntax in Boost.JSON adapter
2ecd2119 Merge pull request microsoft#136 from matty0ung/boostjson
b1119ccc Merge pull request microsoft#135 from matty0ung/uris
f5cf601e Add Boost.JSON support
14325788 Add Boost.JSON support
d3104ea8 Support fetching sub-schemas from other files
ad7dac75 Merge pull request microsoft#133 from rayvincent2/feature/add-urn-reference-support
3442709a Update urn regex expression to be std::regex safe
f787a8a7 Update urn regex to match widely accepted expression
653d515d Ensure that urn regex checks to end of string
eac0859c Ensure that urn NID cannot include '.'
ef42dae2 Add support for urn document references
a4684c28 Fix path to rapidjson in fuzzing test code
11af6522 Merge remote-tracking branch 'clainio/build-fix'
c5487c39 Update rapidjson to latest code from github
6a04040d Update adapters to avoid inheriting from std::iterator
385d2d83 Improve handling of compiler flags when exceptions are disabled
82e093fe Upgrade gtest to v1.11.0
c63ac26f Disable C4702: unreachable code warnings for json_pointer.hpp
855365bc Disable C4702: unreachable code warnings within relevant headers
5c97e3cc Fix gcc build error
4897d102 Fix exclusiveMaximum and exclusiveMinimum error messages
6cc4cddc Suppress boost warnings that aren't relevant to the test suite
2cf8d3dd Add default tests for draft 7
e94179e1 Add definitions tests for draft 7
bb2c4251 Improve array_iteration_basics example
e6909b15 Add required test for draft 4
df89869e Add maxLength and minLength tests for draft 7
91834621 Fix return type on getMinLength
3740dc51 Explicitly initialise optionals in Subschema class
cb778b6b Minor changes to address msvc warnings and make cmake work on Windows
70f12ed1 Merge pull request microsoft#123 from anishmonachan7/fix_unused_variable
03b8cccb Update include/valijson/constraints/concrete_constraints.hpp
dc6d2fe0 fix unused variable error with gcc 8.3
77bae9fb Fix xcode stuff
66262baf Include nlohmann/json.hpp instead of json.hpp
b3b958c8 Merge pull request microsoft#121 from anishmonachan7/virtual_destructor
84c9fbf5 destructor to virtual destructor
8a784f23 Minor fix for example code in README
a19e1c00 Remove warning suppressions for clang
af2358b6 Use custom RAPIDJSON_ASSERT macro to catch parser errors
7ab96207 Ensure ref values are strings
635f36f0 Merge pull request microsoft#119 from BSipos-RKF/issue-118
fba5a9e8 Reject JSON references that index into empty arrays
cbcde15c Possible fix for microsoft#118
3621f98d Update rapidjson_utils.hpp to use iterative parsing
f544cd02 Merge pull request microsoft#116 from AdamKorcz/fuzz1
c13eed99 Minor refactoring
3a47f0cd Added fuzzer with oss-fuzz build file
cf648930 Merge pull request microsoft#114 from baylesj/fix-memory-leak
1f964c12 Fix memory leak in concrete constraints
7cb31947 Merge pull request microsoft#113 from hei-pa/master
8cc83c8b move curlpp findPackage in EXAMPLES block
c1e75c70 Merge pull request microsoft#110 from baylesj/remote_throws
bc81adbd add version checks around BOOST_NORETURN
7a560db2 Fixup headers
b8e95810 Apply feedback, add boost version check
8f6f9b6a Use deprecated declarations
f1006142 Cleanup unnecessary returns
a30ef974 Add VALIJSON_USE_EXCEPTIONS mode
8a700811 Add JSON Inspector example app
bbfc3f5c Fixed build on certain GCC toolchains
84b67fa6 Merge pull request microsoft#107 from baylesj/readme
90783ca4 Minor code style changes
3dd4482a Merge pull request microsoft#103 from wwriter/cond_schema_errormessage
ee4f85bf Minor tweaks to README.md file
a7038862 Update jsoncpp link in readme
abedaf0e Merge pull request microsoft#105 from baylesj/update-jsoncpp
825ee110 Fix readme
b6b6f167 Delete jsoncpp fuzzing stuff
2ee7474f Delete more unnecessary scripts
1ff5308f fix submodule
dbc4fcc8 Remove modules
88d9d890 Update JsonCpp to 1.9.4
d5091b2d added feature : now users can get a detailed error message when if-then-else conditional constraints are not met
931f64d4 Merge pull request microsoft#102 from mathbunnyru/patch-2
c5e61543 Add conan package manager info
6cda9227 Merge pull request microsoft#99 from mathbunnyru/patch-1
45b0f83b Fix README so the code actually throws, when json is invalid
89e37cbf Fix typo
7f01c391 Minor suggestions from clangtidy
a527564b Merge pull request microsoft#96 from joshuaeckroth/master
ccad6b14 Switched from jsoncpp deprecated Reader to CharReader
45a333e6 Try to make builds faster
0ee3bada Fix broken build
bbe62ecd Merge pull request microsoft#95 from wirenboard/feature/cache-regex
f7f3acf2 Merge pull request microsoft#94 from wirenboard/fix/pass-by-ref
39f35069 Regex objects cache for pattern constraints
2216c2b8 Pass visitor to validationCallback by ref
0db0d139 Merge pull request microsoft#93 from Delgan/fix-unused-args
1c825cc6 Remove unused parameters instead of commenting them out
ca031221 Fix compilation errors due to unused parameters
105e345a Merge pull request microsoft#92 from arthurafarias/add-cmake-interface-library
f60a3089 Added interface target to CMakeLists.txt
d453ee2e Revert breaking changes to jsoncpp_adapter.hpp
f3a0390e Revert changes to json11_adapter.hpp
49c20301 Disable -Wshadow for included header in property_tree_utils.hpp
8875d802 Add CLion paths to .gitignore
73a8e440 More aggressive compiler warnings
77d2ef82 Cosmetic improvements for poco_json_adapter.hpp and property_tree_adapter.hpp
e5c1cbfe Ensure tests are run for Poco, Qt and property_tree adapters
8c0d16a0 Cosmetic improvements for std_string_adapter.hpp, test_json_pointer.cpp and test_poly_constraint.cpp
217b990b Cosmetic improvements for schema_parser.hpp and validation_results.hpp
71f4cdaa Cosmetic improvements for custom_allocator.hpp
e46af245 Cosmetic improvements for concrete_constraints.hpp and basic_constraint.hpp
7917b2f7 Cosmetic improvements for schema.hpp, schema_parser.hpp and subschema.hpp
8150a520 Cosmetic improvements for test_adapter_comparison.cpp
28cc9e8e Cosmetic improvements for qtjson_adapter.hpp
508bc019 Cosmetic improvements for rapidjson_adapter.hpp
d7901d48 Cosmetics improvements for picojson_adapter.hpp
3211a04d Cosmetic improvements for nlohmann_json_adapter.hpp
0f57cb31 Cosmetic improvements for jsoncpp_adapter.hpp
e11c17c3 Cosmetic improvements for json11_adapter.hpp
6f1f4acb Cosmetic improvements for basic_adapter.hpp
3ddbe585 Cosmetic improvements for validation_visitor.hpp
09d21423 Update xcode project files
0481a0bb Minor tidy up of const auto usage
94cef2fa Add example showing local file resolution

git-subtree-dir: src/Valijson/valijson
git-subtree-split: 2dfc7499a31b84edef71189f4247919268ebc74e
jedieaston added a commit to jedieaston/winget-cli that referenced this issue Nov 17, 2021
2dfc7499 Update Authors file
6dab4978 Update README and tweak syntax in Boost.JSON adapter
2ecd2119 Merge pull request microsoft#136 from matty0ung/boostjson
b1119ccc Merge pull request microsoft#135 from matty0ung/uris
f5cf601e Add Boost.JSON support
14325788 Add Boost.JSON support
d3104ea8 Support fetching sub-schemas from other files
ad7dac75 Merge pull request microsoft#133 from rayvincent2/feature/add-urn-reference-support
3442709a Update urn regex expression to be std::regex safe
f787a8a7 Update urn regex to match widely accepted expression
653d515d Ensure that urn regex checks to end of string
eac0859c Ensure that urn NID cannot include '.'
ef42dae2 Add support for urn document references
a4684c28 Fix path to rapidjson in fuzzing test code
11af6522 Merge remote-tracking branch 'clainio/build-fix'
c5487c39 Update rapidjson to latest code from github
6a04040d Update adapters to avoid inheriting from std::iterator
385d2d83 Improve handling of compiler flags when exceptions are disabled
82e093fe Upgrade gtest to v1.11.0
c63ac26f Disable C4702: unreachable code warnings for json_pointer.hpp
855365bc Disable C4702: unreachable code warnings within relevant headers
5c97e3cc Fix gcc build error
4897d102 Fix exclusiveMaximum and exclusiveMinimum error messages
6cc4cddc Suppress boost warnings that aren't relevant to the test suite
2cf8d3dd Add default tests for draft 7
e94179e1 Add definitions tests for draft 7
bb2c4251 Improve array_iteration_basics example
e6909b15 Add required test for draft 4
df89869e Add maxLength and minLength tests for draft 7
91834621 Fix return type on getMinLength
3740dc51 Explicitly initialise optionals in Subschema class
cb778b6b Minor changes to address msvc warnings and make cmake work on Windows
70f12ed1 Merge pull request microsoft#123 from anishmonachan7/fix_unused_variable
03b8cccb Update include/valijson/constraints/concrete_constraints.hpp
dc6d2fe0 fix unused variable error with gcc 8.3
77bae9fb Fix xcode stuff
66262baf Include nlohmann/json.hpp instead of json.hpp
b3b958c8 Merge pull request microsoft#121 from anishmonachan7/virtual_destructor
84c9fbf5 destructor to virtual destructor
8a784f23 Minor fix for example code in README
a19e1c00 Remove warning suppressions for clang
af2358b6 Use custom RAPIDJSON_ASSERT macro to catch parser errors
7ab96207 Ensure ref values are strings
635f36f0 Merge pull request microsoft#119 from BSipos-RKF/issue-118
fba5a9e8 Reject JSON references that index into empty arrays
cbcde15c Possible fix for microsoft#118
3621f98d Update rapidjson_utils.hpp to use iterative parsing
f544cd02 Merge pull request microsoft#116 from AdamKorcz/fuzz1
c13eed99 Minor refactoring
3a47f0cd Added fuzzer with oss-fuzz build file
cf648930 Merge pull request microsoft#114 from baylesj/fix-memory-leak
1f964c12 Fix memory leak in concrete constraints
7cb31947 Merge pull request microsoft#113 from hei-pa/master
8cc83c8b move curlpp findPackage in EXAMPLES block
c1e75c70 Merge pull request microsoft#110 from baylesj/remote_throws
bc81adbd add version checks around BOOST_NORETURN
7a560db2 Fixup headers
b8e95810 Apply feedback, add boost version check
8f6f9b6a Use deprecated declarations
f1006142 Cleanup unnecessary returns
a30ef974 Add VALIJSON_USE_EXCEPTIONS mode
8a700811 Add JSON Inspector example app
bbfc3f5c Fixed build on certain GCC toolchains
84b67fa6 Merge pull request microsoft#107 from baylesj/readme
90783ca4 Minor code style changes
3dd4482a Merge pull request microsoft#103 from wwriter/cond_schema_errormessage
ee4f85bf Minor tweaks to README.md file
a7038862 Update jsoncpp link in readme
abedaf0e Merge pull request microsoft#105 from baylesj/update-jsoncpp
825ee110 Fix readme
b6b6f167 Delete jsoncpp fuzzing stuff
2ee7474f Delete more unnecessary scripts
1ff5308f fix submodule
dbc4fcc8 Remove modules
88d9d890 Update JsonCpp to 1.9.4
d5091b2d added feature : now users can get a detailed error message when if-then-else conditional constraints are not met
931f64d4 Merge pull request microsoft#102 from mathbunnyru/patch-2
c5e61543 Add conan package manager info
6cda9227 Merge pull request microsoft#99 from mathbunnyru/patch-1
45b0f83b Fix README so the code actually throws, when json is invalid
89e37cbf Fix typo
7f01c391 Minor suggestions from clangtidy
a527564b Merge pull request microsoft#96 from joshuaeckroth/master
ccad6b14 Switched from jsoncpp deprecated Reader to CharReader
45a333e6 Try to make builds faster
0ee3bada Fix broken build
bbe62ecd Merge pull request microsoft#95 from wirenboard/feature/cache-regex
f7f3acf2 Merge pull request microsoft#94 from wirenboard/fix/pass-by-ref
39f35069 Regex objects cache for pattern constraints
2216c2b8 Pass visitor to validationCallback by ref
0db0d139 Merge pull request microsoft#93 from Delgan/fix-unused-args
1c825cc6 Remove unused parameters instead of commenting them out
ca031221 Fix compilation errors due to unused parameters
105e345a Merge pull request microsoft#92 from arthurafarias/add-cmake-interface-library
f60a3089 Added interface target to CMakeLists.txt
d453ee2e Revert breaking changes to jsoncpp_adapter.hpp
f3a0390e Revert changes to json11_adapter.hpp
49c20301 Disable -Wshadow for included header in property_tree_utils.hpp
8875d802 Add CLion paths to .gitignore
73a8e440 More aggressive compiler warnings
77d2ef82 Cosmetic improvements for poco_json_adapter.hpp and property_tree_adapter.hpp
e5c1cbfe Ensure tests are run for Poco, Qt and property_tree adapters
8c0d16a0 Cosmetic improvements for std_string_adapter.hpp, test_json_pointer.cpp and test_poly_constraint.cpp
217b990b Cosmetic improvements for schema_parser.hpp and validation_results.hpp
71f4cdaa Cosmetic improvements for custom_allocator.hpp
e46af245 Cosmetic improvements for concrete_constraints.hpp and basic_constraint.hpp
7917b2f7 Cosmetic improvements for schema.hpp, schema_parser.hpp and subschema.hpp
8150a520 Cosmetic improvements for test_adapter_comparison.cpp
28cc9e8e Cosmetic improvements for qtjson_adapter.hpp
508bc019 Cosmetic improvements for rapidjson_adapter.hpp
d7901d48 Cosmetics improvements for picojson_adapter.hpp
3211a04d Cosmetic improvements for nlohmann_json_adapter.hpp
0f57cb31 Cosmetic improvements for jsoncpp_adapter.hpp
e11c17c3 Cosmetic improvements for json11_adapter.hpp
6f1f4acb Cosmetic improvements for basic_adapter.hpp
3ddbe585 Cosmetic improvements for validation_visitor.hpp
09d21423 Update xcode project files
0481a0bb Minor tidy up of const auto usage
94cef2fa Add example showing local file resolution

git-subtree-dir: src/Valijson/valijson
git-subtree-split: 2dfc7499a31b84edef71189f4247919268ebc74e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experimental This experimental feature can be enabled in settings Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants