Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if crafter-profile or crafter-social are running?

I'm trying to find a decent URL that would return something else than 404 on both crafter-profile and crafter-social so that I know for sure they are present in tomcat.

Any api/other urls I could use for that?

Thank you,

Nicolas

like image 299
Nicolas Dufour Avatar asked Jun 13 '17 16:06

Nicolas Dufour


1 Answers

For social:

  1. The 404 message is a custom one (https://github.com/cortiz/social/blob/2.5.x/server/src/main/webapp/404.jsp) you can check the HTML of the response to see if is the container default (or apache) or the one delivered by the applications.

  2. Make a Call to get a thread (can be non-existent) using curl or browser: /crafter-social/api/3/threads/test/comments?context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9 you should get a response like:

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": []}

  1. Curl the Swagger Documentation Service:/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 Transfer-Encoding: chunked Date: Tue, 13 Jun 2017 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"}}%  

`

For Profile:

  1. Make a Call to get an attribute from anon-existent user with a non-existent access token using curl or browser: /crafter-profile/api/1/profile/12333/attributes?accessTokenId=12345 you should get a response like:

`

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\""}%

`

Note: Neither of all the given options is the optimal, feel free to create a feature request here: https://github.com/craftercms/craftercms/issues to build a proper REST heartbeat monitor service for Profile and Social.

** Note 2** All of the above is valid only for 2.5.x.

like image 161
Cortiz Avatar answered Nov 14 '22 01:11

Cortiz