create_message()
Parameters
- Token(character varying)
- JSONparams(character varying)
Returns
Description
- Create Message is one of the core functions in the system. Most other functions that create messages
are a wrapper around create_message(). This functionality is allowed by the flexibility of the JSON input. The
JSON keys assign the specific functionality.
- Title and Message are required keys and they represent the title of the post and the body of the post
respectively
- CourseID assigns the message to a specific course. Most messages are assigned to a course, however it is
also possible to assign a message to a group outside of a course.
- >ParentMessageID is used to mark this message as a reply to another message.
- PollType and PollItems must be included together. PollItems is the list of items to be voted on in the
poll. PollType is an integer that provides the following 4 possibilities: 1 single vote,2 multi vote,
3 single vote with vote results summed together on each item.(not implemented), 4 multi vote with vote
results summed together on each item.(not implemented)
- PollItems is just an array of strings ["Item1","item2",....]
- UsergroupID key allows a message to be assigned to an existing usergroup.
- GroupMembers key requires a list of members and their type as [{"UserID":1,"UserType":1}...
- It is an error to include both UsergroupID and GroupMembers keys because a message can only be part of
one usergroup. GroupMembers creates its own usergroup. UsergroupID requires another one to already exist.
Errors
- 1 - The CourseID is not valid.
- 2 - Invalid Session.
- 3 - This user is not a member of selected course.
- 4 - Parent Message does not exist.
- 6 - Each groupmember must have a UserID.
- 7 - The UserID does not exist.
- 8 - Each groupmember must have a UserType.
- 9 - Invalid UserType.
- 10 - PollType must be a number between 1 and 4.
- 11 - PollItems must exist if PollType does.
- 12 - You cannot use an existing UserGroupID when creating a new group message.
- 13 - The CourseID, UserGroupID, and GroupMembers cannot all be Empty. A group of some type is required.
- 14 - Either this group does not exist or this user is not a member.
- 15 - This user does not have write permission into this group.
- 16 - Title field cannot be empty.
- 17 - Message field cannot be empty.
- 18 - A message cannot be a member of two UserGroups. The NextUserGroupID and GroupMembers keys cannot be used simultaneously.
Related functions