简体   繁体   中英

Using Cloudant API with IBMCloudCode

I have a cloudantDB server and database on it. On my js file, I create IBMCloudCode to call cloudantAPI.

js file:

app.value('IBM_CREDENTIALS',{
    APP_ROUTE: 'http://myserver.cloudant.com'
})
.factory('IBMService',['$http','IBM_CREDENTIALS', '$window',function($http,IBM_CREDENTIALS, $window){
    var config = {
      //  applicationId:IBM_CREDENTIALS.APP_ID,
        applicationRoute:IBM_CREDENTIALS.APP_ROUTE,
      //  applicationSecret:IBM_CREDENTIALS.APP_SECRET
    };

    IBMBluemix.initialize(config);
    var ibmCC = IBMCloudCode.initializeService();

    return {
        getProviderById:function(providerId){
          return ibmCC.get("/provider/_all_docs?key="ABC123"&include_docs=true");
        }

    }
}]);

But when debug to get API I have a error message : "IBMBluemix.getConfig(...).getBaaSURL is not a function". Please help me to review and give me your thoughts. Thanks!

According to npm, IBM Cloud Code is currently deprecated .

The corresponding backend services on Bluemix have been completely removed, so CloudCode will not work as expected.

If you continue to have issues, I suggest using something like the Request library to send simple REST requests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM