Skip to content

Community Management

Maxime edited this page Oct 31, 2019 · 2 revisions

Managing communities and posts

Communities

Community list

body = {
    "instanceId": "YOUR_INSTANCE_ID", 
    "lang": "fr",
    }

communities = api.get_call(
    "community", "list", body=body
)

For more details see api.lumapps.com

Community get

community = api.get_call(
    "community", "get", uid="YOUR_COMMUNITY_ID"
)
community_id = community.get("uid")

For more details see api.lumapps.com

Posts

Post list

body = {
    "contentId": community_id, 
    "lang": "",
    }

posts = api.get_call(
    "community", "post", "search", body=body
)

For more details see api.lumapps.com

Post get

post = api.get_call(
    "community", "post", "get", uid="YOUR_POST_ID"
)

For more details see api.lumapps.com

Post save

The variable post is a json object described here. You can either construct a new one from scratch:

post = {
    "customer": "YOUR_CUSTOMER_ID",
    "instance": "YOUR_INSTANCE_ID",
    "type": "post",
    "postType": "[DEFAULT|IDEA|QUESTION]",
    "externalKey": "YOUR_COMMUNITY_ID",
    "title": {"fr": "Some post title"},
    "content": {"fr": "Post content, you can use markdown"},
    "publicationDate": publication_date,
    "createdAt": publication_date,
    "startDate": publication_date,
    "version": 1,
}

or update properties from one you just got using the api.

post = get_post(...)
post.title = {"fr": "New title"}
post = api.get_call(
    "community", "post", "save", body=post
)

For more details see api.lumapps.com

Comments

Comment list

with_answers = True #False

comments = api.get_call(
    "comment", "list", content="YOUR_POST_ID", withAnswers=with_answers
)

For more details see api.lumapps.com

Comment get

comment = api.get_call(
    "comment", "get", uid="YOUR_COMMENT_ID"
)

For more details see api.lumapps.com

Comment save

The variable comment is a json object described here. You can either construct a new one from scratch:

comment = {
    "content": "YOUR_POST_ID",
    "customer": "YOUR_CUSTOMER_ID",
    "instance": "YOUR_INSTANCE_ID",
    "text": {
        {"fr": "Comment content, you can use markdown"},
    },
    "publicationDate": publication_date,
    "createdAt": publication_date,
    "startDate": publication_date,
}

or update properties from one you just got using the api.

comment = get_comment(...)
comment.title = {"fr": "New title"}

comment = api.get_call( "comment", "save", body=comment )

For more details see api.lumapps.com

Clone this wiki locally