# Push API: User Create/Update The OPS-COM Controller provides a simple JSON based API to integrate with. Clients use this API to push to OPS-COM new users and update existing users directly from another system. For example, you may wish to push Student and Staff information from Banner directly to OPS-COM. Make sure you set the HTTP Content-Type header to be application/json. ## Making API Requests ### Raw Request:
`POST /api/OC_TOMA/v1/profiles/push HTTP/1.1` `Host: controller.operationscommander.io` `Accept: application/json` `Content-Type: application/json` `Cache-Control: no-cache` `{` ` ``"apiToken": "YOUR-API-TOKEN",` ` ``"unique_id": "tester23",` ` ``"login_source": "OPSCOM",` ` ``"first_name":"firstname",` ` ``"last_name":"lastname",` ` ``"user_name":"username",` ` ``"email":"test@test.com",` ` ``"street":"123 Main Street, 123 Main Street,123 Main Street,123 Main Street,123 Main Street,123 Main Street",` ` ``"city":"Everywhere",` ` ``"province":"bc",` ` ``"state":"NY",` ` ``"postal_code":"HOHOHO",` ` ``"zip":"12345-1212",` ` ``"street2":"123 General Street",` ` ``"city2":"Somewhere",` ` ``"province2":"AB",` ` ``"state2":"MA",` ` ``"postal_code2":"A9A9A9",` ` ``"zip2":"54321-1212",` ` ``"phone_cell":"613-555-1212",` ` ``"user_type_id":"6",` ` ``"employ_no":"employee number: default",` ` ``"employee_phone":"emp ph. klondike 555",` ` ``"student_no":"SN 543209854",` ` ``"student_phone":"999",` ` ``"driver_licence_num":"QC 99999999",` ` ``"driver_license_num":"NYNY",` ` ``"date_of_birth":"1901-01-31",` ` ``"locker_user_type_id":"3",` ` ``"driver_licence_prov":"BC",` ` ``"driver_license_state":"CA"` `}` |
`var` `request = ``new` `XMLHttpRequest();` `request.open(``'POST'``, ``'https://controller.operationscommander.io/api/OC_TOMA/v1/profiles/push'``);` `request.setRequestHeader(``'Content-Type'``, ``'application/json'``);` `request.setRequestHeader(``'Accept'``, ``'application/json'``);` `request.onreadystatechange = ``function` `() {` ` ``if` `(``this``.readyState === 4) {` ` ``console.log(``'Status:'``, ``this``.status);` ` ``console.log(``'Headers:'``, ``this``.getAllResponseHeaders());` ` ``console.log(``'Body:'``, ``this``.responseText);` ` ``}` `};` `var` `body = {` ` ``"apiToken"``: ``"YOUR-API-TOKEN"``,` ` ``"unique_id"``: ``"tester23"``,` ` ``"login_source"``: ``"OPSCOM"``,` ` ``"first_name"``:``"firstname"``,` ` ``"last_name"``:``"lastname"``,` ` ``"user_name"``:``"username"``,` ` ``"email"``:``"test@test.com"``,` ` ``"street"``:``"123 Main Street, 123 Main Street,123 Main Street,123 Main Street,123 Main Street,123 Main Street"``,` ` ``"city"``:``"Everywhere"``,` ` ``"province"``:``"bc"``,` ` ``"state"``:``"NY"``,` ` ``"postal_code"``:``"HOHOHO"``,` ` ``"zip"``:``"12345-1212"``,` ` ``"street2"``:``"123 General Street"``,` ` ``"city2"``:``"Somewhere"``,` ` ``"province2"``:``"AB"``,` ` ``"state2"``:``"MA"``,` ` ``"postal_code2"``:``"A9A9A9"``,` ` ``"zip2"``:``"54321-1212"``,` ` ``"phone_cell"``:``"613-555-1212"``,` ` ``"user_type_id"``:``"6"``,` ` ``"employ_no"``:``"employee number: default"``,` ` ``"employee_phone"``:``"emp ph. klondike 555"``,` ` ``"student_no"``:``"SN 543209854"``,` ` ``"student_phone"``:``"999"``,` ` ``"driver_licence_num"``:``"QC 99999999"``,` ` ``"driver_license_num"``:``"NYNY"``,` ` ``"date_of_birth"``:``"1901-01-31"``,` ` ``"locker_user_type_id"``:``"3"``,` ` ``"driver_licence_prov"``:``"BC"``,` ` ``"driver_license_state"``:``"CA"` `}` `request.send(JSON.stringify(body));` |
Attribute | Type | Limits | Possible Names | Description |
---|---|---|---|---|
apiToken | String | 50-character alphanumeric including dashes. | apiToken | **(Required)** Your supplied API Token. |
Unique ID | String | 50-character alphanumeric including dashes. | unique\_id | **(Required)** An unique identification number of the user. |
Login Source | String | 20-character alphanumeric including dashes. | login\_source | **(Required)** Your supplied login source. |
First Name | String | 50-character alphanumeric including dashes. | first\_name | *(Optional)* User's first name. |
Last Name | String | 50-character alphanumeric including dashes. | last\_name | *(Optional)* User's last name. |
User Name | String | 50-character alphanumeric including dashes. | user\_name | *(Optional)* Unique username. |
String | 100-character alphanumeric including dashes. | *(Optional)* Valid email address . | ||
Street - address 1 | String | street | *(Optional) User's primary street number and name.* | |
City - address 1 | String | 50-character alphanumeric including dashes. | city | *(Optional) User's primary city name.* |
Province - address 1 | String | 2-character postal abbreviation eg. "MA" | province, state | *(Optional) User's primary province or state.* |
Postal Code - address 1 | String | 20-character alphanumeric including dashes. | postal\_code, zip | *(Optional) User's primary postal code or zip.* |
Street - address 2 | String | 20-character alphanumeric including dashes. | street2 | *(Optional) User's alternate street number and name.* |
City - address 2 | String | 50-character alphanumeric including dashes. | city2 | *(Optional) User's alternate city name.* |
Province - address 2 | String | 2-character postal abbreviation eg. "MA" | province2, state2 | *(Optional) User's alternate province or state.* |
Postal\_Code - address 2 | String | 20-character alphanumeric including dashes. | postal\_code2, zip2 | *(Optional) User's alternate postal code or zip.* |
Cell phone number | String | 20-character alphanumeric including dashes. | phone\_cell | *(Optional) User's cell phone number* |
User Type ID | String | Id number of UserType | user\_type\_id | *(Optional) A reference number to the type of user.* |
Employee Number | String | 50-character alphanumeric including dashes. | employ\_no | *(Optional) User's employee number.* |
Employee phone number | String | 50-character alphanumeric including dashes. | employee\_phone | *(Optional) User's employee phone number.* |
Student number | String | 50-character alphanumeric including dashes. | student\_no | *(Optional) User's student number.* |
Student phone number | String | 50-character alphanumeric including dashes. | student\_phone | *(Optional) User's student phone number.* |
Driver licence number | String | 255-character alphanumeric including dashes. | driver\_licence\_num, driver\_license\_num | *(Optional) User's driver's licence number or driver's license number.* |
Date of Birth | String | 10-character date in format 'yyyy-mm-dd' | date\_of\_birth | *(Optional) User's date of birth in format "YYYY-MM-DD.* |
Locker User Type ID | String | Id number of LockerUserType | locker\_user\_type\_id | *(Optional) A reference the the user's locker type id of the user.* |
Driver's licence province | String | 2-character postal abbreviation eg. "MA" | driver\_licence\_prov, driver\_license\_state | *(Optional) The province or state of the user's driver's licence.* |
`{` ` ``"status"``: ``"success"``,` ` ``"reference_id"``: 44` `}` |