Skip to content

Community Templates

JananiVenkat edited this page Jul 14, 2017 · 9 revisions

APIs

Method API Desc
GET /communitytemplates/ Get the list of templates
GET /communitytemplates/allpurposes Get the list of purposes
GET /communitytemplates ?purpose=purpose Get the specified templates on purpose
GET /communitytemplates/:templatename Get the specified template on template name

1. Get the list of templates

URI

HTTP GET /communitytemplates

URL param

Required : None

Data param

 Required : None

Success Response:

 code : 200
 content :  [
{
    "name": "surgeon",
    "purpose": "medical",
    "description": "This template will provides you the required tools and roles to create a medical community",
    "tags": [
        "medcare",
        "doctor"
    ],
    "tools": [
        {
            "toolId": "forum",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit",
                "share"
            ],
            "activityEvents": [
                "newannouncement",
                "like",
                "remove"
            ]
        },
        {
            "toolId": "WeMedUp",
            "actions": [
                "postmesage",
                "read",
                "Likemessage"
            ],
            "activityEvents": [
                "newannouncement",
                "remove"
            ]
        },
        {
            "toolId": "sermo",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit"
            ],
            "activityEvents": [
                "like",
                "remove"
            ]
        }
    ],
    "rolesActions": [
        {
            "role": "admin",
            "toolsActions": [
                {
                    "toolId": "sermo",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "WeMedUp",
                    "actions": {
                        "bookmark": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "forum",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                }
            ]
        }
    ]
},{
    "name": "developer",
    "purpose": "technical",
    "description": "This template will provides you the required tools and roles to create a technical 
     community",
    "tags": [
        "IDE",
        "platform"
    ],
    "tools": [
        {
            "toolId": "Stackoverflow",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit",
                "share"
            ],
            "activityEvents": [
                "newannouncement",
                "remove"
            ]
        },
        {
            "toolId": "Quora",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "comment",
                "share",
                "invitation"
            ],
            "activityEvents": [
                "like",
                "remove"
            ]
        },
        {
            "toolId": "Github",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit",
                "upload"
            ],
            "activityEvents": [
                "newannouncement",
                "like"
            ]
        }
    ],
    "roleActions": [
        {
            "role": "moderator",
            "toolsActions": [
                {
                    "toolId": "forum",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "scholastic.com",
                    "actions": {
                        "bookmark": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "theteacherscorner.net",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                }
            ]
        }
    ]
}]  

Error Response:

 code:404
 content:{error: "Templates not found"}

  OR
 
 code:500
 content:{error: "Unauthorised internal error occurred..."}

2. Get the list of purposes

URI

HTTP GET /communitytemplates/allpurposes

URL param

Required : None

Data param

 Required : None

Success Response:

 code : 200
 content :  [
"Medical",
"Technical",
"Teaching",
"Arts"
 ]

Error Response:

 code:404
 content:{error: "purposes not found"}

  OR
 
 code:500
 content:{error: "Unauthorised internal error occurred..."}

3. Get the specified templates based on purpose

URI

HTTP GET /communitytemplates?purpose=purpose

URL param

Required : None

Data param

 Required : purpose = [string]

 If the query parameter is not mentioned, then /communitytemplates API will get called

Success Response:

 code : 200
 content :  [
{
    "name": "surgeon",
    "purpose": "medical",
    "description": "This template will provides you the required tools and roles to create a medical 
                    community",
    "tags": [
        "medcare",
        "doctor"
    ],
    "tools": [
        {
            "toolId": "forum",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit",
                "share"
            ],
            "activityEvents": [
                "newannouncement",
                "like",
                "remove"
            ]
        },
        {
            "toolId": "WeMedUp",
            "actions": [
                "postmesage",
                "read",
                "Likemessage"
            ],
            "activityEvents": [
                "newannouncement",
                "remove"
            ]
        },
        {
            "toolId": "sermo",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit"
            ],
            "activityEvents": [
                "like",
                "remove"
            ]
        }
    ],
    "rolesActions": [
        {
            "role": "admin",
            "toolsActions": [
                {
                    "toolId": "sermo",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "WeMedUp",
                    "actions": {
                        "bookmark": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "forum",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                }
            ]
        }
    ]
},

Error Response:

 code:500
 content:{error: "Unauthorised internal error occurred"}

 OR
 
 code:400
 content:{error: "Bad request"}

4. Get the specified templates based on template name

URI

HTTP GET /communitytemplates/:templatename

URL param

 Required : templatename = [string]

Data Param

 Required : None

Success Response

 code:200
 content :  [
{
    "name": "surgeon",
    "purpose": "medical",
    "description": "This template will provides you the required tools and roles to create a medical 
                    community",
    "tags": [
        "medcare",
        "doctor"
    ],
    "tools": [
        {
            "toolId": "forum",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit",
                "share"
            ],
            "activityEvents": [
                "newannouncement",
                "like",
                "remove"
            ]
        },
        {
            "toolId": "WeMedUp",
            "actions": [
                "postmesage",
                "read",
                "Likemessage"
            ],
            "activityEvents": [
                "newannouncement",
                "remove"
            ]
        },
        {
            "toolId": "sermo",
            "actions": [
                "postmesage",
                "read",
                "Likemessage",
                "edit"
            ],
            "activityEvents": [
                "like",
                "remove"
            ]
        }
    ],
    "rolesActions": [
        {
            "role": "admin",
            "toolsActions": [
                {
                    "toolId": "sermo",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "WeMedUp",
                    "actions": {
                        "bookmark": "self",
                        "post": "post_self"
                    }
                },
                {
                    "toolId": "forum",
                    "actions": {
                        "edit": "self",
                        "post": "post_self"
                    }
                }
            ]
        }
    ]
},

Error Response:

 code:500
 content:{error: "Unauthorised internal error occurred"}

 OR
 
 code:400
 content:{error: "Bad request"}