Search...
listCreateRequests( )
Lists requests to create a group.
Description
Note: This function is only relevant if admin approval is required for creating a group, or if the function's
suppressAuth
option is set totrue
.
The listCreateRequests()
function returns a Promise that resolves to a list of up to 1,000 create requests on your site.
Sorts by default to _createdDate
in descending order. Only site admins can see create requests. Site members can access their own create requests in their site.
Notes:
- If the
suppressAuth
option is set totrue
, all permissions are overwritten, and all site members can see create requests.- This function's parameters are positional, and must be specified in the sequence shown in the syntax below. When specifying a parameter, use
null
as a placeholder for any unspecified parameters. For example, to specifylimit
only, calllistCreateRequests(paging, null)
. To specifysupressAuth
only, calllistCreateRequests(null, options)
.
Syntax
function listCreateRequests([paging: Paging], [options: Options]): Promise<ListCreateRequests>
listCreateRequests Parameters
NAME
TYPE
DESCRIPTION
paging
Optional
Paging
Paging options.
options
Optional
Options
Authorization options.
Returns
Return Type:
Promise<ListCreateRequests>
NAME
TYPE
DESCRIPTION
createRequests
Array<CreateRequest>
Requests to create a group.
metadata
Metadata
Paging information.
Was this helpful?
List requests to create a group
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { createRequests } from 'wix-groups-backend';34export const myListCreateRequestsFunction = webMethod(Permissions.Anyone, () => {5 return createRequests.listCreateRequests()6 .then((createRequestsResults) => {7 const createRequestStatus = createRequestsResults.createRequests[0].status;8 const createRequestName = createRequestsResults.createRequests[0].group.name;9 return createRequestsResults;10 })11 .catch((error) => {12 console.error(error);13 });14});1516/* Promise resolves to:17 * createRequests: [18 * {19 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"20 * "status": "PENDING",21 * "group": {22 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"23 * "name": "My Group Request 1"24 * "slug": "my-group-request-1"25 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."26 * "privacyStatus": "PUBLIC"27 * "coverImage": {28 * "imageUrl": "wix:image://v1/22j9074e348009011fa9f2d2961b~mv2.jpg/corn.jpg#originWidth=112&originHeight=224",29 * "position": {30 * "x": 80,31 * "y": 5332 * }33 * }34 * "memberTitle": "Employees"35 * "memberCount": 136 * "settings": {37 * "groupUpdatePostEnabled": true38 * "membersCanApprove": false39 * "membersCanInvite": true40 * "showMemberList": true41 * "welcomeMemberPostEnabled": true42 * }43 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"44 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"45 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"46 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"47 * }48 * },49 * {50 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"51 * "status": "APPROVED",52 * "group": {53 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"54 * "name": "My Group Request 2"55 * "slug": "my-group-request-2"56 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."57 * "privacyStatus": "PRIVATE"58 * "coverImage": {59 * "imageUrl": "wix:image://v1/664e64e348009011fa9f2d2961e~mv2.jpg/time.jpg#originWidth=2922&originHeight=778",60 * "position": {61 * "x": 0,62 * "y": 063 * }64 * }65 * "memberTitle": "Friends"66 * "memberCount": 6567 * "settings": {68 * "groupUpdatePostEnabled": true69 * "membersCanApprove": true70 * "membersCanInvite": true71 * "showMemberList": false72 * "welcomeMemberPostEnabled": true73 * }74 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"75 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300"76 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"77 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"78 * }79 * }80 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"81 * "status": "REJECTED"82 * "rejectionReason": "This group has inappropriate content.",83 * "group": {84 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"85 * "name": "My Group Request 3"86 * "slug": "my-group-request-3"87 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."88 * "privacyStatus": "PRIVATE"89 * "coverImage": {90 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/popcorn.jpg#originWidth=712&originHeight=667",91 * "position": {92 * "x": 44,93 * "y": 1594 * }95 * }96 * "memberTitle": "Students"97 * "memberCount": 198 * "settings": {99 * "groupUpdatePostEnabled": true100 * "membersCanApprove": true101 * "membersCanInvite": true102 * "showMemberList": false103 * "welcomeMemberPostEnabled": true104 * }105 * "lastActivityDate": "Mon Feb 04 2019 01:19:53 GMT+0300"106 * "_createdDate": "Mon Feb 04 2019 01:19:53 GMT+0300"107 * "_updatedDate": "Mon Feb 04 2019 01:19:53 GMT+0300"108 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"109 * }110 * }111 * ],112 * metadata:113 * {114 * "length": 3115 * "tooManyToCount": false116 * "totalCount": 3117 * }118 */
List requests to create a group using options
Copy Code
1import { Permissions, webMethod } from 'wix-web-module23// Sample paging value:4// {5// limit: 3,6// skip: 17// }8//9// Sample options value:10// {11// suppressAuth: true12// }1314export const myListCreateRequestsFunction = webMethod(Permissions.Anyone, async (paging, options) => {15 try {16 const createRequestsResults = await createRequests.listCreateRequests(paging, options);17 const createRequestStatus = createRequestsResults.createRequests[0].status;18 const createRequestName = createRequestsResults.createRequests[0].group.name;19 return createRequestsResults;20 } catch (error) {21 console.error(error);22 }23});2425/* Promise resolves to:26 * createRequests: [27 * {28 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"29 * "status": "PENDING",30 * "group": {31 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"32 * "name": "My Group Request 2"33 * "slug": "my-group-request-2"34 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."35 * "privacyStatus": "PUBLIC"36 * "coverImage": {37 * "image": {38 * "height": 403239 * "mediaId": "https://static.wixstatic.com/media/waz1z1_53219a2f194c4c29bda210ecca987zf99~mv2.jpeg"40 * "width": 302441 * }42 * "memberTitle": "Co-workers"43 * "memberCount": 144 * "settings": {45 * "groupUpdatePostEnabled": true46 * "membersCanApprove": false47 * "membersCanInvite": true48 * "showMemberList": true49 * "welcomeMemberPostEnabled": true50 * }51 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"52 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"53 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"54 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"55 * }56 * },57 * {58 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"59 * "status": "APPROVED",60 * "group": {61 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"62 * "name": "My Group Request 3"63 * "slug": "my-group-request-3"64 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."65 * "privacyStatus": "PRIVATE"66 * "coverImage": {67 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900",68 * "position": {69 * "x": 70,70 * "y": 9571 * }72 * }73 * "memberTitle": "Students"74 * "memberCount": 2075 * "settings": {76 * "groupUpdatePostEnabled": true77 * "membersCanApprove": true78 * "membersCanInvite": true79 * "showMemberList": false80 * "welcomeMemberPostEnabled": true81 * }82 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"83 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300"84 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"85 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"86 * }87 * },88 * {89 * "_id": "29005463-64b7-499tt-cc8j-jfj98c5ad9772"90 * "status": "REJECTED"91 * "rejectionReason": "This group is only for members of the football team.",92 * "group": {93 * "_id": "29005463-64b7-499tt-cc8j-jfj98c5ad9772"94 * "name": "My Group Request 4"95 * "slug": "my-group-request-4"96 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."97 * "privacyStatus": "PRIVATE"98 * "coverImage": {99 * "imageUrl": "wix:image://v1/s9074e348009011fa9f2d2944~mv2.jpg/sugar.jpg#originWidth=560&originHeight=230",100 * "position": {101 * "x": 0,102 * "y": 60103 * }104 * "memberTitle": "Members"105 * "memberCount": 1106 * "settings": {107 * "groupUpdatePostEnabled": false108 * "membersCanApprove": true109 * "membersCanInvite": false110 * "showMemberList": false111 * "welcomeMemberPostEnabled": false112 * }113 * "lastActivityDate": "Tues Jan 02 2020 09:17:07 GMT+0300"114 * "_createdDate": "Tues Jan 02 2019 09:17:07 GMT+0300"115 * "_updatedDate": "Tues Jan 02 2020 09:17:07 GMT+0300"116 * "owner": "cad5e9e1-jab0-9c46-1344-e79231600cff2"117 * }118 * }119 * ],120 * metadata:121 * {122 * "length": 3123 * "tooManyToCount": false124 * "totalCount": 3125 * }126 */