βž•Creating Participants

This step shows the method to add one or more users as participants in a session with Groups API.

Using Groups API, there are two ways to create participants for a session:

Adding a user to the session

Available parameters:

Parameter
Type
Required
Default
Description

user_id

string

Yes

n/a

GUID of the user that will be added to the session as a participant

role

string

No

User's role. See information Hint below

Role of the participant(see)

If the role parameter is not sent, the user will be added to the session with the role she has. Sending the parameter with a non null value will override this.

For example:

  • User with ID: a4cfd141-ea72-42e1-9b9b-d325ca3b255f has role 'e'

  • Try add user to session with payload:

{
    "user_id": "a4cfd141-ea72-42e1-9b9b-d325ca3b255f"
}
  • Attendee will be added with role 'e'

Example Payload:

curl --location --request POST \
'https://<DOMAIN>/xapi/session/<SESSION_ID>/attendees' \
--header 'Authorization: Bearer <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[{
    "user_id": "<USER_ID>",
    "role": "u"
}]'

Using the same calls, you can make a batch operation for adding attendees to a session, which will significantly reduce overhead by making a request for each attendee to add.

Example payload for batch operation:

[
    {
        "user_id": "<USER_ID1>",
        "role": "u"
    },
    {
        "user_id": "<USER_ID2>"
    }
]

Example Response:

{
    "approved": [
        {
            "session_id": "<SESSION_ID>",
            "user_id": "<USER_ID>",
            "attendee_id": "***",
            "attendance_code": "<ATTENDANCE_CODE>",
            "name": "john",
            "surname": "Doe",
            "email": "[email protected]",
            "role": "u",
            "mobile": "",
            "avatar": null,
            "creation_date": "2024-08-16T01:55:15.7991084Z",
            "updating_date": null
        }
    ],
    "rejected": []
}

πŸ”΄ You will see two objects as approved and rejected in the response, you can see their details below:

  • approved:

    • Lists the records successfully added from the users.

  • rejected:

    • Lists the records that cannot be added from users.

Example Response:

{
    "approved": [],
    "rejected": [
        {
            "model": null,
            "state": {
                "code": 10,
                "details": "Object reference not set to an instance of an object."
            }
        }
    ]
}

Last updated

Was this helpful?