Skip to content

Two more functions for REST API development using the JSON component #316

Closed
@stefanov-sm

Description

@stefanov-sm

Discussed in #315

Originally posted by stefanov-sm May 13, 2024

Motivation

Build REST services that support GET, POST, PUT, DELETE, ... request methods and arbitrary length raw JSON input

Suggestion - add two more functions

  • sqlpage.request_method() function that returns the request method as text. This would allow for code like
select case sqlpage.request_method()
  when 'GET' then (...)
  when 'POST' then (...)
  when 'PUT' then (...)
 ...
end;
  • sqlpage.request_body() function that returns the request body payload as raw text. This would allow for code like (PostgreSQL)
with t(j) as 
(
  select jsonb_array_elements(sqlpage.request_body()::jsonb)
)
...

Expected result

A fully functional REST services development toolset based on the JSON component.

Metadata

Metadata

Assignees

No one assigned

    Labels

    functionsRelated to built-in sqlpage functionsgood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions