API weirdness, other questions

Hi,
The Expensify Advanced Updater has some weirdness to it. I am trying to update employees managers when they change. My initial API calls were giving me "employeeID" missing. When I gave it an employee ID field, it worked but it created a second field called "customField1" which I don't really want. Additionally, how do you make someone a policy admin with the API? When this script runs on people who are currently policy admins, it removes that admin. I've tried "isAdmin": true as well as "admin":true, buth to no avail. It's not listed anywhere in the docs.
Answers
-
@aranely Employee ID's will populate in the Employee's Custom Field in the People table. Can I ask why you don't want this populated?
To indicate an admin, you'll want to use:
"role": "admin"
-
This discussion here might be helpful!
-
Regarding the admin thing, I'm also creating an integration that updates the manager and this is how I set it up:
d = {
"EmployeeEmail": employeeemail,
"ManagerEmail": submitstoemail,
"Admin": self.isAdmin(employeeemail)
}
Since the API doesn't allow you to query for whether someone is already an admin, I created a text file that lists the current admins, which the function isAdmin checks. I then write that dict to a csv file and transmit it with the update request.
I know it's clunky and error-prone, but I didn't see any way around doing that or something similar.