diff options
Diffstat (limited to 'docs/api-json-rpc.markdown')
-rw-r--r-- | docs/api-json-rpc.markdown | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/api-json-rpc.markdown b/docs/api-json-rpc.markdown index 156a552e..929d63fd 100644 --- a/docs/api-json-rpc.markdown +++ b/docs/api-json-rpc.markdown @@ -163,6 +163,29 @@ Array ) ``` +### Example with Ruby + +This example can be used with Kanboard configured with Reverse-Proxy authentication and the API configured with a custom authentication header: + +```ruby +require 'faraday' + +conn = Faraday.new(:url => 'https://kanboard.example.com') do |faraday| + faraday.response :logger + faraday.headers['X-API-Auth'] = 'XXX' # base64_encode('jsonrpc:API_KEY') + faraday.basic_auth(ENV['user'], ENV['pw']) # user/pass to get through basic auth + faraday.adapter Faraday.default_adapter # make requests with Net::HTTP +end + +response = conn.post do |req| + req.url '/jsonrpc.php' + req.headers['Content-Type'] = 'application/json' + req.body = '{ "jsonrpc": "2.0", "id": 1, "method": "getAllProjects" }' +end + +puts response.body +``` + Procedures ---------- |