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"