Setting Up Your API

Setting Up Your API

We advise the use of a developer to help you setup your API connection. We will offer an example of how to CREATE A NEW USER on your LMS using a cURL command.

Let's review the required POST parameters for the core_user_create_users function:

  1. wsfunction=core_user_create_users
  2. users[0][username]= string (The user's unique username)
  3. users[0][auth]= string (The authentication method, default to "manual")
  4. users[0][password]= string (The user's password)
  5. users[0][firstname]= string (The user's first name)
  6. users[0][lastname]= string (The user's last name)
  7. users[0][email]= string (The user's email address)
  8. users[0][createpassword]= integer (Set to 0 if providing a password)

Bringing this altogether:

curl "https://courses.yoursite.com/webservice/rest/server.php?wstoken=XXXXXXXXXXXXXXX" \
-d "wsfunction=core_user_create_users" \
-d "users[0][username]=johndoe" \
-d "users[0][auth]=manual" \
-d "users[0][password]=YourStrongPassword123!" \
-d "users[0][firstname]=John" \
-d "users[0][lastname]=Doe" \
-d "users[0][email]=johndoe@yourdomain.com" \
-d "users[0][createpassword]=0"

    • Related Articles

    • Messaging API

      core_message_get_messages This function retrieves messages for a user. You can get all messages sent to a user, or get the conversation between two specific users. Let's review the POST parameters for this function: Parameters: useridto= int ...
    • Grades API

      gradereport_overview_get_course_grades This function retrieves an overview of all final course grades for a specific user. Let's review the POST parameters for this function: Optional Parameter: userid= int (Optional: The numeric ID of the user. If ...
    • User API

      core_user_create_users We advise the use of a developer to help you setup your API connection. This example shows how to create new users. Let's review the POST parameters for this function: Required Parameters: users[0][username]= string (Required: ...
    • Generate your API Key

      Step 1: Click on "Site admin" > "Integrations" > "Manage tokens": Step 2: Click on "Create Token": Step 3: (1) Select the user you wish to give the API Token to, (2) Select "API" then (3) Save: Step 4: Share this token with the user or save it if ...
    • SCORM API

      mod_scorm_get_scorm_user_data This function retrieves detailed user tracking data for a specific attempt on a SCORM package. Let's review the POST parameters for this function: Required Parameters: scormid= int (Required: The numeric instance ID of ...