How to know the user who has made an API call into the platform

I’ve created an endpoint that requires USER token validation. One of the functions of this endpoint creates a case. At this point, I need to know which API user triggered the case creation. I did a rule on case created to add a relation to the logged in user, expecting the API user account to be in a logged in state when the call is received, however, this is not working as I expected. I’ve looked a data preprocessor for this too, but the headers of the API call are not available in the params.

Does anyone know another way to achieve this?

Thanks

Kev

1 Like

Hi. This should work as you initially assumed, running a rule to relate to logged in user should work. I have just tried this successfully on a 22.2 app. To try and narrow it down…
What version are you on?
I assume the Case is being created successfully?
Is it being related to any user (e.g. a system user instead), or none at all?
If your app has multiple User objects, are the user credentials you are using for the correct one which can have the specified reationship to the Case?
Also, check the rule is not set to run in the background.