Search code examples
slack-apislack-block-kitslack-bot

Nexudus Coworker desks fields have empty array value for the users who have their desks


I have integrated Nexudus to Slack bot, and I want to get the desks information of a coworker user from Nexudus. I can user nexudus coworkers endpoint to get the full information of coworker, and it includes the Desks field in the response body. But the problem is the Desks value is empty array though the user has own desk.


Solution

  • The Desks array in the Coworker entity is only used to associate a new customer with one or more desks, it will not have a value for existing customers.

    Desks (FloorPlanDesks) in Nexudus are associated to customers (Coworkers) via contracts (CoworkerContracts).

    To figure out what desks a customer is using based on the Id of that customer, you can get the list of contracts (https://developers.nexudus.com/reference/search-coworkercontract) by the Id of the customer. You may also want to filter the list to only include active contracts.

    GET https://spaces.nexudus.com/api/billing/coworkercontracts?coworkercontract_coworker=:coworkerid&coworkercontract_active=true
    

    The response will provide the following keys which will give you a summary of names and ids for the associated desks to those contracts.

    {
    "FloorPlanDeskIds": "1004266268,1004270271,1004270272,1079156153",
    "FloorPlanDeskNames": "Office 1,Desk 6,Desk 7,Desk 6",
    "FloorPlanDeskAreas": null,
    }
    

    You can also get the full details of each of the desks associated to a contract or a list of contracts using https://developers.nexudus.com/reference/search-floorplandesk.

    https://spaces.nexudus.com/api/sys/floorplandesks?floorplandesk_id=[1004266268,1004270271,1004270272,1079156153]