Page tree
Skip to end of metadata
Go to start of metadata

To get information about a post, url parameters  needs to be sent as follows to be identified as a item request. 


In certain cases, it is not preferred to use item requests, in such cases we can fetch single record along with bulk records with the use of when condition.

 <Request method="GET" >
      <Sql id="posts" when="empty $url">
       from POST 
       where POST_URL is not null 
       order by CREATION_DATE desc
      <Sql id="post_info" >
        select * from 
        where POST_URL = $url;

In the above example, when the `url` parameter is NOT passed, all the posts with non-null page url will be fetched. 


Avoid blank Post Info

  "post_info": [],
  "posts": [
      "POST_ID": 8423,
      "PAGE_URL": "",
      "CREATION_DATE": "2022-07-23 18:12:05.0",

when  condition is applied post_info  to avoid empty display when $url is null.

<Sql id="post_info" when="not empty $url">
        select * from 
        where METAMUG_POST_PAGE_URL = $url;

Related Example

Fetch data for null request parameter from table

  • No labels