API Workflow - Return Data with Specific Fields

My goal is to return only specific fields when an API Workflow is called, but the tricky thing is that it’s a list…

How would I return only a few fields of my choice from each user? I don’t know that privacy rules will work since other API workflows will require different fields. Thank you.

How do you categorize the users, I mean how do you know this user need to see these fields. this user that fields? How are the users differentiated?

Well it’s not per user, it’s per endpoint. Each endpoint needs certain fields.

I don’t think I am getting it clearly. Hope someone comes and solves this.

So each endpoint returns different data fields… for example, let’s says I have a “get_active_units” endpoint; that would return the unit’s identifier, username, status, active server, department, and assignment. Another endpoint is the lookup_user endpoint that I have with my bot, which gets nearly all account information (username, email, creation date, etc).

So there are 2 API endpoints with different fields.

You would like to control the field before making the call based on users role for example. Then

API will return those field’s value to that specific user?

So kind of, but not based on user role. I want to base it on which endpoint is being called. So if i call the GET_UNITS endpoint, it will return field a, b, and c; while if I call the LOOKUP_USER endpoint, it returns fields x, y, and z. So it’s a CAD/MDT, and units are police officers/firefighters/EMS/dispatchers. So the GET_UNITS will get all ACTIVE units who are onduty based on a field in the user type. But I want this endpoint to only return the PatrolStatus field, CurrentCall field, CurrentDepartment field, CurrentIdentifier field, and all the other fields that pertain to their on-duty status (not their user account, such as email). But for the lookup endpoint, I want it to return all their account data (email, username, UID, etc). But obviously, since they’re the same data type, I can’t really select the fields to return without it affecting the other endpoint’s response fields. Not sure if that makes sense, but I do appreciate your intent to help!