I have an API process that pulls data from a module that includes the Users dimension. There may be multiple users in the system concurrently and I need to keep their data separated. I need to filter the export from this module for a specific user -- the one who clicked on a link URL on an Anaplan dashboard to initiate a process. I am able to form an URL that includes that active user's username and to pass it to the downstream .html page, so I have that going for me. I can pass the userid to a nodejs script that performs Anaplan API calls and returns data to the .html page. The problem is that I need to have Anaplan API calls use that UserID to filter exported data. The API uses the credentials of a workspace admin account, so it can pull data for any User.
The only solution I can come up with is to run an IMPORT to push the current user's username to a Globals module Requesting User line item (format: List, Users), then filter the module view being exported with a boolean: ITEM(Users) = Globals.Requesting User. Finally, I'd push Blank to Globals.Requesting User after the export is done. This solution will not scale well. The process takes up to 30 seconds end-to-end, so users will certainly trip over each other in an app with many active users.
This would be a LOT cleaner if I could send a filtering parameter with my Export request. Filtered queries seems like a pretty normal usage. Is that possible but either I missed it or it's just not documented?
I saw that you got an answer on this internally, here is that for reference:
"No, basically you cannot do this. If you want to filter data on an export, you need to rely on 1/ user's data access 2/ the way you build the view your export is based on.
In the case you describe, sending the username back to Anaplan will be indeed too lengthy. Instead, you should match the username that you can export and use it for authentication. As you do not want to store passwords, you should consider Certificate authentication."
There isn't a mechanism for this in the API, the filter needs to be inculded in the export definition.
You could have a two stage process, where you set the export filter first (basically the scenario you have described).
Or you do as Cristophe suggested and use the API process to select user based exports by dynamically referencing their cert file or credentials.