diff --git a/lib/idoit.rb b/lib/idoit.rb index 9bd120129..fc5f3d1a7 100644 --- a/lib/idoit.rb +++ b/lib/idoit.rb @@ -109,6 +109,10 @@ or with filter: method: method, params: params, version: '2.0', + # the id attribute is required by the JSON-RPC standard + # but i-doit doesn't actually use it so we send a hard coded id + # see issue #2412 and community topic for further information + id: 42, }, { json: true, diff --git a/spec/requests/integration/idoit_spec.rb b/spec/requests/integration/idoit_spec.rb index f7854fc01..48a6e9671 100644 --- a/spec/requests/integration/idoit_spec.rb +++ b/spec/requests/integration/idoit_spec.rb @@ -44,7 +44,7 @@ RSpec.describe 'Idoit', type: :request do expect(json_response['error']).to eq('Not authorized (user)!') stub_request(:post, "#{endpoint}src/jsonrpc.php") - .with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\"}") + .with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\",\"id\":42}") .to_return(status: 200, body: read_message('object_types_response'), headers: {}) params = { @@ -81,7 +81,7 @@ RSpec.describe 'Idoit', type: :request do it 'does list all object types' do stub_request(:post, "#{endpoint}src/jsonrpc.php") - .with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\"}") + .with(body: "{\"method\":\"cmdb.object_types\",\"params\":{\"apikey\":\"#{token}\"},\"version\":\"2.0\",\"id\":42}") .to_return(status: 200, body: read_message('object_types_response'), headers: {}) params = { @@ -121,7 +121,7 @@ RSpec.describe 'Idoit', type: :request do it 'does query objects' do stub_request(:post, "#{endpoint}src/jsonrpc.php") - .with(body: "{\"method\":\"cmdb.objects\",\"params\":{\"apikey\":\"#{token}\",\"filter\":{\"ids\":[\"33\"]}},\"version\":\"2.0\"}") + .with(body: "{\"method\":\"cmdb.objects\",\"params\":{\"apikey\":\"#{token}\",\"filter\":{\"ids\":[\"33\"]}},\"version\":\"2.0\",\"id\":42}") .to_return(status: 200, body: read_message('object_types_filter_response'), headers: {}) params = {