Tag: rest

如何使用REST和本地JavaScript访问HP ALM?

我只想通过REST API在浏览器(IE11,Firefox)中通过本地编写的javascript js访问ALM ,但我无法登录。 这是我通过jquery请求LWSSO cookie的代码: var auth = btoa(USER+”:”+PASSWORD); $.ajax({ type: “POST”, url: https://alm.xxx.net/qcbin/authentication-point/j_spring_security_check, headers: { “Authorization”: “Basic ” + auth }, success : function(data) { }, }); 响应头包含: https://alm.xxx.net/qcbin/authentication-point/login.jsp;jsessionid=1gfsdk4pn525f1ur55e2x2zzte?login_error 使用OTA/directX对象一切正常但我想通过javascript使用REST API。 谁能帮我?

无法从复选框向REST传递正确的值

我正在尝试学习Web开发并尝试做一些基本的复选框教程,但我坚持将值发送给Rest Service。 我的意图是,例如,如果选中了两个复选框,我应该能够在我的Rest Service中捕获它并执行某些操作。 下面是HTML文件 Graph1 Graph2 Graph3 Graph4 $(“#btnGetResponse”).click(function() { var ids = $(‘[name=”graphId”]:checked’).map(function() { return this.id; }).get(); console.log(ids); $.ajax({ type: “GET”, url: “http://localhost:51349/SMS_Rest.svc/v1/CheckBox”, data: { graphId: ids }, contentType: “application/json; charset=utf-8”, dataType: “json”, success: function(response) { if (response == true) { alert(‘hello’); } }, failure: function(response) { alert(‘fail’); } }); }); 如果我选择一个复选框,则生成的URL是: http://localhost:51349/SMS_Rest.svc/v1/CheckBox?graphId%5B%5D=1 […]

REST查询有两个列表

是否可以同时查询两个列表? url: http : //sites.com/url/_api/web/lists/GetByTitle (’List1’) url: http : //sites.com/url/_api/web/lists/GetByTitle (’List1’和’List2’)

使用jQueryrest调用

我试图使用jQuery从以下URL获取返回的信息: Var URL = http://getdeeplink.linksynergy.com/createcustomlink.shtml?token=2e9830b7ed11c5dee96dd4b4a9e83da216c9d583ae1e617bcafdd6eb004e3c86&mid=13508&murl=http://itunes.apple.com/us/music-video/if-you-think-this-song-is/id413824018?uo=4 我已经尝试了下面概述的两种方法,但在这两种情况下,程序只运行代码块,就像没有发生任何事情一样。 谁能说出我做错了什么? $.ajax({ type: “GET”, dataType: “jsonp”, url: URL, success: function(data){ alert(data); } }); 第二种方法: $.get(URL, function(data) { alert(‘Load was performed.’); alert(data); });

使用REST上传文件中的文件数据为null

我有以下代码 self.upload = function (file) { var path = $(‘#fileUpload’).val(); var fr= new FileReader(); var ID = JSON.stringify({ ID:23, Name: file.name, Type: file.type, Size: file.size, Path: path, data:fr.readAsDataURL(file), }); $.ajax({ cache: false, url: “http://localhost:49589/api/files”, type: “POST”, dataType: “json”, data: ID, contentType: “application/json; charset=utf-8”, processData: false, success: function (json) { alert(“Data Returned: ” + JSON.stringify(json)); }, […]

neo4j访问控制头

我正在使用neo4j REST api并进行jquery ajax调用这是我第一次使用REST 我试图打这样的电话: $.ajax({ url: “http://localhost:7474/db/data/cypher”, accepts: “application/json; charset=UTF-8″, contentType:”application/json”, dataType:”json”, data:{ “query” : “start n = node(*) return n”, “params” : {} }, type:”POSt”, success:function(data,xhr,status) { console.log(data); }, error:function(xhr,err,msg){ console.log(xhr); console.log(err); console.log(msg); } }); 使用此我得到以下错误: XMLHttpRequest cannot load http://localhost:7474/db/data/cypher. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost’ is therefore […]

AJAX调用不适用于RESTful Web服务?

我有一个简单的restful服务,返回一个json。 我想进行ajax调用以获取所需的数据。 当我尝试使用firefox的RestClient时没有问题。 服务返回json,我可以看到rest客户端上的json。 但是当我使用ajax调用它失败了。 控制台显示200 OK ,但在调用后执行错误function。 我搜索了这个,通常他们说这是一个跨域问题,但我没有解决这个问题。 这是错误函数{“readyState”:0,”responseText”:””,”status”:0,”statusText”:”error”}的失败消息{“readyState”:0,”responseText”:””,”status”:0,”statusText”:”error”} AJAX电话 $.ajax({ type:”GET”, url: “http://localhost:8080/myController/getInfo”, dataType:”json”, success: function(data){ alert(JSON.stringify(data)); }, error: function(msg){ alert(“ERROR! \n” + JSON.stringify(msg)); } }); Firefox的控制台消息 Content-Type application/json Date Mon, 18 Feb 2013 11:51:41 GMT Server Apache-Coyote/1.1 Transfer-Encoding chunked Accept application/json, text/javascript, */*; q=0.01 Accept-Encoding gzip, deflate Accept-Language tr-TR,tr;q=0.8,en-US;q=0.5,en;q=0.3 Host localhost:8080 Origin […]

在邮递员中显示输出REST API状态到AJAX

在Postman中,我可以成功地与我的REST API进行通信。 我可以将我的API服务器置于各种人工状态,以表示我可以在Postman中成功查看的2xx,4xx和5xx错误,如下所示: 邮递员能够收集此信息,无论API服务器是否正在运行并且它似乎是通用状态响应,而不是API应用程序生成的响应。 我的问题是,如何在我的Javascript应用程序中将其输出到console.log()? 在我的实例中,我想在表单提交的后端输出AJAX函数内的状态: $.ajax(settings).done(function(response, jqXHR, data) { console.log(“Return Code: ” + data.status); }) .fail(function(jqXHR, textStatus, errorThrown) { console.log(“Return Code: ” + ??? ); }); }); 当我获得成功时,我的data.status工作正常,但可能有一个我可以利用的变量是通用状态消息?

发布function错误:找到没有类型名称的条目

尝试将数据发布到sharepoint列表时,我有一个ajax调用错误400。 例外是Microsoft.SharePoint.Client.InvalidClientQueryException并且消息是“找到了没有类型名称的条目,但没有指定预期类型。要允许没有类型信息的条目,还必须在指定模型时指定期望的类型。” 我的代码.. //Get form digest value function getFormDigest(webUrl) { return $.ajax({ url: webUrl + “/_api/contextinfo”, method: “POST”, headers: { “Accept”: “application/json; odata=verbose” } }); } //Create list item to add to sharepoint list function createListItem(webUrl, listName, itemProperties) { return getFormDigest(webUrl).then(function (data) { return $.ajax({ url: webUrl + “/_api/web/lists/getbytitle(‘” + listName + “‘)/items”, type: “POST”, […]

呼叫restapi并显示搜索结果

我从这个HTML表单调用REST API Enter your zip code Zip Code Next 我的API结构如下所示 { “Agents”: { “@ZipCode”: “33176”, “Agent”: [ { “AgencyID”: “21”, “Name”: “Anakarina Callejas”, “Phone”: “305-515-5613”, “CityName”: “KENDALL”, “Address”: “10471 N Kendall Dr. #101. Miami, FL 33176”, “Reviews-Rating”: “5”, “Reviews-Count”: “74”, “image”: “/images/agents/21.png” }, { “AgencyID”: “116”, “Name”: “Tamara Mourino”, “Phone”: “305-256-0616”, “CityName”: “PINECREST”, “Address”: “12745 […]