Hi thanks <@!764524500162445402> , this was my ini...
# help
c
Hi thanks @User , this was my initial approach after reading the pgsql-http docs but kept running into the error
cannot cast type record to http_request
with the function:
Copy code
begin
  select 
    "status", "content"::jsonb
  from 
    http((
      'GET',
      'https://jsonplaceholder.typicode.com/todos/1',
      http_header('My-Simple-Header', 'Some value..')
    )::http_request); 
end
(so was curious if the
http_post
had a header option - not overly familiar with pgsql syntax)
g
@User You need at minimum to pass header as array and I added the Nulls after (not sure if that was required or not). Mycode: select status FROM http(( 'DELETE', url, ARRAY[http_header('authorization','Bearer '||service_role_key)], NULL, NULL )::http_request) ); And you need to make sure search path contains extensions with: SET search_path = public, extensions in the function definition
c
Thanks @User - this helped/validated my understanding of pgsql a lot (turns out it was running after all but the response I got in the SQL implied there was an error with the function!)