Create New Student Self Service User Accounts
You can create student user accounts using the User Creation API REST-based messages. In addition to the Student Self Service User Interface user-create functionality, this API can be used to script bulk creation of student self service users.
Complete these steps:
- Set Up Connectivity and Authentication
- Authenticate using an admin account
username and
password:
curl -v --cookie-jar ./cookie.txt https://admin-username:admin-password@sfp.ocs.oc-test.com/customerName/portal/fas
- Perform an initial GET request to acquire an
XSRFtoken:
curl -v --cookie ./cookie.txt --cookie-jar cookie.txt https://sfp.ocs.oc-test.com/customerName/portal/
Steps 1a and 1b are only needed once per session. These steps create connectivity data in cookie.txt (SESSION and XSFR tokens) that is used to create one or more students repeating step 2.
- Authenticate using an admin account
username and
password:
- Create a Student User
- Create
Student:
curl -v -k \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: 60d9e1ee-ba14-4a95-9a0d-5de007ce2c02" \
--cookie ./cookie.txt \
https://sfp.ocs.oc-test.com/customerName/portal/api/v1/students -d @- << EOF
{
"firstName": "Test0001",
"lastName": "Student",
"externalId": "0001"
}
EOF
The X-XSRF-TOKEN value in this command must be set from the cookies.txtgenerated during Step 1b of the session.
# Netscape HTTP Cookie File
#HttpOnly_localhost FALSE /portal FALSE 0 JSESSIONID 92860D187E6B23D0E09802AE388A476A
localhost FALSE /portal FALSE 0 XSRF-TOKEN 60d9e1ee-ba14-4a95-9a0d-5de007ce2c02
- Create User for
Student:
curl -v -k \
-H "Content-Type: application/json" \
-H "X-XSRF-TOKEN: 60d9e1ee-ba14-4a95-9a0d-5de007ce2c02" \
--cookie ./cookie.txt \
https://sfp.ocs.oc-test.com/customerName/portal/api/v1/users -d @- << EOF
{
"username": "test0001",
"password": "0001",
"firstName": "Test0001",
"lastName": "Student",
"email": "test0001.Student@customerName.com",
"phone": "(800) 555-1212",
"externalId": "0001",
"student": "https://sfp.ocs.oc-test.com/customerName/portal/api/v1/students/100"
}
EOF
The X-XSRF-TOKEN value in this command must be set from the cookies.txtgenerated during Step 1b of the session.
# Netscape HTTP Cookie File
#HttpOnly_localhost FALSE /portal FALSE 0 JSESSIONID 92860D187E6B23D0E09802AE388A476A
localhost FALSE /portal FALSE 0 XSRF-TOKEN 60d9e1ee-ba14-4a95-9a0d-5de007ce2c02
The student data element value is an unique url identifying the student and must be set from the Location header of the HTTP response output of Step 2a execution.
< HTTP/1.1 201
...
< X-Frame-Options: SAMEORIGIN
< Last-Modified: Wed, 24 Oct 2018 19:05:40 GMT
< Location: https://sfp.ocs.oc-test.com/customerName/portal/api/v1/students/100
Steps 2a and 2b can be repeated to create multiple students per session.
- Create
Student: