GUIDE how to use "Advanced employee updater" API with postman

Raul_Hernandez
Raul_Hernandez Expensify Customer Posts: 7 Expensify Newcomer

Yes, if you are here is because documentation for this API request is just wrong. After a few days of trying and searching for the right answer, I finally figure it out based on a few posts and information on the web.

What you are going to need:

1-.Account with policy admin rights. (see image below to determine if you account has the correct rights)

2-.Get your UserID and UserSecret by going here

https://www.expensify.com/tools/integrations/?action=create

3-.Postman access so you can test your request.


Instructions

  • Create a new request
  • Select POST as the method
  • Copy-paste this to the URL section

https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations

  • Do not add anything to "Params", "Authorization" or "Header". Go straight to "Body"
  • Select "x-www-form-urlencoded" and add 2 keys "requestJobDescription" and "data"
  • For "requestJobDescription" copy-paste the following text and replace the values for "partnerUserID", "partner_UserSecret" and "recipients". Remember that "dry-run"=true means that its just for testing. Set it to false whenever you are ready to modify that in production.

{

    "type": "update",

    "dry-run" : true,

    "credentials": {

      "partnerUserID": "aa_api_domain_com",

      "partnerUserSecret": "xxx"

    },

    "dataSource" : "request",

    "inputSettings": {

      "type": "employees",

       "entity": "generic"

    },

    "onFinish":[

      {"actionName": "email", "recipients":"admin1@domain.com"}  

    ]

  }'

  • For "data" copy-paste the following text and replace values as needed

{

    "Employees":[

      { 

        "employeeEmail": "user@domain.com", 

        "managerEmail": "usermanager@domain.com",

        "policyID": "1D1BC525C4892584", 

"isTerminated": "false",

     }

]}


  • Finally, hit the SEND button and voila!


This is how it should look on postman.

This is how the value looks inside those keys (yeah, the format is kinda weird in postman)


Remember that there are 4 required fields needed in order to make this API call to work.

Make sure to check out the link for more fields and examples on the official guide


Let me know if you have any questions.

Comments

  • Raul_Hernandez
    Raul_Hernandez Expensify Customer Posts: 7 Expensify Newcomer

    Looks like this also works if you use the PARAMS sections. In my case it didn't work as my "data" payload is way to big to be contained on an URL. (around 3000 users)


  • DestituteRoot
    DestituteRoot Expensify Customer Posts: 1

    I struggled with this. The way they've outlined in the documentation is frankly awful.

    After two days of testing I found a way that works much better for me. It might work better for you too. I'll use the get cards for my example, should be able to use a comma after the closing bracket and add data the same way.

    Under headers, add a new row for "Content-Type" with the value "application/x-www-form-urlencoded"

    Unhide the auto-generated headers and uncheck the top Content-Type row.

    Then, in body, set the value to "raw" and leave the format option as "Text"

    Body should look like this:

    Hope it helps.