简体   繁体   English

无法使用Bluemix从移动数据中检索数据

[英]Not able to retrieve data from mobile data using bluemix

I am trying to retrieve data from mobile data services using bluemix. 我正在尝试使用bluemix从移动数据服务中检索数据。

The code that I am using is: 我正在使用的代码是:

jQuery.ajax({
    type: 'GET',//POST
    url: 'https://mobile.ng.bluemix.net:443/data/rest/v1/apps/c3b20173-b6a4-42d0-b543-93da13c1953e/objects?classname=Report&start=0&num=0',
    headers: {"IBM-Application-Secret": "2fc3aa67db1ab71a80f4f38aa1770ff802120848"},
    data: data,
    dataType: 'json',
    crossDomain: true,
    success : getData,
    error : throwError
})
function getData(data)
{ 
    console.log('GOT REPORT' + JSON.stringify(data));
}

function throwError(data)
{ 
    /*var query = Bluemixdata.Query.ofType("Report");
    query.find({Severity: "SEV 4"});
    console.log('Pallavi'+ JSON.stringify(query));*/
    console.log('GOT REPORTError' + JSON.stringify(data));
}

but on executing the control is moving to throwError method somehow may be its not hitting the URL. 但是在执行控件时,它正以某种方式移至throwError方法,这可能是因为它没有到达URL。 Please suggest if I am doing anything wrong. 请建议我是否做错了什么。 Want to acknowledge that I am getting data through bluemix console and via postman but not able to retrieve using code. 要确认我正在通过bluemix控制台和邮递员获取数据,但是无法使用代码进行检索。

Even tried to retrieve data using Bluemixdata.Query.ofType("Report"); 甚至尝试使用Bluemixdata.Query.ofType("Report");检索数据Bluemixdata.Query.ofType("Report"); but getting IBMBluemix not defined error message that should be thrown as <script type="text/javascript" src="js/Bluemix/IBMBluemix.js"></script> is already defined in index.html above all the below given js 但得到IBMBluemix not defined应该被抛出错误消息<script type="text/javascript" src="js/Bluemix/IBMBluemix.js"></script>已经在定义index.html所有下面给出JS上方

LogCat Console Output:
08-13 14:36:21.993: E/AndroidProtocolHandler(21658): Unable to open asset URL: file:///android_asset/www/default/js/Bluemix/cordova_plugins.js
08-13 14:36:22.343: I/chromium(21658): [INFO:CONSOLE(10)] "calling bluemix initialize with values----------------", source: file:///android_asset/www/default/js/Services.js (10)
08-13 14:36:22.423: I/chromium(21658): [INFO:CONSOLE(13)] "----  IBM Bluemix Initializing ------", source: file:///android_asset/www/default/js/Services.js (13)
08-13 14:36:22.433: I/chromium(21658): [INFO:CONSOLE(16)] "HiPal", source: file:///android_asset/www/default/js/Services.js (16)
08-13 14:36:22.433: I/chromium(21658): [INFO:CONSOLE(17)] "GOT A PERSON ----[object Object]", source: file:///android_asset/www/default/js/Services.js (17)
08-13 14:36:22.453: I/chromium(21658): [INFO:CONSOLE(36)] "GOT REPORTError{"statusText":"Not Found","status":404,"response":"","responseType":"","responseXML":null,"responseText":"","upload":{"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null},"withCredentials":false,"readyState":4,"timeout":0,"ontimeout":null,"onprogress":null,"onloadstart":null,"onloadend":null,"onload":null,"onerror":null,"onabort":null}", source: file:///android_asset/www/default/js/BarChart.js (36)

Is there a reason you are using jQuery.ajax to formulate your REST request? 您是否有理由使用jQuery.ajax来制定REST请求? I suspect there is something wrong with the way you are configuring the request. 我怀疑您配置请求的方式有问题。

If you are going to use our hybrid SDK, you can use the APIs we provide, located here to accomplish the same thing. 如果您要使用我们的混合SDK,则可以使用此处提供的API来完成相同的任务。

I also notice that the Bluemix Cordova plugin is having some problems. 我还注意到Bluemix Cordova插件存在一些问题。 Try removing your android platform from your cordova project and re-add it. 尝试从cordova项目中删除您的android平台,然后重新添加。 You can try the same with the plugins. 您可以使用插件尝试相同的操作。

Also, I recommend checking out the sample bluemixcordovadata for more detailed usages and general help. 另外,我建议您查看样本bluemixcordovadata以获得更多详细用法和一般帮助。

Warning : Please avoid pasting your app secret since this is a public forum. 警告 :由于这是一个公开论坛,请避免粘贴您的应用程序秘密。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从Wordpress检索网站的移动版本的数据 - Retrieve data from Wordpress for mobile version of the site IBM Bluemix移动数据服务,将数据加载到云中 - IBM Bluemix Mobile Data Services, Loading data into the cloud Bluemix Mobile Analytics:看不到我的应用程序发送的日志记录数据 - Bluemix Mobile Analytics: Can't see logging data sent from my app 我正在尝试为我的Flex Mobile应用程序使用php从mysql检索数据,但是没有运气 - I'm trying to retrieve data from mysql using php for my Flex Mobile application, but no luck JQuery Mobile PHP MySQL从第一页基于第二页的选择中检索数据 - JQuery Mobile PHP MySQL retrieve data in second page based selection from first page 移动应用未使用模拟器显示来自api的数据 - Mobile App is not showing data from api using emulator 使用手机查询数据时数据丢失 - Data loss when querying data using mobile Angular2,Ionic2:如何在手机中存储数据并进行检索? - Angular2,Ionic2: How to store data in a mobile and retrieve it? 如何使用Bluemix在混合移动应用程序中实现推送通知 - How to implement Push Notification in Hybrid Mobile Application using Bluemix 使用 Bluemix 移动服务仪表板和基础下载代码出错 - Using Bluemix Mobile Services dashboard and foundation download code gives error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM