You can translate the question and the replies:

Api Post with session user

I would like to find out if we have Api to post and put , do you know a way how we can pass the session user and time to the table to capture who created and when For example if we have table Id Name Updatedby UpdatedDate If I post a record with the api , I want to pass the username and system date And the same when the record gets updated
user
25-11-2019 03:21:11 -0500
code

1 Answer

Hi, To pass the session’s username and date when submitting a POST or PUT request, you would need to develop a custom stored procedure. Virtual DataPort has a Java API, the [Denodo4E](https://community.denodo.com/docs/html/browse/7.0/denodo4e/install_denodo4e/install_denodo4e#installing-denodo4e) plug-in for Eclipse, that can be used to develop these custom components. I would suggest first creating a view in Virtual DataPort with the following query: `CREATE VIEW test AS SELECT GETSESSION('user'), CURRENT_DATE();` This view will return the current session’s username and date by utilizing the [GET_SESSIONS](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/stored_procedures/predefined_stored_procedures/get_sessions#get-sessions) stored procedure and [CURRENT_DATE](https://community.denodo.com/docs/html/browse/7.0/vdp/vql/appendix/syntax_of_condition_functions/date_processing_functions#current-date) function. Your custom stored procedure should get this view’s output and pass those values into the POST or PUT request to be inserted or updated in the table. You can read [Developing Stored Procedures](https://community.denodo.com/docs/html/browse/7.0/vdp/developer/developing_extensions/developing_stored_procedures/developing_stored_procedures) in the Virtual DataPort Developer Guide for more information on this topic. Hope this helps!
Denodo Team
26-11-2019 18:19:45 -0500
code
You must sign in to add an answer. If you do not have an account, you can register here