Crafter Social (4.5.0)

Download OpenAPI specification:

E-mail: info@craftercms.org License: GPL 3.0

Crafter Social API

All request in this API require the user to be authenticated with the following steps:

  1. Send a POST request to the /crafter-social/crafter-security-login endpoint with the username and password parameters

  2. Include the cookies set in the response of the login in later requests

Besides setting the authentication cookies the login response also provides the user’s information:

{
    "ticket":"0489ca78-cd96-46c2-bc96-c1ea1fa4db6f",
    "profile":{
        "username":"admin",
        "password":null,
        "email":"admin@example.com",
        "verified":false,
        "enabled":true,
        "createdOn":1554832283831,
        "lastModified":1554834126479,
        "tenant":"default",
        "roles":[
            "SOCIAL_SUPERADMIN",
            "PROFILE_SUPERADMIN"
        ],
        "attributes":{
            "socialContexts":[
                {
                    "name":"Default",
                    "id":"f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
                    "roles":[
                        "SOCIAL_ADMIN",
                        "SOCIAL_MODERATOR",
                        "SOCIAL_USER"
                    ]
                }
            ]
        },
        "failedLoginAttempts":0,
        "lastFailedLogin":null,
        "id":"5cacdb9b386f920d482a5ad4"
    },
    "remembered":false
}

actions

Security Actions

Get Current Actions

Module: Social
Gets all Security Actions for current context.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    },
  • {
    }
]

Update Actions

Module: Social
Updates the given action name with the Roles.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

actionName
required
string
Example: actionName=ugc.moderate

The name of the action to update

roles
required
string
Example: roles=CUSTOM_MODERATOR,SOCIAL_SUPERADMIN,SOCIAL_ADMIN,SOCIAL_MODERATOR

List of roles to assign to the action

Responses

Response samples

Content type
application/json
{
  • "actionName": "ugc.moderate",
  • "roles": [
    ],
  • "contextId": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "_id": "59663b4be61296e1be35358c"
}

context

Social contexts management

Get All Social Contexts

Module: Social
Returns a list of all Social Contexts.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Create Social Context

Module: Social
Creates a new Social Context.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
contextName
string

The name of the new Social Context

Responses

Request samples

Content type
application/json
{
  • "contextName": "site1"
}

Response samples

Content type
application/json
{
  • "contextName": "site1",
  • "_id": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Add Profile To Social Context

Module: Social
Updates the socialContext attribute in the given profile to include the Social Context ID and the list of roles assigned for that context.

path Parameters
id
required
string
Example: e41e7273-b504-4d50-9edd-3b215eff6464

The ID of the Social Context to add

profileId
required
string
Example: 596683c030047dc279c21d27

The ID of the profile to update

Request Body schema: application/json
required
context
string

The ID of the Social Context

roles
string

The list of roles to assign

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "roles": "SOCIAL_USER"
}

Response samples

Content type
application/json
{
  • "username": "john.doe",
  • "email": "john.doe@example.com",
  • "verified": false,
  • "enabled": false,
  • "createdOn": "2017-07-12T14:17Z",
  • "lastModified": "2017-07-12T14:37Z",
  • "tenant": "sample-tenant",
  • "roles": [ ],
  • "attributes": {
    },
  • "id": "596683c030047dc279c21d27"
}

Remove Profile from Social Context

Module: Social
Updates the socialContext attribute in the given profile to remove the Social Context ID and the list of roles assigned for that context.

path Parameters
id
required
string
Example: e41e7273-b504-4d50-9edd-3b215eff6464

The ID of the Social Context to remove

profileId
required
string
Example: 596683c030047dc279c21d27

The ID of the profile to update

Request Body schema: application/json
required
context
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
{
  • "username": "john.doe",
  • "email": "john.doe@example.com",
  • "verified": false,
  • "enabled": false,
  • "createdOn": "2024-07-12T14:17Z",
  • "lastModified": "2024-07-12T14:37Z",
  • "tenant": "sample-tenant",
  • "roles": [ ],
  • "attributes": {
    },
  • "id": "596683c030047dc279c21d27"
}

Update Email Configuration

Module: Social
Updates the email configuration for a given Social Context.

Request Body schema: application/json
required
context
string

The ID of the Social Context

encoding
string

Character encoding for the email body

host
string

The hostname of the email server

port
string

The port of the email server

auth
boolean

Enable if the email server requires authentication

username
string

The username for the email server

password
string

The password for the email server

