pythonibm-cloudibm-watsonwatson-discovery

WatsonApiException: Error: The Preview API was removed on 2019-09-30


I am trying to access the IBM Watson Discovery API (Free Trial) using the piece of code below:

with open(filename, "r") as f:
    res = discovery.test_configuration_in_environment(environment_id=env_id, configuration_id=cfg_id, file=f).get_result()

You can view the full code file here: https://github.com/udacity/AIND-NLP-Bookworm/blob/master/bookworm.ipynb. I am getting the following error on running this:

---------------------------------------------------------------------------
WatsonApiException                        Traceback (most recent call last)
<ipython-input-10-17e98c795a32> in <module>()
      3 filename = os.path.join(data_dir, "sample.html")
      4 with open(filename, "r") as f:
----> 5     res = discovery.test_configuration_in_environment(environment_id=env_id, configuration_id=cfg_id, file=f).get_result()
      6 print(json.dumps(res, indent=2))

/opt/conda/lib/python3.6/site-packages/watson_developer_cloud/discovery_v1.py in test_configuration_in_environment(self, environment_id, configuration, step, configuration_id, file, metadata, file_content_type, filename, **kwargs)
    702             params=params,
    703             files=form_data,
--> 704             accept_json=True)
    705         return response
    706 

/opt/conda/lib/python3.6/site-packages/watson_developer_cloud/watson_service.py in request(self, method, url, accept_json, headers, params, json, data, files, **kwargs)
    585             error_info = self._get_error_info(response)
    586             raise WatsonApiException(response.status_code, error_message,
--> 587                                      info=error_info, httpResponse=response)

WatsonApiException: Error: The Preview API was removed on 2019-09-30., Code: 410 , X-dp-watson-tran-id: 569fbd407a75c23f850522571bddee26 , X-global-transaction-id: 569fbd407a75c23f850522571bddee26

Any known workarounds?


Solution

  • As per the release notes and the response you are seeing the Preview API was deprecated on the 4th June 2019 - https://cloud.ibm.com/docs/discovery?topic=discovery-release-notes#4jun19 - and removed on the 30 Sept 2019 - https://cloud.ibm.com/docs/discovery?topic=discovery-release-notes

    The Discovery API is still available - https://cloud.ibm.com/apidocs/discovery/discovery , just not the preview method.

    What is it that you are trying to do?