From 0f01bc90de13ba24bd54b33ea5235f32c8453d0a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 31 May 2015 12:40:46 -0400 Subject: Update documentation --- docs/api-json-rpc.markdown | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'docs/api-json-rpc.markdown') 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 ---------- -- cgit v1.2.3