tls
boolean

Enable if the email server requires a secure connection

replyTo
string

Email address used for replies

from
string

Email address used to send notifications

priority
integer

The priority for the emails

subject
string

The subject for the emails

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "encoding": "UTF-8",
  • "host": "mail.example.com",
  • "port": 25,
  • "auth": true,
  • "username": "user",
  • "password": "passw0rd",
  • "tls": true,
  • "replyTo": "reply@example.com",
  • "from": "site1@example.com",
  • "priority": 3,
  • "subject": "Site1 Updates"
}

Response samples

Content type
application/json
{
  • "password": "passw0rd",
  • "port": 25,
  • "auth": true,
  • "subject": "Site1 Updates",
  • "host": "mail.example.com",
  • "replyTo": "reply@example.com",
  • "tls": true,
  • "from": "site1@example.com",
  • "encoding": "UTF-8",
  • "priority": 3,
  • "username": "user"
}

Get Email Configuration

Module: Social
Returns an email configuration for a given Social Context.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
{
  • "host": "localhost",
  • "encoding": "UTF-8",
  • "port": 25,
  • "auth": false,
  • "username": "",
  • "password": "",
  • "tls": false,
  • "replyTo": "social@example.com",
  • "from": "social@example.com",
  • "priority": 5,
  • "subject": "Latest change on your subscribed threads for Social"
}

Update Email Template

Module: Social
Updates an email template for a given Social Context.

Request Body schema: application/json
required
context
string

The ID of the Social Context

template
string

The body of the email template

type
string

The type of the email template
The possible values for the type parameter are:

  • DAILY
  • WEEKLY
  • INSTANT
  • APPROVEREMAIL
  • APPROVER_RESULT_TEMPLATE

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "template": "Sample template for email",
  • "type": "INSTANT"
}

Response samples

Content type
application/json
true

Get Email Template

Module: Social
Returns an email template for a given Social Context.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

type
required
string
Example: type=INSTANT

The type of the email template
The possible values for the type parameter are:

  • DAILY
  • WEEKLY
  • INSTANT
  • APPROVEREMAIL
  • APPROVER_RESULT_TEMPLATE

Responses

Response samples

Content type
application/json
{
  • "template": "Hi ${profile.username} this are changes that happen on your subscribe Threads<#list digest as change><h1> ${change[\"_id\"]} </h1><dl><#list change.ugcList as ugc><dt>Subject</dt><dd> ${ugc.subject!\"\"} </dd><dt>Body</dt> <dd>${ugc.body!\"\"} </dd><dt>Changed by<dt><dd>${ugc.lastModifiedBy.username}<dd></#list></dl></#list>"
}

Get Context Preferences

Module: Social
Returns the preferences for a given Social Context.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
{
  • "preferences": {
    }
}

Update Context Preferences

Module: Social
Updates the preferences for a given Social Context.

Request Body schema: application/json
required
context
string

The ID of the Social Context

additionalProperties
any

Preferences that will be updated

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "additionalProperties": {
    }
}

Response samples

Content type
application/json
true

Delete Context Preferences

Module: Social
Deletes the preferences for a given Social Context.

Request Body schema: application/json
required
context
string

The ID of the Social Context

moderateByMailEnable
boolean
moderateByMailRole
string
moderateByMailSubject
string
timezone
string
baseUrl
string
setupAutoWatch
boolean
defaultFrequency
string
hiddenUgcStatus
string

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "moderateByMailEnable": true,
  • "moderateByMailRole": "string",
  • "moderateByMailSubject": "string",
  • "timezone": "string",
  • "baseUrl": "string",
  • "setupAutoWatch": true,
  • "defaultFrequency": "string",
  • "hiddenUgcStatus": "string"
}

Response samples

Content type
application/json
true

profile

Profile management

Clear Cache

Module: Social
Clears the Profile Aggregator Cache.

query Parameters
profileIds
required
string

List of IDs to be removed from the Cache.

If the profileIds parameter is empty or not included in the request, all profiles in the cache will be cleared.

Responses

Response samples

Content type
application/json
true

comments

User generated content comments management

Create Comment

Module: Social
Creates a new comment and creates a new thread if needed.

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

body
required
string

The body of the new comment

thread
required
string

Id of the thread to attach this comment

parent
string

Id of the parent for the new comment

anonymous
boolean

Should the comment be posted as anonymous

subject
string

Subject of the comment to be created

attributes
string

JSON string representing any extra attributes of the comment to create

