我正在尝试找到一个不错的网址,它会在crafter-profile和crafter-social上返回404以外的其他内容,以便我确信它们存在于tomcat中。
我可以使用的任何api /其他网址?
谢谢,
尼古拉斯
答案 0 :(得分:4)
对于社交:
404消息是自定义消息(https://github.com/cortiz/social/blob/2.5.x/server/src/main/webapp/404.jsp)您可以检查响应的HTML,以查看容器是否为默认(或apache)或应用程序提供的消息。
使用curl或浏览器拨打电话获取一个帖子(可能不存在):/crafter-social/api/3/threads/test/comments?context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9
您应该得到如下回复:
HTTP/1.1 200
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET, PUT, DELETE
Access-Control-Max-Age: 3600
Access-Control-Allow-Headers: x-requested-with
Access-Control-Allow-Credentials: false
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 13 Jun 2017 16:45:31 GMT
{"total":0,"pageSize":666,"pageNumber":0,"watched":false,"comments":
[]}
/crafter-social/api-docs
` HTTP / 1.1 200 Access-Control-Allow-Origin:* Access-Control-Allow-Methods:POST,GET,PUT,DELETE Access-Control-Max-Age:3600 Access-Control-Allow-Headers:x-requested-with Access-Control-Allow-Credentials:false Content-Type:application / json; charset = UTF-8 转移编码:分块 日期:2017年6月13日星期二17:12:45 GMT
{"apiVersion":"1.0","swaggerVersion":"1.2","apis":[{"path":"/default/comment-services","description":"Comments services"},{"path":"/default/comment-services-extension","description":"Comments services Extension"},{"path":"/default/handles-context-configuration","description":"Creates and associates Social Context to profiles"},{"path":"/default/security-actions","description":"Services to Admin Security Actions"},{"path":"/default/system-profile","description":"Clears profile cache,Only for Social Admins or Super Admins."},{"path":"/default/threads-controller","description":"Threads Controller"}],"info":{"title":"API Title","description":"API Description","termsOfServiceUrl":"API terms of service","contact":"API Contact Email","license":"API Licence Type","licenseUrl":"API License URL"}}%
`
对于个人资料:
/crafter-profile/api/1/profile/12333/attributes?accessTokenId=12345
您应该得到如下响应:`
HTTP/1.1 403
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 13 Jun 2017 17:03:39 GMT
{"errorCode":"NO_SUCH_ACCESS_TOKEN_ID","message":"No access token found for ID \"12345\""}%
`
注意:强> 所有给定选项都不是最佳的,可以在此处创建功能请求:https://github.com/craftercms/craftercms/issues为Profile and Social构建适当的REST心跳监视器服务。
**注2 ** 以上所有内容仅适用于2.5.x.