This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| 
                    userspace:webservice_corner:ruby-rpc [2014/10/24 07:58] dkoch  | 
                
                    userspace:webservice_corner:ruby-rpc [2021/08/23 08:37] (current) | 
            ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Ruby JSON-RPC ====== | ====== Ruby JSON-RPC ====== | ||
| - | This is a example of a JSON-RPC send from [[https:// | + | This is an example of a JSON-RPC send from [[https:// | 
| ===== Dependencies  | ===== Dependencies  | ||
| Line 13: | Line 13: | ||
| require ' | require ' | ||
| require ' | require ' | ||
| - | require ' | + | require 'json' | 
| + | require ' | ||
| class OpsiRPC  | class OpsiRPC  | ||
| Line 41: | Line 42: | ||
| end                                                                                                                                                                                                             | end                                                                                                                                                                                                             | ||
| - |    | + |    | 
| # Examples: | # Examples: | ||
| - | prodcuts=h.product_getObjects  | + | # Show all product ids | 
| - | prodcuts.each do |product|  | + | opsirpc.product_getObjects.each do |product|  | 
|   puts product[' |   puts product[' | ||
| - | end        | + | end | 
| + | |||
| + | # Query only particular fields ( " | ||
| + | # ( attributes: ) | ||
| + | opsirpc.product_getObjects(" | ||
| + | puts result | ||
| + | end | ||
| + | |||
| + | # Get products where packageVersion=2.1 | ||
| + | # ( filter: ) | ||
| + | opsirpc.product_getObjects([], | ||
| + | puts result | ||
| + | end | ||
| + | |||
| + | # Install Y where X is installed | ||
| + | opsirpc.productOnClient_getHashes([' | ||
| + |   opsirpc.setProductActionRequestWithDependencies(' | ||
| + | end | ||
| </ | </ | ||