Hello. I am struggling to send variable to http ca...
# help
d
Hello. I am struggling to send variable to http call in postgres function. In the below snippet, email variable is not send in post request. API works if I use string value directly instead of email variable. Any help is highly appreciated. 🙏
Copy code
DO $$ 
DECLARE
   email VARCHAR(50) := 'John';
BEGIN 
PERFORM 
    http_post(
    'http://app.doneeoo.io/notification',
    '{"type":"notify-user","data":{"user": email,"provider":"email"}}',
    'application/json'
  );
END $$;
n
Hello @dipesh! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
g
Looks like you are trying to embed a var in a string. Use || concatenation with string then var then string. Or you can use format function.
n
dipesh (2022-05-21)
d
Exactly. Thank you for your guidance 🙇‍♂️
n
Thread was archived by @dipesh. Anyone can send a message to unarchive it.