Skip to content

Communities

Prabhsimran Singh edited this page Jul 16, 2017 · 14 revisions
  • APIs For Creation of new community, Getting Details for a particular Community, Updating Details of a particular Community

APIs

Request API Desc
POST /communities/:domain Add Details to create a new Community
GET /communities/:domain?counter Get Details of a particular Community
PATCH /communities/:domain/ Update Details of a particular Community

1. Add Details to create a new Community

URI:

HTTP POST /communities/:domain

URI Params:

Required: :domain <ex: illuminati> 

Data Params:

Required:
body: {
    "description": "this is the first community",
    "name": "Digital by wipro",
    "owner": "prakhar@stackroute.in",
    "avatar": "/abcdefghi.jpg",
    "purpose": "medical",
    "tags": [
        "first",
        "second"
    ],
    "template": "Surgeon",
    "visibility": "Public"
}

Success Response:

code: 201
content: 
{
    "domain": "illuminati",
    "avatar": "/abcdefghi.jpg",
    "createdby": "prakhar@stackroute.in",
    "createdon": "2017-06-22T03:32:11.413Z",
    "description": "this is the first community",
    "name": "Digital by wipro",
    "owner": "prakhar@stackroute.in",
    "purpose": "medical",
    "tags": [
        "first",
        "second"
    ],
    "status": "Active",
    "template": "Surgeon",
    "updatedby": "prakhar@stackroute.in",
    "updatedon": "2017-06-22T03:32:11.413Z",
    "visibility": "Public"
}

Error Response:

code: 500
error: 
'Internal Server Error' 
OR
'Error in operation, try again later'
------------
code: 400
error:
     Please pass some data to process
     OR
     Domain Name has to be at least 5 characters long and consist of Alphanumeric Values and a (.)
     OR
     At least one Tag is required to be passed
     OR
     A Name needs to be passed
     OR
     An Owner value needs to be passed
     OR
     A Template Value needs to be passed
     OR
     A Community has to have a purpose
     OR
     An Avatar needs to be added
     OR
     Visibility can be from given values only, either 'Public', 'Private' or 'Moderated'

2. Get Details of a particular Community

URI:

HTTP GET /communities/:domain?counter=<true/false>

URI Params:

Required: domain[text]

Data Params:

Required: counter=true/false

Success Response:

code: 200
content: [] <when domain is not registered>
    OR
<when domain is registred with calvin-communities>
content: when counter = true
{
    "domain": "illuminati",
    "avatar": "/abcdefghi.jpg",
    "createdby": "prakhar@stackroute.in",
    "createdon": "2017-06-22T03:32:11.413Z",
    "description": "this is the first community",
    "name": "Digital by wipro",
    "owner": "prakhar@stackroute.in",
    "purpose": "medical",
    "tags": [
        "first",
        "second"
    ],
    "status": "Active",
    "template": "Surgeon",
    "updatedby": "prakhar@stackroute.in",
    "updatedon": "2017-06-22T03:32:11.413Z",
    "visibility": "Public"
    "invitations": "5",
    "members": "9",
    "requests": "6",
    "tools": "2"
}
 OR when counter = false OR doesn't exist
{
    "domain": "illuminati",
    "avatar": "/abcdefghi.jpg",
    "createdby": "prakhar@stackroute.in",
    "createdon": "2017-06-22T03:32:11.413Z",
    "description": "this is the first community",
    "name": "Digital by wipro",
    "owner": "prakhar@stackroute.in",
    "purpose": "medical",
    "tags": [
        "first",
        "second"
    ],
    "status": "Active",
    "template": "Surgeon",
    "updatedby": "prakhar@stackroute.in",
    "updatedon": "2017-06-22T03:32:11.413Z",
    "visibility": "Public"
 }

Error Response:

code: 500
error:
'Error in operation, try again later'

3. Update Details of a particular Community

URI:

HTTP PATCH /communities/:domain

URI Params:

Required: domain[text] 

Data Params:

Required: 
body: 
{
"name": "Digital by wipro",
"avatar": "/abcdefghi.jpg",
"description": "this is the first community",
"visibility": "Public",
"tags": [ 
    "first",
    "second"
  ],
"updatedby": "prakhar@stackroute.in"
}

Success Response:

code: 202
content: 
{
    "domain": "illuminati",
    "avatar": "/abcdefghi.jpg",
    "createdby": "prakhar@stackroute.in",
    "createdon": "2017-06-22T03:32:11.413Z",
    "description": "this is the second community",
    "name": "Digital by wipro",
    "owner": "prakhar@stackroute.in",
    "purpose": "medical",
    "tags": [
        "first",
        "second"
    ],
    "status": "Active",
    "template": "Surgeon",
    "updatedby": "prakhar@stackroute.in",
    "updatedon": "2017-06-22T03:32:11.413Z",
    "visibility": "Public"
}

Error Response:

code: 500
error:
'Error in operation, try again later'
OR
code: 400
    error: 
        'Please pass some data to process'
        OR
        'At least one Tag is required to to be passed'
        OR
        'A Name needs to be passed'
        OR
        'An Updater's data is required to be sent'        

Clone this wiki locally