Examples

Explore these examples to understand how to use PulsePI in different scenarios.

Get User by Email

Retrieve a user by their email address.

json
{
  "module": "user",
  "action": "getByEmail",
  "params": {
    "email": "john.doe@example.com"
  }
}

Get Trending Posts with Limited Fields

Retrieve only the title and view count of trending posts.

json
{
  "module": "blog",
  "action": "getTrendingPosts",
  "params": {
    "_fields": ["title", "viewCount"]
  }
}

Create a New User

Create a new user with the provided information.

json
{
  "module": "user",
  "action": "create",
  "params": {
    "email": "new.user@example.com",
    "name": "New User",
    "role": "user",
    "password": "securePassword123"
  }
}

Batch Request: Get Users and Posts

Retrieve users and posts in a single request.

json
{
  "module": ["user", "posts"],
  "action": ["list", "getPosts"],
  "params": [
    { "_fields": ["name", "email"] },
    { "_fields": ["title", "content"] }
  ]
}

Filter Users by Age Range

Get users between 25 and 35 years old.

json
{
  "module": "user",
  "action": "list",
  "params": {
    "_fields": ["name", "age", "email"],
    "filters": [
      { "age": { "$gte": 25 } },
      { "age": { "$lte": 35 } }
    ]
  }
}