主要内容

GET请求结果

检索要求的结果

描述

使用GET方法从服务器检索请求的结果。的URI。自我字段用作方法的可寻址资源。

下面几节使用JSON作为数据序列化格式。下面的示例演示了如何使用protobuf作为Java的数据序列化格式®客户端API,看检索请求的结果

请求

HTTP方法

得到

URI

http://host {request-uri-string} /结果

响应

成功

HTTP状态代码

200好了

身体

结果用JSON表示。

例子

{“韩”:[[[17日,24日,1、8、15],[23日5、7、14、16),(4、6、13、20、22],[3]10、12、19日,21日,[2 11日,18日,25日,9]]]}

错误

HTTP状态代码

404年RequestNotFound

410年RequestAlreadyCompleted

410年RequestAlreadyCancelled

410年RequestAlreadyDeleted

500年InternalServerError

示例调用

HTTP

要求:

GET /~f76280c5-b94c-4cd9-8eb6-841532788583/requests/ad063314- eda -4310-b356-59420058c17c/result HTTP/1.1 Host: localhost:9910

回应:

状态码:200好{“韩”:[[[17日,24日,1、8、15],[23日5、7、14、16),(4、6、13、20、22],[3]10、12、19日,21日,[2 11日,18日,25日,9]]]}

JavaScript

Var data = null;var xhr = new XMLHttpRequest();xhr。adddeventlistener ("readystatechange", function () {if (this.);readyState === 4) {console.log(this.responseText);} });xhr。开放(“得到”、“http://localhost: 9910 / ~ f76280c5 b94c - 4 cd9 - 8 eb6 - 841532788583 /请求/ ad063314 ebda - 4310 b356 - 59420058 c17c /结果”);xhr.send(数据);

介绍了R2016b