suchowan / watson-api-client

An IBM Watson™ API client
MIT License
27 stars 10 forks source link

call to `rest_access_with_body` wont accept any format of the :body [ WatsonAPIClient::Discovery ] #9

Open aldeano19 opened 6 years ago

aldeano19 commented 6 years ago

While calling WatsonAPIClient::Discovery.updateEnvironment always get 415 Unsupported Media Type for any format of :body

swagger reference: on https://watson-api-explorer.ng.bluemix.net/listings/discovery-v1.json search for operationId: "updateEnvironment"

Code

service = WatsonAPIClient::Discovery.new(
                                             :user=>"#{username}",
                                             :password=>"#{password}",
                                             :verify_ssl=>OpenSSL::SSL::VERIFY_NONE)

service.updateEnvironment(
      environment_id: "#{env_id}",
      version: "2018-03-05",
      body: p 
    )

This might be a problem with RestClient itself since I tried hard coding the :payload on the put(payload, additional_headers={}, &block) method. It wouldn't accept these: Object, Hash, String, Json String, always returning 415 Unsupported Media Type.

watson-api-client (0.0.8) rest-client (2.0.2)

suchowan commented 6 years ago

Although it is not a complete measure, I tried to deal with it. Please see commit https://github.com/suchowan/watson-api-client/commit/69355c3765c40050ee6c7a473056e83633525ee1 .