Adding and editing users via the API

Use the /ImportService2.svc/CreateUserOrApplyModifications operation to add or edit users.

This operation can be used to both set or modify a user’s user profile settings (accessible only by admins), and their user preferences (typically accessible by the user).

Refer to Accessing the reference pages in the API user guide for information on how to find and login to the API's User reference page, where this operation's documentation is located.

Prerequisites of using this operation

Before you can assign certain settings to users, you’ll need to ensure they’re set up in your system. You can find a list of all settings that need to be set up in advance on the About the User Profile fields help topic, along with more information about all of the fields.

Identifying values

To simplify usage, this operation supports use of the field value name (e.g. Standard Timesheet) for most settings, rather than using a URI. But, you can still use URIs if you prefer.

Adding a user

To add a new user, exclude the Target parameter, and be sure to include the new user’s last name, first name, and login name in the Modifications parameter – all other fields are optional, and should be included only if you want to configure that setting.

The following is an example of a call for adding a user via CreateUserOrApplyModifications. When used with a tenant with sample data installed, this call should yield a Success result.

{
"modifications": {
"firstName": {
"value": "i"
},
"lastName": {
"value": "Doe"
},
"loginName": {
"value": "i.doe"
},
"employeeId": {
"value": "1234896"
},
"employmentDateRange": {
"value": {
"startDate": {
"year": "2024",
"month": "8",
"day": "1"
}
}
},
"locationSchedule": [
{
"item": {
"uri": "urn:replicon-tenant:000562c10a2d4f09b34b80dac8cf9f40:location:20173019-aab4-4c58-8b52-d07156c5c0f4"
}
}
],
"timesheetTemplate": {
"value": {
"name": "Time Punches Timesheet"
}
},
"timesheetApprovalPath": {
"value": {
"name": "Supervisor"
}
},
"timesheetPeriodSchedule": [
{
"item": {
"name": "Monthly"
}
}
],
"workWeekStartDay": {
"value": {
"uri": "urn:replicon:day-of-week:monday"
}
},
"timeoffTemplate": {
"value": {
"name": "Time Off"
}
},
"timeoffApprovalPath": {
"value": {
"name": "Supervisor"
}
},
"scheduleTypeSchedule": [
{
"item": {
"scheduleTypeUri": "urn:replicon:schedule-type:office-schedule",
"officeSchedule": {
"officeScheduleUri": "urn:replicon-tenant:000562c10a2d4f09b34b80dac8cf9f40:office-schedule:36ec4ccd-efb6-4643-8988-f24bf394adb6"
}
}
}
],
"punchEntryPolicy": {
"value": {
"name": " Collect Activities with Punches"
}
},
"payRuleSchedule": [
{
"item": {
"name": "Arkansas"
}
}
],
"defaultActivity": {
"value": {
"code": "CD"
}
},
"userPreferences": {
"value": {
"defaultTimeOffTypeForBookings": {
"value": {
"timeOffType": {
"name": "Vacation (Hrs)"
}
}
}
}
}
},
"userModificationOptionUri": "urn:replicon:user-modification-option:save",
"unitOfWorkId": "15"
}

Editing a user

To edit an existing user, include one and only one identifier (uri, name, or employee ID) in the Target parameter, and any Modification fields required.

The following is an example of a call for editing a user via CreateUserOrApplyModifications. When used with a tenant with sample data installed, this call should yield a Success result.

{
"target": {
"loginName": "admin"
},
"modifications": {
"notificationPreferences": {
"value": {
"notificationDeliveryPreferences": [
{
"objectTypeUri": "urn:replicon:object-type:timesheet",
"notificationDeliveryOptionUri": "urn:replicon:user-notification-delivery-option:always-deliver"
}
],
"sharedDeliveryPreferenceOptionUris": []
}
}
},
"userModificationOptionUri": "urn:replicon:user-modification-option:save",
"unitOfWorkId": "156456156"
}