繁体   English   中英

Google Cloud Endpoint + Restful + CRUD

[英]Google Cloud Endpoint + Restful + CRUD

我正在使用Google App Engine和Google Cloud Endpoints在我的Android应用程序(前端)和在云中运行的Web服务(后端)之间进行通信。 但我想知道该URL用于GET和POST。

假设您在服务器上有一个注释列表,每个注释都有一个标题和一个ID。 根据CRUD(创建,更新,删除),HTTP / HTTPS调用应如下所示:

获取所有注释:

GET http://domain.eu/notes

通过ID获得特定的注释(假设为123):

GET http://domain.eu/notes/id

等等。 但是Google使用了不同的模式。 例如,如果您使用API​​资源管理器,则会收到如下调用:

GET https://domain/_ah/api/notesEndpoint/v1/notesdata

问题 :是否有一般方法可以致电列出所有笔记? 根据源代码中的注释,它应该有点像/ notes或/notes.listNodes,我只是不了解Google如何构造网址的

Google Cloud Endpoints使用API​​-Explorer系统。

/_ah/api是为API资源管理器定义的,您无法更改。 notesEndpoint是Api的名称,而v1是您定义的版本。 notesdata是方法的名称。 您可以通过注释覆盖路径。

示例,通过访问注释

域/ _ah / API / notesEndpoint / V1 /笔记

您必须使用以下方法:

@ApiMethod(
    name = "notes.listNodes",
    path = "notes",
    httpMethod = HttpMethod.GET
 )
 public List<Foo> notesdata() {
    return myList;
 }

(指向文档的链接: DOC

有关信息,请使用此系统使用以下URL浏览API:

GET http://domain.eu/_ah/api/explorer

暂无
暂无

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

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