Have a Question?

The Floor Plan Mapper Knowledge Base has all the answers to your questions. Just type your question in the seach box below to get started.

Using the Floor Plan Mapper API to Import/Sync employee data

To import an employee, you should send an authenticated HTTP POST request to the URL https://your-workspace-name-here.fpm.cloud/api/v1/employee-imports with the payload in JSON format. Below is the request payload schema (with comments):

{
  "items": [ // note: Required field
    {
      "email": "user@example.com",  // note: Required field
      "name": "user name",  // note: Required field
      "phone": "phone number",
      "desk_number": "desk number",
      "cell": "cell phone",
      "building": "building name"
      "floor": "floor name",
      "department": "department name",
      "position": "position name",
    },
    // ... other employee records 
  ],
  "delete_not_listed_employees": true, // note: Optional field. If set to `true` all employees not listed in `items` section will be deleted; 
  "create_users": true, // note: Optional field. If set to `true` new user accounts will be created for each employee listed in `items` section. Users can get access to system via email (reset password required) or via OAuth (we support Microsoft OAuth)
  "release_desks": true // note: Optional field. If set to `true` all desks from `items[].desk_number` section will be released even if they have booked another employee
  "create_infinity_event_forced": true, // note: Optional field. If set to `true` employees will be assigned to desk permanently (infinity) even if desk_number empty; 
}

To import an employee, you should send an authenticated HTTP POST request to the URL https://your-workspace-name-here.fpm.cloud/api/v1/employee-imports with the payload in JSON format.

Below is the request payload schema (with comments): 

0 – waiting to be process 

2 – finished successfully

4 – permanently failed

After resolving the status as 2 or 4, you can start a new employee import.

Employee photos are synced through a two-step API flow:

  1. Upload the image
    POST /api/v1/avatars
    – multipart/form-data, field file (binary)
    – Returns an id of the uploaded avatar.
  2. Assign the photo to the employee
    PUT /api/v1/employees/{employeeId}
    – Include { “avatar_id”: <id> } in the body.

Employee Sync/Import Example

Powershell

$session = New-Object Microsoft.PowerShell.Commands.WebRequestSession
$session.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36"
$session.Cookies.Add((New-Object System.Net.Cookie("_csrf", "995c31332bd5724e1a5d41e5d3ae4a19c50616d44dd82483e4b085e1ecaa20eba%3A2%3A%7Bi%3A0%3Bs%3A5%3A%22_csrf%22%3Bi%3A1%3Bs%3A32%3A%22UYJLdvdf6bWwsjxSuPeHEyS89kKASxTR%22%3B%7D", "/", "your-workspace-name-here.fpm.cloud")))
Invoke-WebRequest -UseBasicParsing -Uri "https://your-workspace-name-here.fpm.cloud/api/v1/employee-imports?_t=1690808568581" `
-Method "POST" `
-WebSession $session `
-Headers @{
"authority"="your-workspace-name-here.fpm.cloud"
  "method"="POST"
  "path"="/api/v1/employee-imports?_t=1690808568581"
  "scheme"="https"
  "accept"="application/json, text/plain, */*"
  "authorization"="Basic alFHZmVxMGR5RDNXR1N2UjQzVzNmWDFnOXZCQ3ZIZEI6"
  "origin"="https://your-workspace-name-here.fpm.cloud"
} `
-ContentType "application/json;charset=UTF-8" `
-Body "{`"items`":[{`"email`":`"user2@example.com`",`"name`":`"user2-renamed`",`"phone`":`"11111-renamed`",`"desk_number`":`"DN-4`",`"cell`":`"PS-2`",`"building`":`"DP-2`"},{`"email`":`"user3@example.com`",`"name`":`"user3-renamed`",`"phone`":`"11111-renamed`",`"desk_number`":`"DN-3`",`"cell`":`"PS-3`",`"building`":`"DP-3`"},{`"email`":`"user4@example.com`",`"name`":`"user4-renamed`",`"phone`":`"11111-renamed`",`"desk_number`":`"DN-2`",`"cell`":`"PS-4`",`"building`":`"DP-4`"}],`"delete_not_listed_employees`":true,`"create_users`":true,`"release_desks`":true}"

Bash (cURL)

curl 'https://your-workspace-name-here.fpm.cloud/api/v1/employee-imports' \
  -H 'authority: your-workspace-name-here.fpm.cloud' \
  -H 'accept: application/json, text/plain, */*' \
  -H 'authorization: Basic alFHZmVxMGR5RDNXR1N2UjQzVzNmWDFnOXZCQ3ZIZEI6' \
  -H 'content-type: application/json;charset=UTF-8' \
  -H 'origin: https://your-workspace-name-here.fpm.cloud' \
  --data-raw '{"items":[{"email":"user2@example.com","name":"user2-renamed","phone":"11111-renamed","desk_number":"DN-4","cell":"PS-2","building":"DP-2"},{"email":"user3@example.com","name":"user3-renamed","phone":"11111-renamed","desk_number":"DN-3","cell":"PS-3","building":"DP-3"},{"email":"user4@example.com","name":"user4-renamed","phone":"11111-renamed","desk_number":"DN-2","cell":"PS-4","building":"DP-4"}],"delete_not_listed_employees":true,"create_users":true,"release_desks":true}' \
  --compressed \
  --insecure
Tags:  , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *