Skip to content

Get Role Actions

prakharsrivastava25 edited this page Jul 8, 2017 · 14 revisions

Community Role Actions


API Desc
GET /communityrole/:domainName GET (Distinct)Roles & Theirs Actions for specified domain
POST /communityrole/:domainname POST Add a new Role with Actions
PATCH /communityrole/:domainname/roles/:rolename Update Role for change Actions

API

  1. get role actions of a specified community
  2. get roles in a specified community (in a community what role exists)
  3. Post the domain role actions and toolid.
  4. Add/Update role and actions of a specified community

get role actions of a specified community

URI

/communityrole/:domainName

Method:

GET

URL Params

Required:

domainName:text

Success Response:

  • code:200
    
  • content:   
          {
            "domain": "Engineer",
            "roleactions": [
              {
                "role": "admin",
                "toolid": "forum",
                "action": "edit",
                "grant": "self"
              },
              {
                "role": "admin",
                "toolid": "forum",
                "action": "likes",
                "grant": "true"
              },
              {
                "role": "admin",
                "toolid": "quora",
                "action": "post",
                "grant": "true"
              }
            ]
          }
    

Error Response:

  • code:400
  • content:please enter an existing domain

get distinct roles in a specified community (in a community what role exists)

URI

/communityrole/:domainName?onlyroles=true

Method:

GET

URL Params

Required:

domainName:text

Success Response:

  • code:200
    
  • content:[
      {
          "role": "professor"
      },
      {
          "role": "student"
      }
     ]
    

Error Response:

  • code:500
    
  • content:{"error": "Unexpected error occurred, please try again...!"}
    

POST domain,role,actions and toolid

URI

/communityroles/:domainname

Method:

POST

Request Content

[
{
    "role":"admin",
    "actions": {
        "post": "post",
        "guest": "true"
    },
    "toolId": "git"		
},
   {
    "role":"moderator",
    "actions": {
        "post": "false",
        "like": "true"
    },
    "toolId": "quora"
	
    }
]

Success Response:

  •  code:200
    
  •  content:Added
    

Error Response:

  • code:400
    
  • content:{"error": "entry already exists"}
    

Add/Update actions of a specified community

URI

/communityroles/:domainname/roles/:rolename

Method:

Patch

Request Content

[
{
    
  
    "actions": {
        "post": "false",
        "likes": "false"
    },
    "toolId": "quora"
	
},
{
    
   
    "actions": {
        "post": "true",
        "likes": "true"
    },
    "toolId": "forum"
	
}
]

URL Params

Required:

domainName:text role:text

Success Response:

  • code:200
    
  • content:Updated
    

Error Response:

  • code:400
    
  • content:{"error": "Error in operation, please try later..!"}
    

Clone this wiki locally