attachment
string <binary>

Binary file to include in the comment

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "body": "This is the first comment!",
  • "thread": "string",
  • "parent": "string",
  • "anonymous": true,
  • "subject": "string",
  • "attributes": "string",
  • "attachment": "string"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This is the first comment!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T09:09Z",
  • "anonymousFlag": false,
  • "attributes": {},
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Update Comment

Module: Social
Replace the given comment.

path Parameters
id
required
string

The ID of the comment to replace

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
body
required
string

The body of the new comment

attributes
string

JSON string representing any extra attributes of the comment to create

Responses

Request samples

Content type
application/json
{
  • "body": "This is the first comment!",
  • "attributes": "string"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This is the first comment!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T09:09Z",
  • "anonymousFlag": false,
  • "attributes": {},
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Get Comment

Module: Social
Returns the given comment.

path Parameters
id
required
string

The ID of the comment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T09:09Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Delete Comment

Module: Social
Delete the given comment.

path Parameters
id
required
string

The ID of the comment to delete

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
Example
{
  • "message": "SOCIAL_SUPERADMIN is not a valid role"
}

Delete Comment

Module: Social
Deletes the given comment and all its children.

path Parameters
id
required
string

The ID of the comment to delete

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
body
required
string

The body of the new comment

attributes
string

JSON string representing any extra attributes of the comment to create

Responses

Request samples

Content type
application/json
{
  • "body": "This is the first comment!",
  • "attributes": "string"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This is the first comment!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T09:09Z",
  • "anonymousFlag": false,
  • "attributes": {},
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Update Comment

Module: Social
Updates the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
body
required
string

The body of the new comment

attributes
string

JSON string representing any extra attributes of the comment to create

Responses

Request samples

Content type
application/json
{
  • "body": "This is the first comment!",
  • "attributes": "string"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This is the first comment!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T09:09Z",
  • "anonymousFlag": false,
  • "attributes": {},
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Search Comments

Module: Social
Returns all comments that match the search parameter.

Request Body schema: application/json
required
context
required
string

The ID of the social context

search
required
string

MongoDB query (except $where)

sortBy
required
string

MongoDB sort string

start
required
integer

Starting position for pagination

limit
required
integer

Final position for pagination

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "search": {
    },
  • "sortBy": {
    },
  • "start": 0,
  • "limit": 5
}

Response samples

Content type
application/json
[
  • {
    }
]

Update Comment Attributes

Module: Social
Updates the attributes for the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
property name*
additional property
any

All additional parameters included in the request will be added as custom attributes in the comment.

Responses

Request samples

Content type
application/json
{
  • "customProperty": true,
  • "anotherCustomProperty": 1
}

Response samples

Content type
application/json
true

Update Comment Attributes

Module: Social
Updates the attributes for the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
property name*
additional property
any

All additional parameters included in the request will be added as custom attributes in the comment.

Responses

Request samples

Content type
application/json
{
  • "customProperty": true,
  • "anotherCustomProperty": 1
}

Response samples

Content type
application/json
true

Delete Comment Attributes

Module: Social
Deletes attributes for the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
attributes
string

List of attribute names to delete

Responses

Request samples

Content type
application/json
{
  • "attributes": "string"
}

Response samples

Content type
application/json
true

Delete Comment Attributes

Module: Social
Deletes the attributes for the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
property name*
additional property
any

All additional parameters included in the request will be added as custom attributes in the comment.

Responses

Request samples

Content type
application/json
{
  • "customProperty": true,
  • "anotherCustomProperty": 1
}

Response samples

Content type
application/json
true

Update Comment Flags

Module: Social
Adds a flag to the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
reason
string

Reason why the comment is flagged

Responses

Request samples

Content type
application/json
{
  • "reason": "string"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [
    ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [
    ],
  • "_id": "59678d3f300426156e21df50"
}

Get Comment Flags

Module: Social
Returns all the flags for the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Delete Comment Flags

Module: Social
Deletes a flag for the given comment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the comment to update

flagId
required
string
Example: 5967e35f300426156e21df58

The ID of the flag

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
true

Delete Comment Flags

Module: Social
Deletes a flag for the given comment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the comment to update

flagId
required
string
Example: 5967e35f300426156e21df58

The ID of the flag

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
true

Moderate Comment

Module: Social
Changes the moderation status of the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
status
string

The new moderation status

Responses

Request samples

Content type
application/json
{
  • "status": "APPROVED"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Moderate Comment

Module: Social
Changes the moderation status of the given comment.

path Parameters
id
required
string

The ID of the comment to update

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: application/json
required
status
string

The new moderation status

Responses

Request samples

Content type
application/json
{
  • "status": "APPROVED"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Get Comments By Moderation Status

Module: Social
Returns all the comments with a given moderation status.

path Parameters
status
required
string
Example: APPROVED

The moderation status to search

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

thread
string

The ID of the thread to search

pageNumber
integer

Page number to return

pageSize
integer

Comments per page

sortBy
Array of strings
Example: sortBy=lastModifiedDate

List of fields to order by

sortOrder
Array of strings
Example: sortOrder=ASC

List of sort orders for each field

Responses

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [
    ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Count Comments By Moderation Status

Module: Social
Returns the number of comments with a given moderation status.

path Parameters
status
required
string
Example: APPROVED

The moderation status to search

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

thread
string

The ID of the thread to search

Responses

Response samples

Content type
application/json
1

Get Flagged Comments

Module: Social
Returns all the comments with at least one flag.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

pageNumber
integer

Page number to return

pageSize
integer

Comments per page

sortBy
Array of strings
Example: sortBy=lastModifiedDate

List of fields to order by

sortOrder
Array of strings
Example: sortOrder=ASC

List of sort orders for each field

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Count Flagged Comments

Module: Social
Returns the number of comments with at least one flag.

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
1

Create Attachment

Module: Social
Creates an attachment in a given comment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: multipart/form-data
required
attachment
string <binary>

Binary file to add as attachment

Responses

Response samples

Content type
application/json
{
  • "md5": "1300018473cc0038187aaa0e2604fa27",
  • "fileId": "5967ac48300426156e21df51",
  • "contentType": "image/png",
  • "fileSize": "1.5 KB",
  • "storeName": "/f5b143c2-f1c0-4a10-b56e-f485f00d3fe9/59678d3f300426156e21df50/image1.png",
  • "fileName": "image1.png",
  • "savedDate": "2017-07-13T11:22Z",
  • "fileSizeBytes": 1497,
  • "attributes": {
    }
}

Delete Attachment

Module: Social
Deletes a given attachment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

attachmentId
required
string
Example: 5967ac48300426156e21df51

The ID of the attachment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
true

attachments

User generated content attachments management

Get Attachments

Module: Social
Returns all the attachments for a given comment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get Attachment Content

Module: Social
Returns the content of a given attachment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

attachmentId
required
string
Example: 5967ac48300426156e21df51

The ID of the attachment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
*/*
Binary content

Delete Attachment

Module: Social
Deletes a given attachment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

attachmentId
required
string
Example: 5967ac48300426156e21df51

The ID of the attachment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Responses

Response samples

Content type
application/json
true

Update Attachment Content

Module: Social
Deletes a given attachment.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

attachmentId
required
string
Example: 5967ac48300426156e21df51

The ID of the attachment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

Request Body schema: multipart/form-data
required
file
string <binary>

The content of the attachment

Responses

Response samples

Content type
application/json
true

votes

User generated content votes management

Vote Up

Module: Social
Toggles a vote up in the given comment from the currently logged user.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

Request Body schema: application/json
required
context
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [
    ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Vote Down

Module: Social
Toggles a vote down in the given comment from the currently logged user.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the Comment

Request Body schema: application/json
required
context
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "APPROVED",
  • "votesUp": [ ],
  • "votesDown": [
    ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

Remove Votes

Module: Social
Clears both up and down votes in the given comment for the currently logged user.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the comment to update

Request Body schema: application/json
required
context
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
{
  • "ancestors": [ ],
  • "targetId": "Welcome",
  • "subject": "",
  • "body": "This was the first comment in the site!",
  • "createdBy": "59667e8abd4787992596ba6b",
  • "lastModifiedBy": "59667e8abd4787992596ba6b",
  • "createdDate": "2017-07-13T09:09Z",
  • "lastModifiedDate": "2017-07-13T15:17Z",
  • "anonymousFlag": false,
  • "attributes": { },
  • "attachments": [ ],
  • "moderationStatus": "UNMODERATED",
  • "votesUp": [ ],
  • "votesDown": [ ],
  • "flags": [ ],
  • "_id": "59678d3f300426156e21df50"
}

threads

User generated content threads management

Get Thread Comments

Module: Social
Returns all comments from the given thread.

path Parameters
id
required
string
Example: Welcome

The ID of the thread

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

recursive
integer

Levels of comments to return

pageNumber
integer

Page number to return

pageSize
integer

Comments per page

childrenCount
integer

Amount of children to return

sortBy
Array of strings
Example: sortBy=lastModifiedDate

List of fields to order by

sortOrder
Array of strings
Example: sortOrder=ASC

List of sort orders for each field

Responses

Response samples

Content type
application/json
{
  • "total": 1,
  • "pageSize": 666,
  • "pageNumber": 0,
  • "watched": false,
  • "comments": [
    ]
}

Get Comment Children

Module: Social
Returns all children for a given comment.

path Parameters
id
required
string
Example: Welcome

The ID of the thread

commentId
required
string
Example: 59678d3f300426156e21df50

The ID of the comment

query Parameters
context
required
string
Example: context=f5b143c2-f1c0-4a10-b56e-f485f00d3fe9

The ID of the Social Context

recursive
integer

Levels of comments to return

pageNumber
integer

Page number to return

pageSize
integer

Comments per page

childrenCount
integer

Amount of children to return

sortBy
Array of strings
Example: sortBy=lastModifiedDate

List of fields to order by

sortOrder
Array of strings
Example: sortOrder=ASC

List of sort orders for each field

Responses

Response samples

Content type
application/json
{
  • "total": 1,
  • "pageSize": 666,
  • "pageNumber": 0,
  • "watched": false,
  • "comments": [
    ]
}

Subscribe

Module: Social
Subscribes the current user to a given thread

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the thread to subscribe to

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

frequency
string

Type of notifications to receive. The possible values are:

  • weekly
  • daily
  • instant

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "frequency": "string"
}

Response samples

Content type
application/json
true

Subscribe

Module: Social
Subscribes the current user to a given thread

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the thread to subscribe to

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

frequency
string

Type of notifications to receive. The possible values are:

  • weekly
  • daily
  • instant

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "frequency": "string"
}

Response samples

Content type
application/json
true

Update Subscription

Module: Social
Updates subscription of the current user

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the thread to update

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

frequency
string

Type of notifications to receive. The possible values are:

  • weekly
  • daily
  • instant

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9",
  • "frequency": "daily"
}

Response samples

Content type
application/json
true

Unsubscribe

Module: Social
Unsubscribes the current user to a given thread.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the thread to unsubscribe

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
true

Unsubscribe

Module: Social
Unsubscribes the current user to a given thread.

path Parameters
id
required
string
Example: 59678d3f300426156e21df50

The ID of the thread to unsubscribe.

Request Body schema: application/json
required
context
required
string

The ID of the Social Context

Responses

Request samples

Content type
application/json
{
  • "context": "f5b143c2-f1c0-4a10-b56e-f485f00d3fe9"
}

Response samples

Content type
application/json
true

monitoring

Monitoring operations

Get Memory Stats

Module: Social
Returns the Crafter Social JVM memory details.

query Parameters
token
required
string
Example: token=defaultManagementToken

The authorization token

Responses

Response samples

Content type
application/json
{
  • "totalJvmMemory": 2017984512,
  • "freeJvmMemory": 1113921056,
  • "maxJvmMemory": 3817865216,
  • "totalOsMemory": 17179869184,
  • "freeOsMemory": 2669301760,
  • "totalSwapMemory": 2147483648,
  • "freeSwapMemory": 1026555904
}

Get Status

Module: Social
Returns the Crafter Social JVM status details.

query Parameters
token
required
string
Example: token=defaultManagementToken

The authorization token

Responses

Response samples

Content type
application/json
{
  • "uptime": 4801,
  • "startup": "2019-03-07T21:29:11.049Z"
}

Get Version

Module: Social
Returns the Crafter Social JVM version details.

query Parameters
token
required
string
Example: token=defaultManagementToken

The authorization token

Responses

Response samples

Content type
application/json
{
  • "packageName": "Crafter Social",
  • "packageVersion": "3.2.0-SNAPSHOT",
  • "packageBuild": "a68f1ff7ad84d5ecbeaa008f392e4cef0ca02f41",
  • "packageBuildDate": "2020-03-07T21:03:05.422Z",
  • "osName": "Mac OS X",
  • "osVersion": "10.15.6",
  • "osArch": "x86_64",
  • "javaVersion": "11",
  • "javaVendor": "Oracle Corporation",
  • "javaVm": "OpenJDK 64-Bit Server VM"
}