Skip to main content

How-to Guide - Rest API - HR

Introduction

The purpose of this guide is to provide an understanding of the REST HR APIs provided by Enactor for use with external Web Sites and for Customer integration. It is separated out into functional areas, with each section related to a specific service. Note that the final URL used to access the service will be determined based on how the Enactor REST HR API is deployed.

Following are the Enactor REST HR APIs areas covered in this document:

  • User API

    • Create a User

    • Update a User

    • Delete a User

User API

The User API is used to add, update and delete users. Following is the list of Allocated Number Ranges APIs covered in this section:

  • Create a User.

  • Update a User.

  • Delete a User.

Create a User

This service creates a user with a given display name and surname. The user ID can be supplied to assign the user a specific userId, otherwise, the user ID is generated.

Request

Request Service URL

POST /users

Request Tokens

There are no request tokens.

Request Parameters

There are no request parameters.

Request Body

ICreateUserRequest

ElementRequired / OptionalTypeDescription
userRequiredIUserThe user to be created.

Response

Response Headers

Location: /users/{userId}

Response Body

There is no request body.

Request & Response Examples

Request:

POST http://[SWARM_LEADER_IP]/WebRestApi/rest/users
{
"user": {
"displayName": "Hadhi Jawahir",
"userId": "1001",
"isTemplate": false,
"address": {
"countryCodeId": {},
"typeId": {},
"county": "Hertfordshire",
"postCode": "SG14 1PB",
"street1": "Enactor House",
"street2": "1 Bluecoats Avenue",
"town": "Hertford",
"isTemplate": false
},
"userName": {
"surname": "Jawahir"
}
}
}

Response:

Status: 201 Created

Update a User

This service updates an existing user’s details with the information provided in the request.

Request

Request Service URL

PUT /users/{userId}

Request Tokens

  • userId:
    The ID of the user to update the details of.

Request Parameters

There are no request parameters.

Request Body

IUpdateUserRequest

ElementRequired / OptionalTypeDescription
userIdRequiredStringThe ID of the user (inferred by the token/path param) who is to be updated.
userRequiredIUserThe user details to updated.

Response

Response Headers

There are response headers.

Response Body

There is no request body.

Request & Response Examples

Request:

PUT: http://[SWARM_LEADER_IP]/WebRestApi/rest/users/1001

{
"user": {
"displayName": "Hadhi Jawahir Enactor",
"userId": "1001",
"isTemplate": false,
"address": {
"countryCodeId": {},
"typeId": {},
"county": "Hertfordshire",
"postCode": "SG14 1PB",
"street1": "Enactor House",
"street2": "1 Bluecoats Avenue",
"town": "Hertford",
"isTemplate": false
},
"userName": {
"surname": "Jawahir",
"forename": "Hadhi"
}
}
}

Response:

Status: 200 OK

Delete a User

This service deletes a user given a user ID as a request token/path parameter. The site subject must be a valid user and have the correct privilege to delete a user.

Request

Request Service URL

DELETE /users/{userId}

Request Headers

  • site_subject – JWT
    Required. The ID of the site / user using the API.

Request Tokens

  • userId:
    The ID of the user to delete.

Request Parameters

There are no request parameters.

Request Body

There is no request body.

Response

Response Headers

There is no response header.

Response Body

There is no request body.

Request & Response Examples

Request:

DELETE: http://[SWARM_LEADER_IP]/WebRestApi/rest/users/1001

Response:

Status: 200 OK