-
Notifications
You must be signed in to change notification settings - Fork 4
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
| 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 |
HTTP POST /communities/:domain
Required: :domain <ex: illuminati>
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"
}
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"
}
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'
HTTP GET /communities/:domain?counter=<true/false>
Required: domain[text]
Required: counter=true/false
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"
}
code: 500
error:
'Error in operation, try again later'
HTTP PATCH /communities/:domain
Required: domain[text]
Required:
body:
{
"name": "Digital by wipro",
"avatar": "/abcdefghi.jpg",
"description": "this is the first community",
"visibility": "Public",
"tags": [
"first",
"second"
],
"updatedby": "prakhar@stackroute.in"
}
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"
}
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'