# Airbnb-Style Rental Marketplace Backend - REST API Reference
> Complete REST API documentation for all services in Airbnb-Style Rental Marketplace Backend
This document provides comprehensive REST API documentation for all services. Use this reference to understand available endpoints, request/response formats, and authentication requirements.
---
## Table of Contents
- [Introduction](#introduction)
- [Auth Service REST API](#auth-service-rest-api-guide)
- [Messaging Service REST API](#messaging-service-rest-api-guide)
- [PropertyCatalog Service REST API](#propertycatalog-service-rest-api-guide)
- [BookingManagement Service REST API](#bookingmanagement-service-rest-api-guide)
- [ReviewSystem Service REST API](#reviewsystem-service-rest-api-guide)
- [PlatformAdmin Service REST API](#platformadmin-service-rest-api-guide)
- [AgentHub Service REST API](#agenthub-service-rest-api-guide)
- [Bff Service REST API](#bff-service-rest-api-guide)
- [Notification Service REST API](#notification-service-rest-api-guide)
---
## Introduction
# Airbnb-Style Rental Marketplace Backend
Version : 1.0.108
airbnb is a global platform enabling hosts to list properties and guests to book short-term stays with secure payments, messaging, and review systems. It connects hosts and guests through a robust travel/hospitality marketplace, handling authentication, bookings, payments, and moderation. The backend supports global operations with multi-language and multi-currency features...
## How to Use Project Documents
The `Airbnb` project has been designed and generated using **Mindbricks**, a powerful microservice-based backend generation platform. All documentation is automatically produced by the **Mindbricks Genesis Engine**, based on the high-level architectural patterns defined by the user or inferred by AI.
This documentation set is intended for both **AI agents** and **human developers**—including frontend and backend engineers—who need precise and structured information about how to interact with the backend services of this project. Each document reflects the live architecture of the system, providing a reliable reference for API consumption, data models, authentication flows, and business logic.
By following this documentation, developers can seamlessly integrate with the backend, while AI agents can use it to reason about the service structure, make accurate decisions, or even generate compatible client-side code.
## Accessing Project Services
Each service generated by Mindbricks is exposed via a **dedicated REST API** endpoint. Every service documentation set includes the **base URL** of that service along with the **specific API paths** for each available route.
Before consuming any API, developers or agents must understand the service URL structure and environment-specific endpoints.
### Service Endpoint Structure
| Environment | URL Pattern Example |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/auth-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/auth-api` |
| **Production** | `https://airbnb3.mindbricks.co/auth-api` |
Replace `auth` with the actual service name as lower case (e.g., `order-api`, `bff-service`, customermanagement-api etc.).
### Environment Usage Notes
* **Preview APIs** become accessible after a project is previewed inside the Mindbricks platform. These are ideal for development and testing.
* **Staging** and **Production** APIs are only accessible after the project is deployed to cloud environments provisioned via Mindbricks.
* In some cases, the project owner may choose to deploy services on their **own infrastructure**. In such scenarios, the service base URLs will be **custom** and should be communicated manually by the project owner to developers or AI agents.
> **Frontend applications** should be designed to **easily switch between environments**, allowing dynamic endpoint targeting for Preview, Staging, and Production.
## Getting Started: Use the Auth Service First
Before interacting with other services in the `Airbnb` project, **AI agents and developers should begin by integrating with the Auth Service**.
Mindbricks automatically generates a dedicated authentication microservice based on the project’s authentication definitions provided by the architect. This service provides the essential user and access management foundation for the project.
Agents should first utilize the Auth Service to:
* Register and authenticate users (login)
* Manage users, roles, and permissions
* Handle user groups (if defined)
* Support multi-tenancy logic (if configured)
* Perform Policy-Based Access Control (PBAC), if activated by the architect
### Auth Service Documentation
Use the following resources to understand and integrate the Auth Service:
* **REST API Guide** – ideal for frontend and direct HTTP usage
[Auth REST API Guide](/document/docs/auth-service/rest-api-guide.html)
* **Event Guide** – helpful for event-driven or cross-service integrations
[Auth Event Guide](/document/docs/auth-service/event-guide.html)
* **Service Design Document** – overall structure, patterns, and logic
[Auth Service Design](/document/docs/auth-service/service-design.html)
> **Note:** For most frontend use cases, the **REST API Guide** will be the primary source. The **Event Guide** and **Service Design** documents are especially useful when integrating with other backend microservices or building systems that interact with the auth service indirectly.
## Using the BFF (Backend-for-Frontend) Service
In Mindbricks, all backend services are designed with an advanced **CQRS (Command Query Responsibility Segregation)** architecture. Within this architecture, **business services** are responsible for managing their respective domains and ensuring the accuracy and freshness of domain data.
The **BFF service** complements these business services by providing a **read-only** aggregation and query layer tailored specifically for frontend and client-side applications.
### Key Principles of the BFF Service
* **Elasticsearch Replicas for Fast Queries:**
Each data object managed by a business service is automatically replicated as an **Elasticsearch index**, making it accessible for fast, frontend-oriented queries through the BFF.
* **Cross-Service Data Aggregation:**
The BFF offers an **aggregation layer** capable of combining data across multiple services, enabling complex filters, searches, and unified views of related data.
* **Read-Only by Design:**
The BFF service is **strictly read-only**. All create, update, or delete operations must be performed through the relevant business services, or via event-driven sagas if designed.
### BFF Service Documentation
* **REST API Guide** – querying aggregated and indexed data
[BFF REST API Guide](/document/docs/bff-service/rest-api-guide.html)
* **Event Guide** – syncing strategies across replicas
[BFF Event Guide](/document/docs/bff-service/event-guide.html)
* **Service Design** – aggregation patterns and index structures
[BFF Service Design](/document/docs/bff-service/service-design.html)
> **Tip:** Use the BFF service as the **main entry point for all frontend data queries**. It simplifies access, reduces round-trips, and ensures that data is shaped appropriately for the UI layer.
## Business Services Overview
The `Airbnb-Style Rental Marketplace Backend` project consists of multiple **business services**, each responsible for managing a specific domain within the system. These services expose their own REST APIs and documentation sets, and are accessible based on the environment (Preview, Staging, Production).
### Usage Guidance
Business services are primarily designed to:
* Handle the **state and operations of domain data**
* Offer **Create, Update, Delete** operations over owned entities
* Serve **direct data queries** (`get`, `list`) for their own objects when needed
For advanced query needs across multiple services or aggregated views, prefer using the [BFF service](#using-the-bff-backend-for-frontend-service).
### Available Business Services
### messaging Service
**Description:** Enables secure in-app messaging between guests and hosts. Handles threads, messages (with text/media/system types), abuse flagging, and admin moderation for resolution..
**Documentation:**
* [REST API Guide](/document/docs/messaging-service/rest-api-guide.html)
* [Event Guide](/document/docs/messaging-service/event-guide.html)
* [Service Design](/document/docs/messaging-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/messaging-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/messaging-api` |
| **Production** | `https://airbnb3.mindbricks.co/messaging-api` |
### propertyCatalog Service
**Description:** Service for management of property listings, calendars, amenities, and localization for a short-term rental marketplace. Hosts can manage listings, availability, multi-language descriptions, policies, pricing, and attributes, served for global search and discovery...
**Documentation:**
* [REST API Guide](/document/docs/propertyCatalog-service/rest-api-guide.html)
* [Event Guide](/document/docs/propertyCatalog-service/event-guide.html)
* [Service Design](/document/docs/propertyCatalog-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/propertycatalog-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/propertycatalog-api` |
| **Production** | `https://airbnb3.mindbricks.co/propertycatalog-api` |
### bookingManagement Service
**Description:** Orchestrates booking, payment, calendar, changewsand dispute flows for Airbnb-style short-term rental marketplace...test Handles reservations, approval, Stripe payments, iCal sync, payment records, and the dispute/refund lifecycle with host/guest/admin visibility.
**Documentation:**
* [REST API Guide](/document/docs/bookingManagement-service/rest-api-guide.html)
* [Event Guide](/document/docs/bookingManagement-service/event-guide.html)
* [Service Design](/document/docs/bookingManagement-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/bookingmanagement-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/bookingmanagement-api` |
| **Production** | `https://airbnb3.mindbricks.co/bookingmanagement-api` |
### reviewSystem Service
**Description:** Handles double-blind, moderated reviews and rating aggregation for stays. Allows guests/hosts to review each other and listings, supports moderation, and exposes aggregate stats for listings/profiles...
**Documentation:**
* [REST API Guide](/document/docs/reviewSystem-service/rest-api-guide.html)
* [Event Guide](/document/docs/reviewSystem-service/event-guide.html)
* [Service Design](/document/docs/reviewSystem-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/reviewsystem-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/reviewsystem-api` |
| **Production** | `https://airbnb3.mindbricks.co/reviewsystem-api` |
### platformAdmin Service
**Description:** Administrative and compliance management backend for moderation, audit, dispute, financial oversight, localization, and GDPR in the Airbnb-style rental platform.
**Documentation:**
* [REST API Guide](/document/docs/platformAdmin-service/rest-api-guide.html)
* [Event Guide](/document/docs/platformAdmin-service/event-guide.html)
* [Service Design](/document/docs/platformAdmin-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/platformadmin-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/platformadmin-api` |
| **Production** | `https://airbnb3.mindbricks.co/platformadmin-api` |
### agentHub Service
**Description:** AI Agent Hub
**Documentation:**
* [REST API Guide](/document/docs/agentHub-service/rest-api-guide.html)
* [Event Guide](/document/docs/agentHub-service/event-guide.html)
* [Service Design](/document/docs/agentHub-service/service-design.html)
**Base URL Examples:**
| Environment | URL |
|-------------|---------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/agenthub-api` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/agenthub-api` |
| **Production** | `https://airbnb3.mindbricks.co/agenthub-api` |
## Connect via MCP (Model Context Protocol)
All backend services in the `Airbnb` project expose their Business APIs as **MCP tools**. These tools are aggregated by the **MCP-BFF** service into a single unified endpoint that external AI tools can connect to.
### Unified MCP Endpoint
| Environment | StreamableHTTP (recommended) | SSE (legacy fallback) |
|-------------|------------------------------|------------------------|
| **Preview** | `https://airbnb3.prw.mindbricks.com/mcpbff-api/mcp` | `https://airbnb3.prw.mindbricks.com/mcpbff-api/mcp/sse` |
| **Staging** | `https://airbnb3-stage.mindbricks.co/mcpbff-api/mcp` | `https://airbnb3-stage.mindbricks.co/mcpbff-api/mcp/sse` |
| **Production** | `https://airbnb3.mindbricks.co/mcpbff-api/mcp` | `https://airbnb3.mindbricks.co/mcpbff-api/mcp/sse` |
### Authentication
MCP connections require authentication via the `Authorization` header:
- **API Key (recommended for AI agents):** `Authorization: Bearer sk_mbx_your_api_key_here`
API keys are long-lived and don't expire like JWT tokens. Create one from the profile page.
- **JWT Token:** `Authorization: Bearer {accessToken}`
Use a valid access token obtained from the login API.
> **OAuth is not supported** for MCP connections at this time.
### Connecting from Cursor
Add the following to your project's `.cursor/mcp.json`:
```json
{
"mcpServers": {
"airbnb3": {
"url": "https://airbnb3.prw.mindbricks.com/mcpbff-api/mcp",
"headers": {
"Authorization": "Bearer sk_mbx_your_api_key_here"
}
}
}
}
```
### Connecting from Claude Desktop
Add to your Claude Desktop configuration (`claude_desktop_config.json`):
```json
{
"mcpServers": {
"airbnb3": {
"url": "https://airbnb3.prw.mindbricks.com/mcpbff-api/mcp",
"headers": {
"Authorization": "Bearer sk_mbx_your_api_key_here"
}
}
}
}
```
### What's Available
Once connected, the AI tool can discover and call all Business API tools from all services — CRUD operations, custom queries, file operations, and more. The MCP-BFF handles routing each tool call to the correct backend service and propagates your authentication context.
---
## Conclusion
This documentation set provides a comprehensive guide for understanding and consuming the `Airbnb-Style Rental Marketplace Backend` backend, generated by the Mindbricks platform. It is structured to support both AI agents and human developers in navigating authentication, data access, service responsibilities, and system architecture.
To summarize:
* Start with the **Auth Service** to manage users, roles, sessions, and permissions.
* Use the **BFF Service** for optimized, read-only data queries and cross-service aggregation.
* Refer to the **Business Services** when you need to manage domain-specific data or perform direct CRUD operations.
Each service offers a complete set of documentation—REST API guides, event interface definitions, and design insights—to help you integrate efficiently and confidently.
Whether you are building a frontend application, configuring an automation agent, or simply exploring the architecture, this documentation is your primary reference for working with the backend of this project.
> For environment-specific access, ensure you're using the correct base URLs (Preview, Staging, Production), and coordinate with the project owner for any custom deployments.
---
## Service API Documentation
# REST API GUIDE
## airbnb-auth-service
**Version:** `1.0.8`
Authentication service for the project
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the Auth Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our Auth Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the Auth Service via HTTP requests for purposes such as creating, updating, deleting and querying Auth objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the Auth Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the Auth service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the Auth service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the Auth service.
This service is configured to listen for HTTP requests on port `3011`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/auth-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/auth-api`
* **Production:** `https://airbnb3.mindbricks.co/auth-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the Auth service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `Auth` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `Auth` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `Auth` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
Auth service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### User resource
*Resource Definition* : A data object that stores the user information and handles login settings.
*User Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **email** | String | | | * A string value to represent the user's email.* |
| **password** | String | | | * A string value to represent the user's password. It will be stored as hashed.* |
| **fullname** | String | | | *A string value to represent the fullname of the user* |
| **avatar** | String | | | *The avatar url of the user. A random avatar will be generated if not provided* |
| **roleId** | String | | | *A string value to represent the roleId of the user.* |
| **emailVerified** | Boolean | | | *A boolean value to represent the email verification status of the user.* |
| **preferredLanguage** | String | | | *User's preferred language for the application interface* |
| **bio** | Text | | | *User's biography or profile description* |
### UserGroup resource
*Resource Definition* : A data object that stores the user group information.
*UserGroup Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **groupName** | String | | | * A string value to represent the group name.* |
| **avatar** | String | | | * A string value to represent the groups icon.* |
### UserGroupMember resource
*Resource Definition* : A data object that stores the members of the user group.
*UserGroupMember Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **groupId** | ID | | | * An ID value to represent the group that the user is asssigned as a memeber to.* |
| **userId** | ID | | | * An ID value to represent the user that is assgined as a member to the group.* |
| **ownerId** | ID | | | *An ID value to represent the admin user who assgined the member.* |
### UserAvatarsFile resource
*Resource Definition* : Auto-generated file storage for the userAvatars database bucket. Files are stored as BYTEA in PostgreSQL.
*UserAvatarsFile Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **fileName** | String | | | *Original file name as uploaded by the client.* |
| **mimeType** | String | | | *MIME type of the uploaded file (e.g., image/png, application/pdf).* |
| **fileSize** | Integer | | | *File size in bytes.* |
| **accessKey** | String | | | *12-character random key for shareable access. Auto-generated on upload.* |
| **ownerId** | ID | | | *ID of the user who uploaded the file (from session).* |
| **fileData** | Blob | | | *Binary file content. Stored as BYTEA in PostgreSQL or Buffer in MongoDB.* |
| **metadata** | Object | | | *Optional JSON metadata for the file (tags, alt text, etc.).* |
| **userId** | ID | | | *Reference to the owner user record.* |
## Business Api
### `Get User` API
This api is used by admin roles or the users themselves to get the user profile information.
**Rest Route**
The `getUser` API REST controller can be triggered via the following route:
`/v1/users/:userId`
**Rest Request Parameters**
The `getUser` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/users/:userId**
```js
axios({
method: 'GET',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update User` API
This route is used by admins to update user profiles.
**Rest Route**
The `updateUser` API REST controller can be triggered via the following route:
`/v1/users/:userId`
**Rest Request Parameters**
The `updateUser` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
| fullname | String | false | request.body?.["fullname"] |
| avatar | String | false | request.body?.["avatar"] |
| preferredLanguage | String | false | request.body?.["preferredLanguage"] |
| bio | Text | false | request.body?.["bio"] |
**userId** : This id paremeter is used to select the required data object that will be updated
**fullname** : A string value to represent the fullname of the user
**avatar** : The avatar url of the user. A random avatar will be generated if not provided
**preferredLanguage** : User's preferred language for the application interface
**bio** : User's biography or profile description
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/users/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/users/${userId}`,
data: {
fullname:"String",
avatar:"String",
preferredLanguage:"String",
bio:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Profile` API
This route is used by users to update their profiles.
**Rest Route**
The `updateProfile` API REST controller can be triggered via the following route:
`/v1/profile/:userId`
**Rest Request Parameters**
The `updateProfile` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
| fullname | String | false | request.body?.["fullname"] |
| avatar | String | false | request.body?.["avatar"] |
| preferredLanguage | String | false | request.body?.["preferredLanguage"] |
| bio | Text | false | request.body?.["bio"] |
**userId** : This id paremeter is used to select the required data object that will be updated
**fullname** : A string value to represent the fullname of the user
**avatar** : The avatar url of the user. A random avatar will be generated if not provided
**preferredLanguage** : User's preferred language for the application interface
**bio** : User's biography or profile description
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/profile/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/profile/${userId}`,
data: {
fullname:"String",
avatar:"String",
preferredLanguage:"String",
bio:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create User` API
This api is used by admin roles to create a new user manually from admin panels
**Rest Route**
The `createUser` API REST controller can be triggered via the following route:
`/v1/users`
**Rest Request Parameters**
The `createUser` api has got 6 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| avatar | String | false | request.body?.["avatar"] |
| email | String | true | request.body?.["email"] |
| password | String | true | request.body?.["password"] |
| fullname | String | true | request.body?.["fullname"] |
| preferredLanguage | String | false | request.body?.["preferredLanguage"] |
| bio | Text | false | request.body?.["bio"] |
**avatar** : The avatar url of the user. If not sent, a default random one will be generated.
**email** : A string value to represent the user's email.
**password** : A string value to represent the user's password. It will be stored as hashed.
**fullname** : A string value to represent the fullname of the user
**preferredLanguage** : User's preferred language for the application interface
**bio** : User's biography or profile description
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/users**
```js
axios({
method: 'POST',
url: '/v1/users',
data: {
avatar:"String",
email:"String",
password:"String",
fullname:"String",
preferredLanguage:"String",
bio:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete User` API
This api is used by admins to delete user profiles.
**Rest Route**
The `deleteUser` API REST controller can be triggered via the following route:
`/v1/users/:userId`
**Rest Request Parameters**
The `deleteUser` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/users/:userId**
```js
axios({
method: 'DELETE',
url: `/v1/users/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Archive Profile` API
This api is used by users to archive their profiles.
**Rest Route**
The `archiveProfile` API REST controller can be triggered via the following route:
`/v1/archiveprofile/:userId`
**Rest Request Parameters**
The `archiveProfile` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/archiveprofile/:userId**
```js
axios({
method: 'DELETE',
url: `/v1/archiveprofile/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Users` API
The list of users is filtered by the tenantId.
**Rest Route**
The `listUsers` API REST controller can be triggered via the following route:
`/v1/users`
**Rest Request Parameters**
**Filter Parameters**
The `listUsers` api supports 3 optional filter parameters for filtering list results:
**email** (`String`): A string value to represent the user's email.
- Single (partial match, case-insensitive): `?email=`
- Multiple: `?email=&email=`
- Null: `?email=null`
**fullname** (`String`): A string value to represent the fullname of the user
- Single (partial match, case-insensitive): `?fullname=`
- Multiple: `?fullname=&fullname=`
- Null: `?fullname=null`
**roleId** (`String`): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive): `?roleId=`
- Multiple: `?roleId=&roleId=`
- Null: `?roleId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/users**
```js
axios({
method: 'GET',
url: '/v1/users',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// email: '' // Filter by email
// fullname: '' // Filter by fullname
// roleId: '' // Filter by roleId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "users",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"users": [
{
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Search Users` API
The list of users is filtered by the tenantId.
**Rest Route**
The `searchUsers` API REST controller can be triggered via the following route:
`/v1/searchusers`
**Rest Request Parameters**
The `searchUsers` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| keyword | String | true | request.query?.["keyword"] |
**keyword** :
**Filter Parameters**
The `searchUsers` api supports 1 optional filter parameter for filtering list results:
**roleId** (`String`): A string value to represent the roleId of the user.
- Single (partial match, case-insensitive): `?roleId=`
- Multiple: `?roleId=&roleId=`
- Null: `?roleId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/searchusers**
```js
axios({
method: 'GET',
url: '/v1/searchusers',
data: {
},
params: {
keyword:'"String"',
// Filter parameters (see Filter Parameters section above)
// roleId: '' // Filter by roleId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "users",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"users": [
{
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Userrole` API
This route is used by admin roles to update the user role.The default role is user when a user is registered. A user's role can be updated by superAdmin or admin
**Rest Route**
The `updateUserRole` API REST controller can be triggered via the following route:
`/v1/userrole/:userId`
**Rest Request Parameters**
The `updateUserRole` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
| roleId | String | true | request.body?.["roleId"] |
**userId** : This id paremeter is used to select the required data object that will be updated
**roleId** : The new roleId of the user to be updated
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/userrole/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/userrole/${userId}`,
data: {
roleId:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Userpassword` API
This route is used to update the password of users in the profile page by users themselves
**Rest Route**
The `updateUserPassword` API REST controller can be triggered via the following route:
`/v1/userpassword/:userId`
**Rest Request Parameters**
The `updateUserPassword` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
| oldPassword | String | true | request.body?.["oldPassword"] |
| newPassword | String | true | request.body?.["newPassword"] |
**userId** : This id paremeter is used to select the required data object that will be updated
**oldPassword** : The old password of the user that will be overridden bu the new one. Send for double check.
**newPassword** : The new password of the user to be updated
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/userpassword/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/userpassword/${userId}`,
data: {
oldPassword:"String",
newPassword:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Userpasswordbyadmin` API
This route is used to change any user password by admins only. Superadmin can chnage all passwords, admins can change only nonadmin passwords
**Rest Route**
The `updateUserPasswordByAdmin` API REST controller can be triggered via the following route:
`/v1/userpasswordbyadmin/:userId`
**Rest Request Parameters**
The `updateUserPasswordByAdmin` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
| password | String | true | request.body?.["password"] |
**userId** : This id paremeter is used to select the required data object that will be updated
**password** : The new password of the user to be updated
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/userpasswordbyadmin/:userId**
```js
axios({
method: 'PATCH',
url: `/v1/userpasswordbyadmin/${userId}`,
data: {
password:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Briefuser` API
This route is used by public to get simple user profile information.
**Rest Route**
The `getBriefUser` API REST controller can be triggered via the following route:
`/v1/briefuser/:userId`
**Rest Request Parameters**
The `getBriefUser` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/briefuser/:userId**
```js
axios({
method: 'GET',
url: `/v1/briefuser/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
This route's response is constrained to a select list of properties, and therefore does not encompass all attributes of the resource.
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"isActive": true
}
}
```
### `Stream Test` API
Test API for iterator action streaming via SSE.
**Rest Route**
The `streamTest` API REST controller can be triggered via the following route:
`/v1/streamtest/:userId`
**Rest Request Parameters**
The `streamTest` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/streamtest/:userId**
```js
axios({
method: 'GET',
url: `/v1/streamtest/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Register User` API
This api is used by public users to register themselves
**Rest Route**
The `registerUser` API REST controller can be triggered via the following route:
`/v1/registeruser`
**Rest Request Parameters**
The `registerUser` api has got 6 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| avatar | String | false | request.body?.["avatar"] |
| password | String | true | request.body?.["password"] |
| fullname | String | true | request.body?.["fullname"] |
| email | String | true | request.body?.["email"] |
| preferredLanguage | String | false | request.body?.["preferredLanguage"] |
| bio | Text | false | request.body?.["bio"] |
**avatar** : The avatar url of the user. If not sent, a default random one will be generated.
**password** : The password defined by the the user that is being registered.
**fullname** : The fullname defined by the the user that is being registered.
**email** : The email defined by the the user that is being registered.
**preferredLanguage** : User's preferred language for the application interface
**bio** : User's biography or profile description
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/registeruser**
```js
axios({
method: 'POST',
url: '/v1/registeruser',
data: {
avatar:"String",
password:"String",
fullname:"String",
email:"String",
preferredLanguage:"String",
bio:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "user",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"user": {
"id": "ID",
"email": "String",
"password": "String",
"fullname": "String",
"avatar": "String",
"roleId": "String",
"emailVerified": "Boolean",
"preferredLanguage": "String",
"bio": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Usergroup` API
This route is used by admin roles to create a new usergroup manually from admin panels
**Rest Route**
The `createUserGroup` API REST controller can be triggered via the following route:
`/v1/usergroups`
**Rest Request Parameters**
The `createUserGroup` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| avatar | String | false | request.body?.["avatar"] |
| groupName | String | true | request.body?.["groupName"] |
**avatar** : A string value to represent the groups icon.
**groupName** : A string value to represent the group name.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/usergroups**
```js
axios({
method: 'POST',
url: '/v1/usergroups',
data: {
avatar:"String",
groupName:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroup",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"userGroup": {
"id": "ID",
"groupName": "String",
"avatar": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Usergroup` API
This route is used by admin to update user groups.
**Rest Route**
The `updateUserGroup` API REST controller can be triggered via the following route:
`/v1/usergroups/:userGroupId`
**Rest Request Parameters**
The `updateUserGroup` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userGroupId | ID | true | request.params?.["userGroupId"] |
| groupName | String | false | request.body?.["groupName"] |
| avatar | String | false | request.body?.["avatar"] |
**userGroupId** : This id paremeter is used to select the required data object that will be updated
**groupName** : A string value to represent the group name.
**avatar** : A string value to represent the groups icon.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/usergroups/:userGroupId**
```js
axios({
method: 'PATCH',
url: `/v1/usergroups/${userGroupId}`,
data: {
groupName:"String",
avatar:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroup",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"userGroup": {
"id": "ID",
"groupName": "String",
"avatar": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Usergroup` API
This route is used by admin to delete a user group.
**Rest Route**
The `deleteUserGroup` API REST controller can be triggered via the following route:
`/v1/usergroups/:userGroupId`
**Rest Request Parameters**
The `deleteUserGroup` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userGroupId | ID | true | request.params?.["userGroupId"] |
**userGroupId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/usergroups/:userGroupId**
```js
axios({
method: 'DELETE',
url: `/v1/usergroups/${userGroupId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroup",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"userGroup": {
"id": "ID",
"groupName": "String",
"avatar": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Usergroup` API
This is a public route to get the user group information.
**Rest Route**
The `getUserGroup` API REST controller can be triggered via the following route:
`/v1/usergroups/:userGroupId`
**Rest Request Parameters**
The `getUserGroup` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userGroupId | ID | true | request.params?.["userGroupId"] |
**userGroupId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/usergroups/:userGroupId**
```js
axios({
method: 'GET',
url: `/v1/usergroups/${userGroupId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroup",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userGroup": {
"id": "ID",
"groupName": "String",
"avatar": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Usergroups` API
This is a public route to get the list of groups.
**Rest Route**
The `listUserGroups` API REST controller can be triggered via the following route:
`/v1/usergroups`
**Rest Request Parameters**
**Filter Parameters**
The `listUserGroups` api supports 2 optional filter parameters for filtering list results:
**groupName** (`String`): A string value to represent the group name.
- Single (partial match, case-insensitive): `?groupName=`
- Multiple: `?groupName=&groupName=`
- Null: `?groupName=null`
**avatar** (`String`): A string value to represent the groups icon.
- Single (partial match, case-insensitive): `?avatar=`
- Multiple: `?avatar=&avatar=`
- Null: `?avatar=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/usergroups**
```js
axios({
method: 'GET',
url: '/v1/usergroups',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// groupName: '' // Filter by groupName
// avatar: '' // Filter by avatar
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroups",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userGroups": [
{
"id": "ID",
"groupName": "String",
"avatar": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Usergroupmember` API
This is a public route to get the user group member information.
**Rest Route**
The `getUserGroupMember` API REST controller can be triggered via the following route:
`/v1/usergroupmembers/:userGroupMemberId`
**Rest Request Parameters**
The `getUserGroupMember` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userGroupMemberId | ID | true | request.params?.["userGroupMemberId"] |
**userGroupMemberId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/usergroupmembers/:userGroupMemberId**
```js
axios({
method: 'GET',
url: `/v1/usergroupmembers/${userGroupMemberId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroupMember",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userGroupMember": {
"id": "ID",
"groupId": "ID",
"userId": "ID",
"ownerId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Usergroupmember` API
This route is used by admin roles to add a user to a group.
**Rest Route**
The `createUserGroupMember` API REST controller can be triggered via the following route:
`/v1/usergroupmembers`
**Rest Request Parameters**
The `createUserGroupMember` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| groupId | ID | true | request.body?.["groupId"] |
| userId | ID | true | request.body?.["userId"] |
**groupId** : An ID value to represent the group that the user is asssigned as a memeber to.
**userId** : An ID value to represent the user that is assgined as a member to the group.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/usergroupmembers**
```js
axios({
method: 'POST',
url: '/v1/usergroupmembers',
data: {
groupId:"ID",
userId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroupMember",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"userGroupMember": {
"id": "ID",
"groupId": "ID",
"userId": "ID",
"ownerId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Usergroupmember` API
This route is used by admin to delete a member from a group.
**Rest Route**
The `deleteUserGroupMember` API REST controller can be triggered via the following route:
`/v1/usergroupmembers/:userGroupMemberId`
**Rest Request Parameters**
The `deleteUserGroupMember` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userGroupMemberId | ID | true | request.params?.["userGroupMemberId"] |
**userGroupMemberId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/usergroupmembers/:userGroupMemberId**
```js
axios({
method: 'DELETE',
url: `/v1/usergroupmembers/${userGroupMemberId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroupMember",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"userGroupMember": {
"id": "ID",
"groupId": "ID",
"userId": "ID",
"ownerId": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Usergroupmembers` API
This is a public route to get the list of group members of a group.
**Rest Route**
The `listUserGroupMembers` API REST controller can be triggered via the following route:
`/v1/listusergroupmembers/:groupId`
**Rest Request Parameters**
The `listUserGroupMembers` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| groupId | ID | true | request.params?.["groupId"] |
**groupId** : An ID value to represent the group that the user is asssigned as a memeber to.. The parameter is used to query data.
**Filter Parameters**
The `listUserGroupMembers` api supports 2 optional filter parameters for filtering list results:
**userId** (`ID`): An ID value to represent the user that is assgined as a member to the group.
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**ownerId** (`ID`): An ID value to represent the admin user who assgined the member.
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listusergroupmembers/:groupId**
```js
axios({
method: 'GET',
url: `/v1/listusergroupmembers/${groupId}`,
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// userId: '' // Filter by userId
// ownerId: '' // Filter by ownerId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userGroupMembers",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userGroupMembers": [
{
"id": "ID",
"groupId": "ID",
"userId": "ID",
"ownerId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"user": [
{
"email": "String",
"fullname": "String",
"avatar": "String"
},
{},
{}
]
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Useravatarsfile` API
**[Default get API]** — This is the designated default `get` API for the `userAvatarsFile` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `getUserAvatarsFile` API REST controller can be triggered via the following route:
`/v1/useravatarsfiles/:userAvatarsFileId`
**Rest Request Parameters**
The `getUserAvatarsFile` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userAvatarsFileId | ID | true | request.params?.["userAvatarsFileId"] |
**userAvatarsFileId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/useravatarsfiles/:userAvatarsFileId**
```js
axios({
method: 'GET',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFile",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"userAvatarsFile": {
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `List Useravatarsfiles` API
**[Default list API]** — This is the designated default `list` API for the `userAvatarsFile` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `listUserAvatarsFiles` API REST controller can be triggered via the following route:
`/v1/useravatarsfiles`
**Rest Request Parameters**
**Filter Parameters**
The `listUserAvatarsFiles` api supports 3 optional filter parameters for filtering list results:
**mimeType** (`String`): MIME type of the uploaded file (e.g., image/png, application/pdf).
- Single (partial match, case-insensitive): `?mimeType=`
- Multiple: `?mimeType=&mimeType=`
- Null: `?mimeType=null`
**ownerId** (`ID`): ID of the user who uploaded the file (from session).
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**userId** (`ID`): Reference to the owner user record.
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/useravatarsfiles**
```js
axios({
method: 'GET',
url: '/v1/useravatarsfiles',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// mimeType: '' // Filter by mimeType
// ownerId: '' // Filter by ownerId
// userId: '' // Filter by userId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFiles",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"userAvatarsFiles": [
{
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Delete Useravatarsfile` API
**[Default delete API]** — This is the designated default `delete` API for the `userAvatarsFile` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `deleteUserAvatarsFile` API REST controller can be triggered via the following route:
`/v1/useravatarsfiles/:userAvatarsFileId`
**Rest Request Parameters**
The `deleteUserAvatarsFile` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userAvatarsFileId | ID | true | request.params?.["userAvatarsFileId"] |
**userAvatarsFileId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/useravatarsfiles/:userAvatarsFileId**
```js
axios({
method: 'DELETE',
url: `/v1/useravatarsfiles/${userAvatarsFileId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "userAvatarsFile",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"userAvatarsFile": {
"id": "ID",
"fileName": "String",
"mimeType": "String",
"fileSize": "Integer",
"accessKey": "String",
"ownerId": "ID",
"fileData": "Blob",
"metadata": "Object",
"userId": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
```
### Authentication Specific Routes
### Route: login
*Route Definition*: Handles the login process by verifying user credentials and generating an authenticated session.
*Route Type*: login
*Access Routes*:
- `GET /login`: Returns the HTML login page
(not a frontend module, typically used in browser-based contexts for test purpose to make sending POST /login easier).
- `POST /login`: Accepts credentials, verifies the user, creates a session, and returns a JWT access token.
#### Parameters
| Parameter | Type | Required | Population |
|-------------|----------|----------|-----------------------------|
| username | String | Yes | `request.body.username` |
| password | String | Yes | `request.body.password` |
#### Notes
- This route accepts login credentials and creates an authenticated session if credentials are valid.
- On success, the response will:
- Set a cookie named `projectname-access-token[-tenantCodename]` with the JWT token.
- Include the token in the response headers under the same name.
- Return the full `session` object in the JSON body.
- Note that `username` parameter should have the email of the user as value.
You can also send an `email` parameter instead of `username` parameter.
If both sent only `username` parameter will be read.
```js
// Sample POST /login call
axios.post("/login", {
username: "user@example.com",
password: "securePassword"
});
````
**Success Response**
Returns the authenticated session object with a status code `200 OK`.
A secure HTTP-only cookie and an access token header are included in the response.
```json
{
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
...
}
````
**Error Responses**
* **401 Unauthorized:** Invalid username or password.
* **403 Forbidden:** Login attempt rejected due to pending email/mobile verification or 2FA requirements.
* **400 Bad Request:** Missing credentials in the request.
### Route: logout
*Route Definition*: Logs the user out by terminating the current session and clearing the access token.
*Route Type*: logout
*Access Route*: `POST /logout`
#### Parameters
This route does not require any parameters in the body or query.
#### Behavior
- Invalidates the current session on the server (if stored).
- Clears the access token cookie (`projectname-access-token[-tenantCodename]`) from the client.
- Responds with a 200 status and a simple confirmation object.
```js
// Sample POST /logout call
axios.post("/logout", {}, {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Notes**
* This route is public, meaning it can be called without a session or token.
* If the session is active, the server will clear associated session state and cookies.
* The logout behavior may vary slightly depending on whether you're using cookie-based or header-based token management.
**Error Responses**
00200 OK:** Always returned, regardless of whether a session existed.
Logout is treated as idempotent.
### Route: publickey
*Route Definition*: Returns the public RSA key used to verify JWT access tokens issued by the auth service.
*Route Type*: publicKeyFetch
*Access Route*: `GET /publickey`
#### Parameters
| Parameter | Type | Required | Population |
|-----------|--------|----------|--------------------|
| keyId | String | No | `request.query.keyId` |
- `keyId` is optional.
If provided, retrieves the public key corresponding to the specific `keyId`.
If omitted, retrieves the current active public key (`global.currentKeyId`).
#### Behavior
- Reads the requested RSA public key file from the server filesystem.
- If the key exists, returns it along with its `keyId`.
- If the key does not exist, returns a 404 error.
```js
// Sample GET /publickey call
axios.get("/publickey", {
params: {
keyId: "currentKeyIdOptional"
}
});
````
**Success Response**
Returns the active public key and its associated keyId.
```json
{
"keyId": "a1b2c3d4",
"keyData": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhki...\n-----END PUBLIC KEY-----"
}
````
**Error Responses**
**404 Not Found:** Public key file could not be found on the server.
### Token Key Management
Mindbricks uses RSA key pairs to sign and verify JWT access tokens securely.
While the auth service signs each token with a private key, other services within the system — or external clients — need the corresponding **public key** to verify the authenticity and integrity of received tokens.
The `/publickey` endpoint allows services and clients to dynamically fetch the currently active public key, ensuring that token verification remains secure even if key rotation is performed.
> **Note**:
> The `/publickey` route is not intended for direct frontend (browser) consumption.
> Instead, it is primarily used by trusted backend services, APIs, or middleware systems that need to independently verify access tokens issued by the auth service — without making verification-dependent API calls to the auth service itself.
Accessing the public key is crucial for validating user sessions efficiently and maintaining a decentralized trust model across your platform.
### Route: relogin
*Route Definition*: Performs a silent login by verifying the current access token, refreshing the session, and returning a new access token along with updated user information.
*Route Type*: sessionRefresh
*Access Route*: `GET /relogin`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Validates the access token associated with the request.
- If the token is valid:
- Re-authenticates the user using the session's user ID.
- Fetches the most up-to-date user information from the database.
- Generates a new session object with a **new session ID** and **new access token**.
- If the token is invalid or missing, returns a 401 Unauthorized error.
```js
// Example call to refresh session
axios.get("/relogin", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns a new session object, refreshed from database data.
```json
{
"sessionId": "new-session-uuid",
"userId": "user-uuid",
"email": "user@example.com",
"roleId": "admin",
"accessToken": "new-jwt-token",
...
}
````
**Error Responses**
* **401 Unauthorized**: Token is missing, invalid, or session cannot be re-established.
```json
{
"status": "ERR",
"message": "Cannot relogin"
}
````
**Notes**
- The `/relogin` route is commonly used for **silent login flows**, especially after page reloads or token-based auto-login mechanisms.
- It triggers internal logic (`req.userAuthUpdate = true`) to signal that the session should be re-initialized and repopulated.
- It is not a simple session lookup — it performs a fresh authentication pass using the session's user context.
- The refreshed session ensures any updates to user profile, roles, or permissions are immediately reflected.
> **Tip:**
> This route is ideal when you want to **rebuild a user's session** in the frontend without requiring them to manually log in again.
## Verification Services — Email Verification
Email verification is a two-step flow that ensures a user's email address is verified and trusted by the system.
All verification services, including email verification, are located under the `/verification-services` base path.
### When is Email Verification Triggered?
- After user registration, if `emailVerificationRequiredForLogin` is active.
- During a separate user action to verify or update email addresses.
- When login fails with `EmailVerificationNeeded` and frontend initiates verification.
### Email Verification Flow
1. **Frontend calls `/verification-services/email-verification/start`** with the user's email address.
- Mindbricks checks if the email is already verified.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user's email or returned in the response (only in development environments for easier testing).
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/email-verification/complete`** with the `email` and the received `secretCode`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s `emailVerified` flag is set to `true`, and a success response is returned.
---
## API Endpoints
### POST `/verification-services/email-verification/start`
**Purpose**
Starts the email verification process by generating and sending a secret verification code.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|-----------------------------|
| email | String | Yes | The email address to verify |
```json
{
"email": "user@example.com"
}
````
#### Success Response
Secret code details (in development environment). Confirms that the verification step has been started.
```json
{
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
````
> ⚠️ In production, the secret code is only sent via email, not exposed in the API response.
#### Error Responses
- `400 Bad Request`: Email already verified.
- `403 Forbidden`: Sending a code too frequently (anti-spam).
---
### POST `/verification-services/email-verification/complete`
**Purpose**
Completes the email verification by validating the secret code.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|-------------------------------------|
| email | String | Yes | The user email being verified |
| secretCode | String | Yes | The secret code received via email |
```json
{
"email": "user@example.com",
"secretCode": "123456"
}
````
#### Success Response
Returns confirmation that the email has been verified.
```json
{
"userId": "user-uuid",
"email": "user@example.com",
"isVerified": true
}
````
#### Error Responses
- `403 Forbidden`:
- Secret code mismatch
- Secret code expired
- No ongoing verification found
---
## Important Behavioral Notes
### Resend Throttling
You can only request a new verification code after a cooldown period (`resendTimeWindow`, e.g., 60 seconds).
### Expiration Handling
Verification codes expire after a configured period (`expireTimeWindow`, e.g., 1 day).
### One Code Per Session
Only one active verification session per user is allowed at a time.
> 💡 Mindbricks automatically manages spam prevention, session caching, expiration, and event broadcasting (start/complete events) for all verification steps.
## Verification Services — Mobile Verification
Mobile verification is a two-step flow that ensures a user's mobile number is verified and trusted by the system.
All verification services, including mobile verification, are located under the `/verification-services` base path.
### When is Mobile Verification Triggered?
- After user registration, if `mobileVerificationRequiredForLogin` is active.
- During a separate user action to verify or update mobile numbers.
- When login fails with `MobileVerificationNeeded` and frontend initiates verification.
### Mobile Verification Flow
1. **Frontend calls `/verification-services/mobile-verification/start`** with the user's email address (used to locate the user).
- Mindbricks checks if the mobile number is already verified.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user's mobile via SMS or returned in the response (only in development environments for easier testing).
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/mobile-verification/complete`** with the `email` and the received `secretCode`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s `mobileVerified` flag is set to `true`, and a success response is returned.
---
## API Endpoints
### POST `/verification-services/mobile-verification/start`
**Purpose**:
Starts the mobile verification process by generating and sending a secret verification code.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|-------------------------------------|
| email | String | Yes | The email address associated with the mobile number to verify |
```json
{
"email": "user@example.com"
}
````
**Success Response**
Secret code details (in development environment). Confirms that the verification step has been started.
```json
{
"userId": "user-uuid",
"mobile": "+15551234567",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
````
⚠️ In production, the secret code is only sent via SMS, not exposed in the API response.
**Error Responses**
- 400 Bad Request: Mobile already verified.
- 403 Forbidden: Sending a code too frequently (anti-spam).
---
### POST `/verification-services/mobile-verification/complete`
**Purpose**:
Completes the mobile verification by validating the secret code.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|------------------------------------|
| email | String | Yes | The user's email being verified |
| secretCode | String | Yes | The secret code received via SMS |
```json
{
"email": "user@example.com",
"secretCode": "123456"
}
````
**Success Response**
Returns confirmation that the mobile number has been verified.
```json
{
"userId": "user-uuid",
"mobile": "+15551234567",
"isVerified": true
}
````
**Error Responses**
403 Forbidden:
- Secret code mismatch
- Secret code expired
- No ongoing verification found
---
## Important Behavioral Notes
**Resend Throttling**:
You can only request a new verification code after a cooldown period (`resendTimeWindow`, e.g., 60 seconds).
**Expiration Handling**:
Verification codes expire after a configured period (`expireTimeWindow`, e.g., 1 day).
**One Code Per Session**:
Only one active verification session per user is allowed at a time.
💡 Mindbricks automatically manages spam prevention, session caching, expiration, and event broadcasting (start/complete events) for all verification steps.
## Verification Services — Email 2FA Verification
Email 2FA (Two-Factor Authentication) provides an additional layer of security by requiring users to confirm their identity using a secret code sent to their email address. This process is used in login flows or sensitive actions that need extra verification.
All verification services, including 2FA, are located under the `/verification-services` base path.
### When is Email 2FA Triggered?
- During login flows where `sessionNeedsEmail2FA` is `true`
- When the backend enforces two-factor authentication for a sensitive operation
### Email 2FA Flow
1. **Frontend calls `/verification-services/email-2factor-verification/start`** with the user's id, session id, client info, and reason.
- Mindbricks identifies the user and checks if a cooldown period applies.
- A new secret code is generated and stored, linked to the current session ID.
- The code is sent via email or returned in development environments.
2. **User receives the code and enters it into the frontend application.**
3. **Frontend calls `/verification-services/email-2factor-verification/complete`** with the `userId`, `sessionId`, and the `secretCode`.
- Mindbricks verifies the code, validates the session, and updates the session to remove the 2FA requirement.
---
## API Endpoints
### POST `/verification-services/email-2factor-verification/start`
**Purpose**:
Starts the email-based 2FA process by generating and sending a verification code.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|-----------------------------------------------|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The current session ID |
| client | String | No | Optional client tag or context |
| reason | String | No | Optional reason for triggering 2FA |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"client": "login-page",
"reason": "Login requires email 2FA"
}
````
#### Success Response
```json
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 300,
"date": "2024-04-29T10:00:00.000Z"
}
````
⚠️ In production, the `secretCode` is only sent via email, not exposed in the API response.
#### Error Responses
- **403 Forbidden**: Sending a code too frequently (anti-spam)
- **401 Unauthorized**: User session not found
---
### POST `/verification-services/email-2factor-verification/complete`
**Purpose**:
Completes the email 2FA process by validating the secret code and session.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|--------------------------------------------------|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The session ID the code is tied to |
| secretCode | String | Yes | The secret code received via email |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "123456"
}
````
#### Success Response
Returns an updated session with 2FA disabled:
```json
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"sessionNeedsEmail2FA": false,
...
}
````
#### Error Responses
- **403 Forbidden**:
- Secret code mismatch
- Secret code expired
- Verification step not found
---
### Important Behavioral Notes
- **One Code Per Session**: Only one active code can be issued per session.
- **Resend Throttling**: Code requests are throttled based on `resendTimeWindow` (e.g., 60 seconds).
- **Expiration**: Codes expire after `expireTimeWindow` (e.g., 5 minutes).
- 💡 Mindbricks manages session cache, spam control, expiration tracking, and event notifications for all 2FA steps.
## Verification Services — Mobile 2FA Verification
Mobile 2FA (Two-Factor Authentication) is a security mechanism that adds an extra layer of authentication using a user's verified mobile number.
All verification services, including mobile 2FA, are accessible under the `/verification-services` base path.
### When is Mobile 2FA Triggered?
- During login or critical actions requiring step-up authentication.
- When the session has a flag `sessionNeedsMobile2FA = true`.
- When login or session verification fails with `MobileVerificationNeeded`, indicating 2FA is required.
### Mobile 2FA Verification Flow
1. **Frontend calls `/verification-services/mobile-2factor-verification/start`** with the user's id, session id, client info, and reason.
- Mindbricks finds the user by id.
- Verifies that the user has a verified mobile number.
- A secret code is generated and cached against the session.
- The code is sent to the user's verified mobile number or returned in the response (only in development environments).
2. **User receives the code and enters it in the frontend app.**
3. **Frontend calls `/verification-services/mobile-2factor-verification/complete`** with the `userId`, `sessionId`, and `secretCode`.
- Mindbricks validates the code for expiration and correctness.
- If valid, the session flag `sessionNeedsMobile2FA` is cleared.
- A refreshed session object is returned.
---
## API Endpoints
### POST `/verification-services/mobile-2factor-verification/start`
**Purpose**:
Initiates mobile-based 2FA by generating and sending a secret code.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|-----------------------------------------------|
| userId | String | Yes | The user’s ID |
| sessionId | String | Yes | The current session ID |
| client | String | No | Optional client tag or context |
| reason | String | No | Optional reason for triggering 2FA |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"client": "login-page",
"reason": "Login requires mobile 2FA"
}
````
**Success Response**
Returns the generated code (only in development), expiration info, and metadata.
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"mobile": "+15551234567",
"secretCode": "654321",
"expireTime": 300,
"date": "2024-04-29T11:00:00.000Z"
}
````
⚠️ In production environments, the secret code is not included in the response and is instead delivered via SMS.
**Error Responses**
- 403 Forbidden: Mobile number not verified.
- 403 Forbidden: Code resend attempted before cooldown period (`resendTimeWindow`).
- 401 Unauthorized: Email not recognized or session invalid.
---
### POST `/verification-services/mobile-2factor-verification/complete`
**Purpose**:
Completes mobile 2FA verification by validating the secret code and updating the session.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|-------------------------------------|
| userId | String | Yes | ID of the user |
| sessionId | String | Yes | ID of the session |
| secretCode | String | Yes | The 6-digit code received via SMS |
```json
{
"userId": "user-uuid",
"sessionId": "session-uuid",
"secretCode": "654321"
}
````
**Success Response**
Returns the updated session with `sessionNeedsMobile2FA: false`.
```json
{
"sessionId": "session-uuid",
"userId": "user-uuid",
"sessionNeedsMobile2FA": false,
"accessToken": "jwt-token",
"expiresIn": 86400
}
````
**Error Responses**
- 403 Forbidden: Code mismatch or expired.
- 403 Forbidden: No ongoing verification found.
- 401 Unauthorized: Session does not exist or is invalid.
---
### Behavioral Notes
- **Rate Limiting**: A user can only request a new mobile 2FA code after the cooldown period (`resendTimeWindow`, e.g., 60 seconds).
- **Expiration**: Mobile 2FA codes expire after the configured time (`expireTimeWindow`, e.g., 5 minutes).
- **Session Integrity**: Verification status is tied to the session; incorrect sessionId will invalidate the attempt.
💡 Mindbricks handles session integrity, rate limiting, and secure code delivery to ensure a robust mobile 2FA process.
## Verification Services — Password Reset by Email
Password Reset by Email enables a user to securely reset their password using a secret code sent to their registered email address.
All verification services, including password reset by email, are located under the `/verification-services` base path.
### When is Password Reset by Email Triggered?
- When a user requests to reset their password by providing their email address.
- This service is typically exposed on a “Forgot Password?” flow in the frontend.
### Password Reset Flow
1. **Frontend calls `/verification-services/password-reset-by-email/start`** with the user's email.
- Mindbricks checks if the user exists and if the email is registered.
- A secret code is generated and stored in the cache linked to the user.
- The code is sent to the user's email, or returned in the response (in development environments only for testing).
2. **User receives the code and enters it into the frontend along with the new password.**
3. **Frontend calls `/verification-services/password-reset-by-email/complete`** with the `email`, the `secretCode`, and the new `password`.
- Mindbricks checks that the code is valid, not expired, and matches.
- If valid, the user’s password is reset, their `emailVerified` flag is set to `true`, and a success response is returned.
---
## API Endpoints
### POST `/verification-services/password-reset-by-email/start`
**Purpose**:
Starts the password reset process by generating and sending a secret verification code.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|-------------------------------------|
| email | String | Yes | The email address of the user |
```json
{
"email": "user@example.com"
}
````
**Success Response**
Returns secret code details (only in development environment) and confirmation that the verification step has been started.
```json
{
"userId": "user-uuid",
"email": "user@example.com",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
````
⚠️ In production, the secret code is only sent via email and not exposed in the API response.
**Error Responses**
- `401 NotAuthenticated`: Email address not found or not associated with a user.
- `403 Forbidden`: Sending a code too frequently (spam prevention).
---
### POST `/verification-services/password-reset-by-email/complete`
**Purpose**:
Completes the password reset process by validating the secret code and updating the user's password.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|----------------------------------------------|
| email | String | Yes | The email address of the user |
| secretCode | String | Yes | The code received via email |
| password | String | Yes | The new password the user wants to set |
```json
{
"email": "user@example.com",
"secretCode": "123456",
"password": "newSecurePassword123"
}
````
**Success Response**
```json
{
"userId": "user-uuid",
"email": "user@example.com",
"isVerified": true
}
````
**Error Responses**
- `403 Forbidden`:
- Secret code mismatch
- Secret code expired
- No ongoing verification found
---
## Important Behavioral Notes
### Resend Throttling:
A new verification code can only be requested after a cooldown period (configured via `resendTimeWindow`, e.g., 60 seconds).
### Expiration Handling:
Verification codes automatically expire after a predefined period (`expireTimeWindow`, e.g., 1 day).
### Session & Event Handling:
Mindbricks manages:
- Spam prevention
- Code caching per user
- Expiration logic
- Verification start/complete events
## Verification Services — Password Reset by Mobile
Password reset by mobile provides users with a secure mechanism to reset their password using a verification code sent via SMS to their registered mobile number.
All verification services, including password reset by mobile, are located under the `/verification-services` base path.
### When is Password Reset by Mobile Triggered?
- When a user forgets their password and selects the mobile reset option.
- When a user explicitly initiates password recovery via mobile on the login or help screen.
### Password Reset by Mobile Flow
1. **Frontend calls `/verification-services/password-reset-by-mobile/start`** with the user's mobile number or associated identifier.
- Mindbricks checks if a user with the given mobile exists.
- A secret code is generated and stored in the cache for that user.
- The code is sent to the user's mobile (or returned in development environments for testing).
2. **User receives the code via SMS and enters it into the frontend app.**
3. **Frontend calls `/verification-services/password-reset-by-mobile/complete`** with the user's `email`, the `secretCode`, and the new `password`.
- Mindbricks validates the secret code and its expiration.
- If valid, it updates the user's password and returns a success response.
---
## API Endpoints
### POST `/verification-services/password-reset-by-mobile/start`
**Purpose**:
Initiates the mobile-based password reset by sending a verification code to the user's mobile.
#### Request Body
| Parameter | Type | Required | Description |
|-----------|--------|----------|------------------------------|
| mobile | String | Yes | The mobile number to verify |
```json
{
"mobile": "+905551234567"
}
````
### Success Response
Returns the verification context (code returned only in development):
```json
{
"userId": "user-uuid",
"mobile": "+905551234567",
"secretCode": "123456",
"expireTime": 86400,
"date": "2024-04-29T10:00:00.000Z"
}
````
⚠️ In production, the `secretCode` is not included in the response and is only sent via SMS.
### Error Responses
- **400 Bad Request**: Mobile already verified
- **403 Forbidden**: Rate-limited (code already sent recently)
- **404 Not Found**: User with provided mobile not found
---
### POST `/verification-services/password-reset-by-mobile/complete`
**Purpose**:
Finalizes the password reset process by validating the received verification code and updating the user’s password.
#### Request Body
| Parameter | Type | Required | Description |
|-------------|--------|----------|-------------------------------------------------|
| email | String | Yes | The email address of the user |
| secretCode | String | Yes | The code received via SMS |
| password | String | Yes | The new password to assign |
```json
{
"email": "user@example.com",
"secretCode": "123456",
"password": "NewSecurePassword123!"
}
````
### Success Response
```json
{
"userId": "user-uuid",
"mobile": "+905551234567",
"isVerified": true
}
````
---
### Important Behavioral Notes
- **Throttling**: Codes can only be resent after a delay defined by `resendTimeWindow` (e.g., 60 seconds).
- **Expiration**: Codes expire after the `expireTimeWindow` (e.g., 1 day).
- **One Active Session**: Only one active password reset session is allowed per user at a time.
- **Session-less**: This flow does not require an active session — it works for unauthenticated users.
💡 Mindbricks handles spam protection, session caching, and event-based logging (for both start and complete operations) as part of the verification service base class.
## Verification Method Types
### 🧾 For byCode Verifications
This verification type requires the user to manually enter a 6-digit code.
**Frontend Action**:
Display a secure input page where the user can enter the code they received via email or SMS. After collecting the code and any required metadata (such as `userId` or `sessionId`), make a `POST` request to the corresponding `/complete` endpoint.
---
### 🔗 For byLink Verifications
This verification type uses a clickable link embedded in an email (or SMS message).
**Frontend Action**:
The link points to a `GET` page in your frontend that parses `userId` and `code` from the query string and sends them to the backend via a `POST` request to the corresponding `/complete` endpoint. This enables one-click verification without requiring the user to type in a code.
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-messaging-service
**Version:** `1.0.5`
Enables secure in-app messaging between guests and hosts. Handles threads, messages (with text/media/system types), abuse flagging, and admin moderation for resolution..
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the Messaging Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our Messaging Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the Messaging Service via HTTP requests for purposes such as creating, updating, deleting and querying Messaging objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the Messaging Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the Messaging service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the Messaging service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the Messaging service.
This service is configured to listen for HTTP requests on port `3003`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/messaging-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/messaging-api`
* **Production:** `https://airbnb3.mindbricks.co/messaging-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the Messaging service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `Messaging` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `Messaging` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `Messaging` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
Messaging service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### MessageThread resource
*Resource Definition* : Thread/conversation between guest and host, optionally linked to a listing/reservation. Tracks participants, context, state, and stats.
*MessageThread Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **messageCount** | Integer | | | ** |
| **isOpen** | Boolean | | | ** |
| **guestId** | ID | | | ** |
| **lastMessageAt** | Date | | | ** |
| **listingId** | ID | | | ** |
| **hostId** | ID | | | ** |
| **reservationId** | ID | | | ** |
### MessageReport resource
*Resource Definition* : Report/in-app abuse complaint filed for a message by a user. Tracks status, admin handling, and resolution notes. Only visible to involved parties and admins.
*MessageReport Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **reportedBy** | ID | | | ** |
| **reportReason** | String | | | ** |
| **moderationStatus** | Enum | | | ** |
| **messageId** | ID | | | ** |
| **adminId** | ID | | | ** |
| **reportedAt** | Date | | | ** |
| **resolutionNotes** | Text | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### moderationStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **reviewed** | `"reviewed""` | 1 |
| **closed** | `"closed""` | 2 |
### Message resource
*Resource Definition* : Single message within a thread (text/media/system). Includes metadata for flagging/moderation. Linked to sender, thread, and content type.
*Message Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **threadId** | ID | | | ** |
| **content** | Text | | | ** |
| **senderId** | ID | | | ** |
| **sentAt** | Date | | | ** |
| **messageType** | Enum | | | ** |
| **mediaUrl** | String | | | ** |
| **isModerated** | Boolean | | | ** |
| **isFlagged** | Boolean | | | ** |
| **flaggedBy** | ID | | | ** |
| **flagReason** | String | | | ** |
| **isRead** | Boolean | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### messageType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **text** | `"text""` | 0 |
| **media** | `"media""` | 1 |
| **system** | `"system""` | 2 |
## Business Api
### `Delete Message` API
Soft-delete (hide) a message. Sender or admin only. Message remains for logs/audit, only hidden for sender/recipient.
**Rest Route**
The `deleteMessage` API REST controller can be triggered via the following route:
`/v1/messages/:messageId`
**Rest Request Parameters**
The `deleteMessage` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageId | ID | true | request.params?.["messageId"] |
**messageId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/messages/:messageId**
```js
axios({
method: 'DELETE',
url: `/v1/messages/${messageId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Messagethread` API
Create a new message thread between a guest and host (optionally for specific listing/reservation). Users must be sender or recipient. Prevent duplicate open threads on same context with composite index.
**Rest Route**
The `createMessageThread` API REST controller can be triggered via the following route:
`/v1/messagethreads`
**Rest Request Parameters**
The `createMessageThread` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageCount | Integer | true | request.body?.["messageCount"] |
| isOpen | Boolean | true | request.body?.["isOpen"] |
| guestId | ID | true | request.body?.["guestId"] |
| lastMessageAt | Date | true | request.body?.["lastMessageAt"] |
| listingId | ID | false | request.body?.["listingId"] |
| hostId | ID | true | request.body?.["hostId"] |
| reservationId | ID | false | request.body?.["reservationId"] |
**messageCount** :
**isOpen** :
**guestId** :
**lastMessageAt** :
**listingId** :
**hostId** :
**reservationId** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/messagethreads**
```js
axios({
method: 'POST',
url: '/v1/messagethreads',
data: {
messageCount:"Integer",
isOpen:"Boolean",
guestId:"ID",
lastMessageAt:"Date",
listingId:"ID",
hostId:"ID",
reservationId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Message` API
Allows sender or admin to edit a message (rare; only content/flag fields allowed). Use-case: correct typo, retract flag. Not for full message overwrite.
**Rest Route**
The `updateMessage` API REST controller can be triggered via the following route:
`/v1/messages/:messageId`
**Rest Request Parameters**
The `updateMessage` api has got 8 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageId | ID | true | request.params?.["messageId"] |
| content | Text | false | request.body?.["content"] |
| mediaUrl | String | false | request.body?.["mediaUrl"] |
| isModerated | Boolean | false | request.body?.["isModerated"] |
| isFlagged | Boolean | false | request.body?.["isFlagged"] |
| flaggedBy | ID | false | request.body?.["flaggedBy"] |
| flagReason | String | false | request.body?.["flagReason"] |
| isRead | Boolean | false | request.body?.["isRead"] |
**messageId** : This id paremeter is used to select the required data object that will be updated
**content** :
**mediaUrl** :
**isModerated** :
**isFlagged** :
**flaggedBy** :
**flagReason** :
**isRead** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/messages/:messageId**
```js
axios({
method: 'PATCH',
url: `/v1/messages/${messageId}`,
data: {
content:"Text",
mediaUrl:"String",
isModerated:"Boolean",
isFlagged:"Boolean",
flaggedBy:"ID",
flagReason:"String",
isRead:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Messagethread` API
Update thread state (e.g. isOpen=false to close), only guest, host, or admin can update.
**Rest Route**
The `updateMessageThread` API REST controller can be triggered via the following route:
`/v1/messagethreads/:messageThreadId`
**Rest Request Parameters**
The `updateMessageThread` api has got 6 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageThreadId | ID | true | request.params?.["messageThreadId"] |
| messageCount | Integer | false | request.body?.["messageCount"] |
| isOpen | Boolean | false | request.body?.["isOpen"] |
| lastMessageAt | Date | false | request.body?.["lastMessageAt"] |
| listingId | ID | false | request.body?.["listingId"] |
| reservationId | ID | false | request.body?.["reservationId"] |
**messageThreadId** : This id paremeter is used to select the required data object that will be updated
**messageCount** :
**isOpen** :
**lastMessageAt** :
**listingId** :
**reservationId** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/messagethreads/:messageThreadId**
```js
axios({
method: 'PATCH',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
messageCount:"Integer",
isOpen:"Boolean",
lastMessageAt:"Date",
listingId:"ID",
reservationId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Messagethread` API
Soft-delete (archive/close) a thread. Only allowed for guest/host or admin; marks isActive=false.
**Rest Route**
The `deleteMessageThread` API REST controller can be triggered via the following route:
`/v1/messagethreads/:messageThreadId`
**Rest Request Parameters**
The `deleteMessageThread` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageThreadId | ID | true | request.params?.["messageThreadId"] |
**messageThreadId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/messagethreads/:messageThreadId**
```js
axios({
method: 'DELETE',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Message` API
Create/send a message to a thread (guest/host only, must be participant). Sets sentAt, and updates thread.lastMessageAt/messageCount atomically.
**Rest Route**
The `createMessage` API REST controller can be triggered via the following route:
`/v1/messages`
**Rest Request Parameters**
The `createMessage` api has got 10 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| threadId | ID | true | request.body?.["threadId"] |
| content | Text | true | request.body?.["content"] |
| senderId | ID | true | request.body?.["senderId"] |
| sentAt | Date | true | request.body?.["sentAt"] |
| messageType | Enum | true | request.body?.["messageType"] |
| mediaUrl | String | false | request.body?.["mediaUrl"] |
| isModerated | Boolean | true | request.body?.["isModerated"] |
| isFlagged | Boolean | true | request.body?.["isFlagged"] |
| flaggedBy | ID | false | request.body?.["flaggedBy"] |
| flagReason | String | false | request.body?.["flagReason"] |
**threadId** :
**content** :
**senderId** :
**sentAt** :
**messageType** :
**mediaUrl** :
**isModerated** :
**isFlagged** :
**flaggedBy** :
**flagReason** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/messages**
```js
axios({
method: 'POST',
url: '/v1/messages',
data: {
threadId:"ID",
content:"Text",
senderId:"ID",
sentAt:"Date",
messageType:"Enum",
mediaUrl:"String",
isModerated:"Boolean",
isFlagged:"Boolean",
flaggedBy:"ID",
flagReason:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Messagethread` API
Get a message thread with participant/context enrichment. Only guest, host, or admin may view.
**Rest Route**
The `getMessageThread` API REST controller can be triggered via the following route:
`/v1/messagethreads/:messageThreadId`
**Rest Request Parameters**
The `getMessageThread` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageThreadId | ID | true | request.params?.["messageThreadId"] |
**messageThreadId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/messagethreads/:messageThreadId**
```js
axios({
method: 'GET',
url: `/v1/messagethreads/${messageThreadId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThread",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"messageThread": {
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Message` API
Get a message (guest/host must be in thread, or admin). Enrich with sender info.
**Rest Route**
The `getMessage` API REST controller can be triggered via the following route:
`/v1/messages/:messageId`
**Rest Request Parameters**
The `getMessage` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageId | ID | true | request.params?.["messageId"] |
**messageId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/messages/:messageId**
```js
axios({
method: 'GET',
url: `/v1/messages/${messageId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "message",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"message": {
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Messagethreads` API
List threads for user; only show where session user is guest or host, or admin role.
**Rest Route**
The `listMessageThreads` API REST controller can be triggered via the following route:
`/v1/messagethreads`
**Rest Request Parameters**
The `listMessageThreads` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/messagethreads**
```js
axios({
method: 'GET',
url: '/v1/messagethreads',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageThreads",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messageThreads": [
{
"id": "ID",
"messageCount": "Integer",
"isOpen": "Boolean",
"guestId": "ID",
"lastMessageAt": "Date",
"listingId": "ID",
"hostId": "ID",
"reservationId": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"listingDets": [
{
"title": "String",
"address": "String",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object"
},
{},
{}
],
"rezDets": [
{
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"checkOut": "Date",
"checkIn": "Date"
},
{},
{}
]
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Threadmessages` API
List messages in a thread (participants only, or admin). Sorted by sentAt ASC. Includes sender info for display.
**Rest Route**
The `getThreadMessages` API REST controller can be triggered via the following route:
`/v1/threadmessages/:threadId`
**Rest Request Parameters**
The `getThreadMessages` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| threadId | ID | true | request.params?.["threadId"] |
**threadId** :
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/threadmessages/:threadId**
```js
axios({
method: 'GET',
url: `/v1/threadmessages/${threadId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messages": [
{
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": [],
"thread": {
"listingId": "ID"
},
"listing": {},
"amenities": {}
}
```
### `Gotthread Messages` API
**Rest Route**
The `gotthreadMessages` API REST controller can be triggered via the following route:
`/v1/gotthreadmessages/:threadId`
**Rest Request Parameters**
The `gotthreadMessages` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| threadId | ID | true | request.params?.["threadId"] |
**threadId** : undefined. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/gotthreadmessages/:threadId**
```js
axios({
method: 'GET',
url: `/v1/gotthreadmessages/${threadId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messages",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messages": [
{
"id": "ID",
"threadId": "ID",
"content": "Text",
"senderId": "ID",
"sentAt": "Date",
"messageType": "Enum",
"messageType_idx": "Integer",
"mediaUrl": "String",
"isModerated": "Boolean",
"isFlagged": "Boolean",
"flaggedBy": "ID",
"flagReason": "String",
"isRead": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Messagereports` API
List message reports. Reporter, admin, or (involved) sender may see. Admin sees all, others see those they filed or are involved in. Intended for moderation/admin panel and user reporting history.
**Rest Route**
The `listMessageReports` API REST controller can be triggered via the following route:
`/v1/messagereports`
**Rest Request Parameters**
The `listMessageReports` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/messagereports**
```js
axios({
method: 'GET',
url: '/v1/messagereports',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReports",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"messageReports": [
{
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Messagereport` API
User files report on a message for abuse/moderation. Links to message & reporter. Sets status=pending, visible to reporter, admin, and message sender (for defense/appeal).
**Rest Route**
The `createMessageReport` API REST controller can be triggered via the following route:
`/v1/messagereports`
**Rest Request Parameters**
The `createMessageReport` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reportedBy | ID | true | request.body?.["reportedBy"] |
| reportReason | String | true | request.body?.["reportReason"] |
| moderationStatus | Enum | true | request.body?.["moderationStatus"] |
| messageId | ID | true | request.body?.["messageId"] |
| adminId | ID | false | request.body?.["adminId"] |
| reportedAt | Date | true | request.body?.["reportedAt"] |
| resolutionNotes | Text | false | request.body?.["resolutionNotes"] |
**reportedBy** :
**reportReason** :
**moderationStatus** :
**messageId** :
**adminId** :
**reportedAt** :
**resolutionNotes** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/messagereports**
```js
axios({
method: 'POST',
url: '/v1/messagereports',
data: {
reportedBy:"ID",
reportReason:"String",
moderationStatus:"Enum",
messageId:"ID",
adminId:"ID",
reportedAt:"Date",
resolutionNotes:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Messagereport` API
Admin moderator updates report: assign adminId, update status, add resolution notes. Only admin role allowed.
**Rest Route**
The `updateMessageReport` API REST controller can be triggered via the following route:
`/v1/messagereports/:messageReportId`
**Rest Request Parameters**
The `updateMessageReport` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageReportId | ID | true | request.params?.["messageReportId"] |
| moderationStatus | Enum | false | request.body?.["moderationStatus"] |
| adminId | ID | false | request.body?.["adminId"] |
| resolutionNotes | Text | false | request.body?.["resolutionNotes"] |
**messageReportId** : This id paremeter is used to select the required data object that will be updated
**moderationStatus** :
**adminId** :
**resolutionNotes** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/messagereports/:messageReportId**
```js
axios({
method: 'PATCH',
url: `/v1/messagereports/${messageReportId}`,
data: {
moderationStatus:"Enum",
adminId:"ID",
resolutionNotes:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Messagereport` API
Get a message report. Reporter, admin, or message sender may view report. Includes message, admin, and involved user info via selectJoins for moderation view.
**Rest Route**
The `getMessageReport` API REST controller can be triggered via the following route:
`/v1/messagereports/:messageReportId`
**Rest Request Parameters**
The `getMessageReport` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| messageReportId | ID | true | request.params?.["messageReportId"] |
**messageReportId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/messagereports/:messageReportId**
```js
axios({
method: 'GET',
url: `/v1/messagereports/${messageReportId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "messageReport",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"messageReport": {
"id": "ID",
"reportedBy": "ID",
"reportReason": "String",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"messageId": "ID",
"adminId": "ID",
"reportedAt": "Date",
"resolutionNotes": "Text",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### Authentication Specific Routes
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-propertycatalog-service
**Version:** `1.0.5`
Service for management of property listings, calendars, amenities, and localization for a short-term rental marketplace. Hosts can manage listings, availability, multi-language descriptions, policies, pricing, and attributes, served for global search and discovery...
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the PropertyCatalog Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our PropertyCatalog Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the PropertyCatalog Service via HTTP requests for purposes such as creating, updating, deleting and querying PropertyCatalog objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the PropertyCatalog Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the PropertyCatalog service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the PropertyCatalog service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the PropertyCatalog service.
This service is configured to listen for HTTP requests on port `3001`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/propertycatalog-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/propertycatalog-api`
* **Production:** `https://airbnb3.mindbricks.co/propertycatalog-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the PropertyCatalog service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `PropertyCatalog` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `PropertyCatalog` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `PropertyCatalog` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
PropertyCatalog service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### ListingCalendar resource
*Resource Definition* : Represents daily availability, pricing, and reservation state for a listing (i.e., a property calendar entry).
*ListingCalendar Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **priceOverride** | Double | | | ** |
| **date** | Date | | | ** |
| **minStay** | Integer | | | ** |
| **listingId** | ID | | | ** |
| **bookedBy** | ID | | | ** |
| **iCalUrl** | String | | | ** |
| **externalCalendarIds** | String | | | ** |
| **isAvailable** | Boolean | | | ** |
### ListingAmenity resource
*Resource Definition* : Dictionary of possible amenities (wifi, pool, etc.) for hosts to reference in their listings.
*ListingAmenity Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **iconUrl** | String | | | ** |
| **name** | String | | | ** |
### Listing resource
*Resource Definition* : Represents a property or space offered for short-term rental by a host. Includes host ref, core attributes, pricing, location, seasonal pricing, media, and booking/policy properties...
*Listing Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **title** | String | | | ** |
| **amenityIds** | ID | | | ** |
| **hostId** | ID | | | ** |
| **mainPhoto** | String | | | ** |
| **photos** | String | | | ** |
| **address** | String | | | ** |
| **pricePerNight** | Double | | | ** |
| **description** | Text | | | ** |
| **propertyType** | Enum | | | ** |
| **location** | Object | | | ** |
| **maxStay** | Integer | | | ** |
| **minStay** | Integer | | | ** |
| **currency** | String | | | ** |
| **seasonalPricing** | Object | | | ** |
| **approvalType** | Enum | | | ** |
| **bookingPolicies** | Object | | | ** |
| **cancellationPolicy** | Object | | | ** |
| **languagesSupported** | String | | | ** |
| **houseRules** | Text | | | ** |
| **isPublished** | Boolean | | | ** |
| **cityTaxPercent** | Double | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### propertyType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **apartment** | `"apartment""` | 0 |
| **house** | `"house""` | 1 |
| **villa** | `"villa""` | 2 |
| **room** | `"room""` | 3 |
| **condo** | `"condo""` | 4 |
| **loft** | `"loft""` | 5 |
| **studio** | `"studio""` | 6 |
| **other** | `"other""` | 7 |
##### approvalType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **instant** | `"instant""` | 0 |
| **manual** | `"manual""` | 1 |
### ListingLocaleText resource
*Resource Definition* : Localized title & description texts for a property listing, per language.
*ListingLocaleText Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **localizedDescription** | Text | | | ** |
| **localizedTitle** | String | | | ** |
| **listingId** | ID | | | ** |
| **languageCode** | String | | | ** |
## Business Api
### `Update Listing` API
Update an existing listing owned by the host or admin.
**Rest Route**
The `updateListing` API REST controller can be triggered via the following route:
`/v1/listings/:listingId`
**Rest Request Parameters**
The `updateListing` api has got 21 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingId | ID | true | request.params?.["listingId"] |
| title | String | false | request.body?.["title"] |
| amenityIds | ID | false | request.body?.["amenityIds"] |
| mainPhoto | String | false | request.body?.["mainPhoto"] |
| photos | String | false | request.body?.["photos"] |
| address | String | false | request.body?.["address"] |
| pricePerNight | Double | false | request.body?.["pricePerNight"] |
| description | Text | false | request.body?.["description"] |
| propertyType | Enum | false | request.body?.["propertyType"] |
| location | Object | false | request.body?.["location"] |
| maxStay | Integer | false | request.body?.["maxStay"] |
| minStay | Integer | false | request.body?.["minStay"] |
| currency | String | false | request.body?.["currency"] |
| seasonalPricing | Object | false | request.body?.["seasonalPricing"] |
| approvalType | Enum | false | request.body?.["approvalType"] |
| bookingPolicies | Object | false | request.body?.["bookingPolicies"] |
| cancellationPolicy | Object | false | request.body?.["cancellationPolicy"] |
| languagesSupported | String | false | request.body?.["languagesSupported"] |
| houseRules | Text | false | request.body?.["houseRules"] |
| isPublished | Boolean | false | request.body?.["isPublished"] |
| cityTaxPercent | Double | false | request.body?.["cityTaxPercent"] |
**listingId** : This id paremeter is used to select the required data object that will be updated
**title** :
**amenityIds** :
**mainPhoto** :
**photos** :
**address** :
**pricePerNight** :
**description** :
**propertyType** :
**location** :
**maxStay** :
**minStay** :
**currency** :
**seasonalPricing** :
**approvalType** :
**bookingPolicies** :
**cancellationPolicy** :
**languagesSupported** :
**houseRules** :
**isPublished** :
**cityTaxPercent** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/listings/:listingId**
```js
axios({
method: 'PATCH',
url: `/v1/listings/${listingId}`,
data: {
title:"String",
amenityIds:"ID",
mainPhoto:"String",
photos:"String",
address:"String",
pricePerNight:"Double",
description:"Text",
propertyType:"Enum",
location:"Object",
maxStay:"Integer",
minStay:"Integer",
currency:"String",
seasonalPricing:"Object",
approvalType:"Enum",
bookingPolicies:"Object",
cancellationPolicy:"Object",
languagesSupported:"String",
houseRules:"Text",
isPublished:"Boolean",
cityTaxPercent:"Double",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listing",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"listing": {
"id": "ID",
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"pricePerNight": "Double",
"description": "Text",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object",
"maxStay": "Integer",
"minStay": "Integer",
"currency": "String",
"seasonalPricing": "Object",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingPolicies": "Object",
"cancellationPolicy": "Object",
"languagesSupported": "String",
"houseRules": "Text",
"isPublished": "Boolean",
"cityTaxPercent": "Double",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Listing` API
Create a new rental property listing. Host must be the owner (session user).
**Rest Route**
The `createListing` API REST controller can be triggered via the following route:
`/v1/listings`
**Rest Request Parameters**
The `createListing` api has got 20 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| title | String | true | request.body?.["title"] |
| amenityIds | ID | false | request.body?.["amenityIds"] |
| mainPhoto | String | false | request.body?.["mainPhoto"] |
| photos | String | false | request.body?.["photos"] |
| address | String | true | request.body?.["address"] |
| pricePerNight | Double | true | request.body?.["pricePerNight"] |
| description | Text | true | request.body?.["description"] |
| propertyType | Enum | true | request.body?.["propertyType"] |
| location | Object | true | request.body?.["location"] |
| maxStay | Integer | false | request.body?.["maxStay"] |
| minStay | Integer | false | request.body?.["minStay"] |
| currency | String | true | request.body?.["currency"] |
| seasonalPricing | Object | false | request.body?.["seasonalPricing"] |
| approvalType | Enum | true | request.body?.["approvalType"] |
| bookingPolicies | Object | false | request.body?.["bookingPolicies"] |
| cancellationPolicy | Object | false | request.body?.["cancellationPolicy"] |
| languagesSupported | String | false | request.body?.["languagesSupported"] |
| houseRules | Text | false | request.body?.["houseRules"] |
| isPublished | Boolean | true | request.body?.["isPublished"] |
| cityTaxPercent | Double | false | request.body?.["cityTaxPercent"] |
**title** :
**amenityIds** :
**mainPhoto** :
**photos** :
**address** :
**pricePerNight** :
**description** :
**propertyType** :
**location** :
**maxStay** :
**minStay** :
**currency** :
**seasonalPricing** :
**approvalType** :
**bookingPolicies** :
**cancellationPolicy** :
**languagesSupported** :
**houseRules** :
**isPublished** :
**cityTaxPercent** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/listings**
```js
axios({
method: 'POST',
url: '/v1/listings',
data: {
title:"String",
amenityIds:"ID",
mainPhoto:"String",
photos:"String",
address:"String",
pricePerNight:"Double",
description:"Text",
propertyType:"Enum",
location:"Object",
maxStay:"Integer",
minStay:"Integer",
currency:"String",
seasonalPricing:"Object",
approvalType:"Enum",
bookingPolicies:"Object",
cancellationPolicy:"Object",
languagesSupported:"String",
houseRules:"Text",
isPublished:"Boolean",
cityTaxPercent:"Double",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listing",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"listing": {
"id": "ID",
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"pricePerNight": "Double",
"description": "Text",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object",
"maxStay": "Integer",
"minStay": "Integer",
"currency": "String",
"seasonalPricing": "Object",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingPolicies": "Object",
"cancellationPolicy": "Object",
"languagesSupported": "String",
"houseRules": "Text",
"isPublished": "Boolean",
"cityTaxPercent": "Double",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Listing` API
Delete (soft-delete) a property listing. Host must be owner or admin.
**Rest Route**
The `deleteListing` API REST controller can be triggered via the following route:
`/v1/listings/:listingId`
**Rest Request Parameters**
The `deleteListing` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingId | ID | true | request.params?.["listingId"] |
**listingId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/listings/:listingId**
```js
axios({
method: 'DELETE',
url: `/v1/listings/${listingId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listing",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"listing": {
"id": "ID",
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"pricePerNight": "Double",
"description": "Text",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object",
"maxStay": "Integer",
"minStay": "Integer",
"currency": "String",
"seasonalPricing": "Object",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingPolicies": "Object",
"cancellationPolicy": "Object",
"languagesSupported": "String",
"houseRules": "Text",
"isPublished": "Boolean",
"cityTaxPercent": "Double",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Listings` API
List all property listings (optionally filtered). Includes amenities and locales as joins for display search cards.
**Rest Route**
The `listListings` API REST controller can be triggered via the following route:
`/v1/listings`
**Rest Request Parameters**
**Filter Parameters**
The `listListings` api supports 7 optional filter parameters for filtering list results:
**title** (`String`): Filter by title
- Single (partial match, case-insensitive): `?title=`
- Multiple: `?title=&title=`
- Null: `?title=null`
**hostId** (`ID`): Filter by hostId
- Single: `?hostId=`
- Multiple: `?hostId=&hostId=`
- Null: `?hostId=null`
**address** (`String`): Filter by address
- Single (partial match, case-insensitive): `?address=`
- Multiple: `?address=&address=`
- Null: `?address=null`
**pricePerNight** (`Double`): Filter by pricePerNight
- Single: `?pricePerNight=`
- Multiple: `?pricePerNight=&pricePerNight=`
- Range: `?pricePerNight=$lt-`, `$lte-`, `$gt-`, `$gte-`, `$btw--`
- Null: `?pricePerNight=null`
**propertyType** (`Enum`): Filter by propertyType
- Single: `?propertyType=` (case-insensitive)
- Multiple: `?propertyType=&propertyType=`
- Null: `?propertyType=null`
**currency** (`String`): Filter by currency
- Single (partial match, case-insensitive): `?currency=`
- Multiple: `?currency=¤cy=`
- Null: `?currency=null`
**isPublished** (`Boolean`): Filter by isPublished
- True: `?isPublished=true`
- False: `?isPublished=false`
- Null: `?isPublished=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listings**
```js
axios({
method: 'GET',
url: '/v1/listings',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// title: '' // Filter by title
// hostId: '' // Filter by hostId
// address: '' // Filter by address
// pricePerNight: '' // Filter by pricePerNight
// propertyType: '' // Filter by propertyType
// currency: '' // Filter by currency
// isPublished: '' // Filter by isPublished
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listings",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"listings": [
{
"id": "ID",
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"pricePerNight": "Double",
"description": "Text",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object",
"maxStay": "Integer",
"minStay": "Integer",
"currency": "String",
"seasonalPricing": "Object",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingPolicies": "Object",
"cancellationPolicy": "Object",
"languagesSupported": "String",
"houseRules": "Text",
"isPublished": "Boolean",
"cityTaxPercent": "Double",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"reviews": {
"rating": "Integer",
"revieweeId": "ID"
},
"amenities": {
"iconUrl": "String",
"name": "String"
}
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Listingcalendar` API
Update a calendar entry (availablity, pricing, reservation) for a listing date.
**Rest Route**
The `updateListingCalendar` API REST controller can be triggered via the following route:
`/v1/listingcalendars/:listingCalendarId`
**Rest Request Parameters**
The `updateListingCalendar` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingCalendarId | ID | true | request.params?.["listingCalendarId"] |
| priceOverride | Double | false | request.body?.["priceOverride"] |
| minStay | Integer | false | request.body?.["minStay"] |
| bookedBy | ID | false | request.body?.["bookedBy"] |
| iCalUrl | String | false | request.body?.["iCalUrl"] |
| externalCalendarIds | String | false | request.body?.["externalCalendarIds"] |
| isAvailable | Boolean | false | request.body?.["isAvailable"] |
**listingCalendarId** : This id paremeter is used to select the required data object that will be updated
**priceOverride** :
**minStay** :
**bookedBy** :
**iCalUrl** :
**externalCalendarIds** :
**isAvailable** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/listingcalendars/:listingCalendarId**
```js
axios({
method: 'PATCH',
url: `/v1/listingcalendars/${listingCalendarId}`,
data: {
priceOverride:"Double",
minStay:"Integer",
bookedBy:"ID",
iCalUrl:"String",
externalCalendarIds:"String",
isAvailable:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingCalendar",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"listingCalendar": {
"id": "ID",
"priceOverride": "Double",
"date": "Date",
"minStay": "Integer",
"listingId": "ID",
"bookedBy": "ID",
"iCalUrl": "String",
"externalCalendarIds": "String",
"isAvailable": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Listingcalendar` API
Add a calendar entry for a listing/date—controls availability or booking info for that day.
**Rest Route**
The `createListingCalendar` API REST controller can be triggered via the following route:
`/v1/listingcalendars`
**Rest Request Parameters**
The `createListingCalendar` api has got 8 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| priceOverride | Double | false | request.body?.["priceOverride"] |
| date | Date | true | request.body?.["date"] |
| minStay | Integer | false | request.body?.["minStay"] |
| listingId | ID | true | request.body?.["listingId"] |
| bookedBy | ID | false | request.body?.["bookedBy"] |
| iCalUrl | String | false | request.body?.["iCalUrl"] |
| externalCalendarIds | String | false | request.body?.["externalCalendarIds"] |
| isAvailable | Boolean | true | request.body?.["isAvailable"] |
**priceOverride** :
**date** :
**minStay** :
**listingId** :
**bookedBy** :
**iCalUrl** :
**externalCalendarIds** :
**isAvailable** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/listingcalendars**
```js
axios({
method: 'POST',
url: '/v1/listingcalendars',
data: {
priceOverride:"Double",
date:"Date",
minStay:"Integer",
listingId:"ID",
bookedBy:"ID",
iCalUrl:"String",
externalCalendarIds:"String",
isAvailable:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingCalendar",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"listingCalendar": {
"id": "ID",
"priceOverride": "Double",
"date": "Date",
"minStay": "Integer",
"listingId": "ID",
"bookedBy": "ID",
"iCalUrl": "String",
"externalCalendarIds": "String",
"isAvailable": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Listingcalendar` API
Delete (soft-delete) a listing calendar entry (by host/admin).
**Rest Route**
The `deleteListingCalendar` API REST controller can be triggered via the following route:
`/v1/listingcalendars/:listingCalendarId`
**Rest Request Parameters**
The `deleteListingCalendar` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingCalendarId | ID | true | request.params?.["listingCalendarId"] |
**listingCalendarId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/listingcalendars/:listingCalendarId**
```js
axios({
method: 'DELETE',
url: `/v1/listingcalendars/${listingCalendarId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingCalendar",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"listingCalendar": {
"id": "ID",
"priceOverride": "Double",
"date": "Date",
"minStay": "Integer",
"listingId": "ID",
"bookedBy": "ID",
"iCalUrl": "String",
"externalCalendarIds": "String",
"isAvailable": "Boolean",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Listingcalendar` API
Get a calendar date entry for a listing.
**Rest Route**
The `getListingCalendar` API REST controller can be triggered via the following route:
`/v1/listingcalendars/:listingCalendarId`
**Rest Request Parameters**
The `getListingCalendar` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingCalendarId | ID | true | request.params?.["listingCalendarId"] |
**listingCalendarId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listingcalendars/:listingCalendarId**
```js
axios({
method: 'GET',
url: `/v1/listingcalendars/${listingCalendarId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingCalendar",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"listingCalendar": {
"id": "ID",
"priceOverride": "Double",
"date": "Date",
"minStay": "Integer",
"listingId": "ID",
"bookedBy": "ID",
"iCalUrl": "String",
"externalCalendarIds": "String",
"isAvailable": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Listingcalendars` API
List calendar entries for one or more listings/dates. Used for display and availability search.
**Rest Route**
The `listListingCalendars` API REST controller can be triggered via the following route:
`/v1/listingcalendars`
**Rest Request Parameters**
**Filter Parameters**
The `listListingCalendars` api supports 2 optional filter parameters for filtering list results:
**date** (`Date`): Filter by date
- Single date: `?date=2024-01-15`
- Multiple dates: `?date=2024-01-15&date=2024-01-20`
- Special: `$today`, `$ltoday`, `$week`, `$lweek`, `$month`, `$leq-`, `$lin-`
- Null: `?date=null`
**listingId** (`ID`): Filter by listingId
- Single: `?listingId=`
- Multiple: `?listingId=&listingId=`
- Null: `?listingId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listingcalendars**
```js
axios({
method: 'GET',
url: '/v1/listingcalendars',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// date: '' // Filter by date
// listingId: '' // Filter by listingId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingCalendars",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"listingCalendars": [
{
"id": "ID",
"priceOverride": "Double",
"date": "Date",
"minStay": "Integer",
"listingId": "ID",
"bookedBy": "ID",
"iCalUrl": "String",
"externalCalendarIds": "String",
"isAvailable": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Listing` API
Get a property listing, including enriched amenities and available locales.
**Rest Route**
The `getListing` API REST controller can be triggered via the following route:
`/v1/listings/:listingId`
**Rest Request Parameters**
The `getListing` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingId | ID | true | request.params?.["listingId"] |
**listingId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listings/:listingId**
```js
axios({
method: 'GET',
url: `/v1/listings/${listingId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listing",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"listing": {
"id": "ID",
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"pricePerNight": "Double",
"description": "Text",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object",
"maxStay": "Integer",
"minStay": "Integer",
"currency": "String",
"seasonalPricing": "Object",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingPolicies": "Object",
"cancellationPolicy": "Object",
"languagesSupported": "String",
"houseRules": "Text",
"isPublished": "Boolean",
"cityTaxPercent": "Double",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"amenities": {
"iconUrl": "String",
"name": "String"
},
"reviews": {
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"createdAt": "Date",
"updatedAt": "Date"
},
"rezervations": [
{
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"guestId": "ID"
},
{},
{}
]
}
}
```
### `Create Listinglocaletext` API
Add a localized title & description for a listing/language pair.
**Rest Route**
The `createListingLocaleText` API REST controller can be triggered via the following route:
`/v1/listinglocaletexts`
**Rest Request Parameters**
The `createListingLocaleText` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| localizedDescription | Text | true | request.body?.["localizedDescription"] |
| localizedTitle | String | true | request.body?.["localizedTitle"] |
| listingId | ID | true | request.body?.["listingId"] |
| languageCode | String | true | request.body?.["languageCode"] |
**localizedDescription** :
**localizedTitle** :
**listingId** :
**languageCode** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/listinglocaletexts**
```js
axios({
method: 'POST',
url: '/v1/listinglocaletexts',
data: {
localizedDescription:"Text",
localizedTitle:"String",
listingId:"ID",
languageCode:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingLocaleText",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"listingLocaleText": {
"id": "ID",
"localizedDescription": "Text",
"localizedTitle": "String",
"listingId": "ID",
"languageCode": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Listingamenities` API
List all amenity options (public for guests/hosts creating listings).
**Rest Route**
The `listListingAmenities` API REST controller can be triggered via the following route:
`/v1/listingamenities`
**Rest Request Parameters**
**Filter Parameters**
The `listListingAmenities` api supports 1 optional filter parameter for filtering list results:
**name** (`String`): Filter by name
- Single (partial match, case-insensitive): `?name=`
- Multiple: `?name=&name=`
- Null: `?name=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listingamenities**
```js
axios({
method: 'GET',
url: '/v1/listingamenities',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// name: '' // Filter by name
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingAmenities",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"listingAmenities": [
{
"id": "ID",
"iconUrl": "String",
"name": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Delete Listinglocaletext` API
Delete (soft-delete) a locale text entry for a listing/language.
**Rest Route**
The `deleteListingLocaleText` API REST controller can be triggered via the following route:
`/v1/listinglocaletexts/:listingLocaleTextId`
**Rest Request Parameters**
The `deleteListingLocaleText` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingLocaleTextId | ID | true | request.params?.["listingLocaleTextId"] |
**listingLocaleTextId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/listinglocaletexts/:listingLocaleTextId**
```js
axios({
method: 'DELETE',
url: `/v1/listinglocaletexts/${listingLocaleTextId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingLocaleText",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"listingLocaleText": {
"id": "ID",
"localizedDescription": "Text",
"localizedTitle": "String",
"listingId": "ID",
"languageCode": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Listinglocaletexts` API
List all localized texts for a given listing (multi-language support).
**Rest Route**
The `listListingLocaleTexts` API REST controller can be triggered via the following route:
`/v1/listinglocaletexts`
**Rest Request Parameters**
**Filter Parameters**
The `listListingLocaleTexts` api supports 2 optional filter parameters for filtering list results:
**listingId** (`ID`): Filter by listingId
- Single: `?listingId=`
- Multiple: `?listingId=&listingId=`
- Null: `?listingId=null`
**languageCode** (`String`): Filter by languageCode
- Single (partial match, case-insensitive): `?languageCode=`
- Multiple: `?languageCode=&languageCode=`
- Null: `?languageCode=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listinglocaletexts**
```js
axios({
method: 'GET',
url: '/v1/listinglocaletexts',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// listingId: '' // Filter by listingId
// languageCode: '' // Filter by languageCode
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingLocaleTexts",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"listingLocaleTexts": [
{
"id": "ID",
"localizedDescription": "Text",
"localizedTitle": "String",
"listingId": "ID",
"languageCode": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Listinglocaletext` API
Update a localized title/description for a listing/language.
**Rest Route**
The `updateListingLocaleText` API REST controller can be triggered via the following route:
`/v1/listinglocaletexts/:listingLocaleTextId`
**Rest Request Parameters**
The `updateListingLocaleText` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingLocaleTextId | ID | true | request.params?.["listingLocaleTextId"] |
| localizedDescription | Text | false | request.body?.["localizedDescription"] |
| localizedTitle | String | false | request.body?.["localizedTitle"] |
**listingLocaleTextId** : This id paremeter is used to select the required data object that will be updated
**localizedDescription** :
**localizedTitle** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/listinglocaletexts/:listingLocaleTextId**
```js
axios({
method: 'PATCH',
url: `/v1/listinglocaletexts/${listingLocaleTextId}`,
data: {
localizedDescription:"Text",
localizedTitle:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingLocaleText",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"listingLocaleText": {
"id": "ID",
"localizedDescription": "Text",
"localizedTitle": "String",
"listingId": "ID",
"languageCode": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Listingamenity` API
Update an amenity (admin only).
**Rest Route**
The `updateListingAmenity` API REST controller can be triggered via the following route:
`/v1/listingamenities/:listingAmenityId`
**Rest Request Parameters**
The `updateListingAmenity` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingAmenityId | ID | true | request.params?.["listingAmenityId"] |
| iconUrl | String | false | request.body?.["iconUrl"] |
**listingAmenityId** : This id paremeter is used to select the required data object that will be updated
**iconUrl** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/listingamenities/:listingAmenityId**
```js
axios({
method: 'PATCH',
url: `/v1/listingamenities/${listingAmenityId}`,
data: {
iconUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingAmenity",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"listingAmenity": {
"id": "ID",
"iconUrl": "String",
"name": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Listingamenity` API
Get information for a listed amenity (public).
**Rest Route**
The `getListingAmenity` API REST controller can be triggered via the following route:
`/v1/listingamenities/:listingAmenityId`
**Rest Request Parameters**
The `getListingAmenity` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingAmenityId | ID | true | request.params?.["listingAmenityId"] |
**listingAmenityId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listingamenities/:listingAmenityId**
```js
axios({
method: 'GET',
url: `/v1/listingamenities/${listingAmenityId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingAmenity",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"listingAmenity": {
"id": "ID",
"iconUrl": "String",
"name": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Listinglocaletext` API
Get localized listing title/description (by listing/language).
**Rest Route**
The `getListingLocaleText` API REST controller can be triggered via the following route:
`/v1/listinglocaletexts/:listingLocaleTextId`
**Rest Request Parameters**
The `getListingLocaleText` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingLocaleTextId | ID | true | request.params?.["listingLocaleTextId"] |
**listingLocaleTextId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/listinglocaletexts/:listingLocaleTextId**
```js
axios({
method: 'GET',
url: `/v1/listinglocaletexts/${listingLocaleTextId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingLocaleText",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"listingLocaleText": {
"id": "ID",
"localizedDescription": "Text",
"localizedTitle": "String",
"listingId": "ID",
"languageCode": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Listingamenity` API
Add a new amenity to the master amenity list.
**Rest Route**
The `createListingAmenity` API REST controller can be triggered via the following route:
`/v1/listingamenities`
**Rest Request Parameters**
The `createListingAmenity` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| iconUrl | String | false | request.body?.["iconUrl"] |
| name | String | true | request.body?.["name"] |
**iconUrl** :
**name** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/listingamenities**
```js
axios({
method: 'POST',
url: '/v1/listingamenities',
data: {
iconUrl:"String",
name:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingAmenity",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"listingAmenity": {
"id": "ID",
"iconUrl": "String",
"name": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Listingamenity` API
Delete (soft-delete) an amenity (admin only).
**Rest Route**
The `deleteListingAmenity` API REST controller can be triggered via the following route:
`/v1/listingamenities/:listingAmenityId`
**Rest Request Parameters**
The `deleteListingAmenity` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingAmenityId | ID | true | request.params?.["listingAmenityId"] |
**listingAmenityId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/listingamenities/:listingAmenityId**
```js
axios({
method: 'DELETE',
url: `/v1/listingamenities/${listingAmenityId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "listingAmenity",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"listingAmenity": {
"id": "ID",
"iconUrl": "String",
"name": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### Authentication Specific Routes
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-bookingmanagement-service
**Version:** `1.0.5`
Orchestrates booking, payment, calendar, changewsand dispute flows for Airbnb-style short-term rental marketplace...test Handles reservations, approval, Stripe payments, iCal sync, payment records, and the dispute/refund lifecycle with host/guest/admin visibility.
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the BookingManagement Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our BookingManagement Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the BookingManagement Service via HTTP requests for purposes such as creating, updating, deleting and querying BookingManagement objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the BookingManagement Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the BookingManagement service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the BookingManagement service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the BookingManagement service.
This service is configured to listen for HTTP requests on port `3001`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/bookingmanagement-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/bookingmanagement-api`
* **Production:** `https://airbnb3.mindbricks.co/bookingmanagement-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the BookingManagement service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `BookingManagement` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `BookingManagement` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `BookingManagement` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
BookingManagement service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### Reservation resource
*Resource Definition* : Represents a guest's booking for a property listing, including dates, participants, approval/payment/dispute status, and iCal sync info...
*Reservation Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **listingId** | ID | | | ** |
| **approvalType** | Enum | | | ** |
| **bookingStatus** | Enum | | | ** |
| **hostId** | ID | | | ** |
| **checkOut** | Date | | | ** |
| **guestId** | ID | | | ** |
| **checkIn** | Date | | | ** |
| **currency** | String | | | ** |
| **guestCount** | Integer | | | ** |
| **totalPrice** | Double | | | ** |
| **iCalExportUrl** | String | | | ** |
| **disputeStatus** | Enum | | | ** |
| **bookingPoliciesSnapshot** | Object | | | ** |
| **iCalImportSource** | String | | | ** |
| **cancellationPolicySnapshot** | Object | | | ** |
| **paymentConfirmation** | Enum | | | *An automatic property that is used to check the confirmed status of the payment set by webhooks.* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### approvalType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **instant** | `"instant""` | 0 |
| **manual** | `"manual""` | 1 |
##### bookingStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **confirmed** | `"confirmed""` | 1 |
| **complete** | `"complete""` | 2 |
| **cancelled** | `"cancelled""` | 3 |
| **declined** | `"declined""` | 4 |
##### disputeStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **none** | `"none""` | 0 |
| **requested** | `"requested""` | 1 |
| **active** | `"active""` | 2 |
| **resolved** | `"resolved""` | 3 |
##### paymentConfirmation Enum Property
*Property Definition* : An automatic property that is used to check the confirmed status of the payment set by webhooks.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **processing** | `"processing""` | 1 |
| **paid** | `"paid""` | 2 |
| **canceled** | `"canceled""` | 3 |
### PaymentRecord resource
*Resource Definition* : Stores payment and payout records (Stripe-driven) linked to a reservation (guest booking), including platform fees, taxes, host payouts, and status updates. Immutable after creation, never hard deleted.
*PaymentRecord Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **reservationId** | ID | | | ** |
| **stripeChargeId** | String | | | ** |
| **payoutAmountHost** | Double | | | ** |
| **paymentIntentId** | String | | | ** |
| **currency** | String | | | ** |
| **cityTax** | Double | | | ** |
| **refundAmount** | Double | | | ** |
| **amountPaid** | Double | | | ** |
| **paymentStatus** | Enum | | | ** |
| **platformFee** | Double | | | ** |
| **paymentDate** | Date | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### paymentStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **paid** | `"paid""` | 1 |
| **refunded** | `"refunded""` | 2 |
| **failed** | `"failed""` | 3 |
### Dispute resource
*Resource Definition* : Represents a dispute, refund request, or booking issue reported by guest/host/admin for a reservation. Flows to admin for handling, resolves with resolutionStatus and reference to any refund/payment involved.
*Dispute Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **reportedAt** | Date | | | ** |
| **reservationId** | ID | | | ** |
| **raisedBy** | ID | | | ** |
| **adminId** | ID | | | ** |
| **issueType** | String | | | ** |
| **description** | Text | | | ** |
| **relatedPaymentId** | ID | | | ** |
| **resolutionStatus** | Enum | | | ** |
| **resolvedAt** | Date | | | ** |
| **refundApproved** | Boolean | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### resolutionStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **reviewing** | `"reviewing""` | 1 |
| **resolved** | `"resolved""` | 2 |
| **rejected** | `"rejected""` | 3 |
### Sys_reservationPayment resource
*Resource Definition* : A payment storage object to store the payment life cyle of orders based on reservation object. It is autocreated based on the source object's checkout config
*Sys_reservationPayment Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **ownerId** | ID | | | * An ID value to represent owner user who created the order* |
| **orderId** | ID | | | *an ID value to represent the orderId which is the ID parameter of the source reservation object* |
| **paymentId** | String | | | *A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type* |
| **paymentStatus** | String | | | *A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.* |
| **statusLiteral** | String | | | *A string value to represent the logical payment status which belongs to the application lifecycle itself.* |
| **redirectUrl** | String | | | *A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.* |
### Sys_paymentCustomer resource
*Resource Definition* : A payment storage object to store the customer values of the payment platform
*Sys_paymentCustomer Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **userId** | ID | | | * An ID value to represent the user who is created as a stripe customer* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway* |
| **platform** | String | | | *A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
### Sys_paymentMethod resource
*Resource Definition* : A payment storage object to store the payment methods of the platform customers
*Sys_paymentMethod Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **paymentMethodId** | String | | | *A string value to represent the id of the payment method on the payment platform.* |
| **userId** | ID | | | * An ID value to represent the user who owns the payment method* |
| **customerId** | String | | | *A string value to represent the customer id which is generated on the payment gateway.* |
| **cardHolderName** | String | | | *A string value to represent the name of the card holder. It can be different than the registered customer.* |
| **cardHolderZip** | String | | | *A string value to represent the zip code of the card holder. It is used for address verification in specific countries.* |
| **platform** | String | | | *A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.* |
| **cardInfo** | Object | | | *A Json value to store the card details of the payment method.* |
## Business Api
### `Update Dispute` API
Updates dispute fields like status, admin assignment, resolution notes. Only admin or assigned party can update (enforced by membership/role checks).
**Rest Route**
The `updateDispute` API REST controller can be triggered via the following route:
`/v1/disputes/:disputeId`
**Rest Request Parameters**
The `updateDispute` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| disputeId | ID | true | request.params?.["disputeId"] |
| adminId | ID | false | request.body?.["adminId"] |
| issueType | String | false | request.body?.["issueType"] |
| description | Text | false | request.body?.["description"] |
| resolutionStatus | Enum | false | request.body?.["resolutionStatus"] |
| resolvedAt | Date | false | request.body?.["resolvedAt"] |
| refundApproved | Boolean | false | request.body?.["refundApproved"] |
**disputeId** : This id paremeter is used to select the required data object that will be updated
**adminId** :
**issueType** :
**description** :
**resolutionStatus** :
**resolvedAt** :
**refundApproved** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/disputes/:disputeId**
```js
axios({
method: 'PATCH',
url: `/v1/disputes/${disputeId}`,
data: {
adminId:"ID",
issueType:"String",
description:"Text",
resolutionStatus:"Enum",
resolvedAt:"Date",
refundApproved:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "dispute",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"dispute": {
"id": "ID",
"reportedAt": "Date",
"reservationId": "ID",
"raisedBy": "ID",
"adminId": "ID",
"issueType": "String",
"description": "Text",
"relatedPaymentId": "ID",
"resolutionStatus": "Enum",
"resolutionStatus_idx": "Integer",
"resolvedAt": "Date",
"refundApproved": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Paymentrecord` API
Get a payment record by ID (owner or admin only). No selectJoin for privacy. Returned for auditing or user view.
**Rest Route**
The `getPaymentRecord` API REST controller can be triggered via the following route:
`/v1/paymentrecords/:paymentRecordId`
**Rest Request Parameters**
The `getPaymentRecord` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentRecordId | ID | true | request.params?.["paymentRecordId"] |
**paymentRecordId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentrecords/:paymentRecordId**
```js
axios({
method: 'GET',
url: `/v1/paymentrecords/${paymentRecordId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "paymentRecord",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"paymentRecord": {
"id": "ID",
"reservationId": "ID",
"stripeChargeId": "String",
"payoutAmountHost": "Double",
"paymentIntentId": "String",
"currency": "String",
"cityTax": "Double",
"refundAmount": "Double",
"amountPaid": "Double",
"paymentStatus": "Enum",
"paymentStatus_idx": "Integer",
"platformFee": "Double",
"paymentDate": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Reservation` API
Fetch a single reservation (for guest, host, or admin). Auto-includes related listing and payments via selectJoin.
**Rest Route**
The `getReservation` API REST controller can be triggered via the following route:
`/v1/reservations/:reservationId`
**Rest Request Parameters**
The `getReservation` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.params?.["reservationId"] |
**reservationId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservations/:reservationId**
```js
axios({
method: 'GET',
url: `/v1/reservations/${reservationId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Dispute` API
Guest/host opens a formal dispute related to a reservation. Admin is only assigned after initial review. Can only be created by guest/host of reservation (enforced in logic).
**Rest Route**
The `createDispute` API REST controller can be triggered via the following route:
`/v1/disputes`
**Rest Request Parameters**
The `createDispute` api has got 10 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reportedAt | Date | true | request.body?.["reportedAt"] |
| reservationId | ID | true | request.body?.["reservationId"] |
| raisedBy | ID | true | request.body?.["raisedBy"] |
| adminId | ID | false | request.body?.["adminId"] |
| issueType | String | true | request.body?.["issueType"] |
| description | Text | true | request.body?.["description"] |
| relatedPaymentId | ID | false | request.body?.["relatedPaymentId"] |
| resolutionStatus | Enum | true | request.body?.["resolutionStatus"] |
| resolvedAt | Date | false | request.body?.["resolvedAt"] |
| refundApproved | Boolean | false | request.body?.["refundApproved"] |
**reportedAt** :
**reservationId** :
**raisedBy** :
**adminId** :
**issueType** :
**description** :
**relatedPaymentId** :
**resolutionStatus** :
**resolvedAt** :
**refundApproved** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/disputes**
```js
axios({
method: 'POST',
url: '/v1/disputes',
data: {
reportedAt:"Date",
reservationId:"ID",
raisedBy:"ID",
adminId:"ID",
issueType:"String",
description:"Text",
relatedPaymentId:"ID",
resolutionStatus:"Enum",
resolvedAt:"Date",
refundApproved:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "dispute",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"dispute": {
"id": "ID",
"reportedAt": "Date",
"reservationId": "ID",
"raisedBy": "ID",
"adminId": "ID",
"issueType": "String",
"description": "Text",
"relatedPaymentId": "ID",
"resolutionStatus": "Enum",
"resolutionStatus_idx": "Integer",
"resolvedAt": "Date",
"refundApproved": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Reservations` API
List reservations (bookings) for guest, host, or admin. Includes selectJoin for listing/guest/host info. Filterable by guestId, hostId, status, etc.
**Rest Route**
The `listReservations` API REST controller can be triggered via the following route:
`/v1/reservations`
**Rest Request Parameters**
**Filter Parameters**
The `listReservations` api supports 7 optional filter parameters for filtering list results:
**listingId** (`ID`): Filter by listingId
- Single: `?listingId=`
- Multiple: `?listingId=&listingId=`
- Null: `?listingId=null`
**approvalType** (`Enum`): Filter by approvalType
- Single: `?approvalType=` (case-insensitive)
- Multiple: `?approvalType=&approvalType=`
- Null: `?approvalType=null`
**bookingStatus** (`Enum`): Filter by bookingStatus
- Single: `?bookingStatus=` (case-insensitive)
- Multiple: `?bookingStatus=&bookingStatus=`
- Null: `?bookingStatus=null`
**hostId** (`ID`): Filter by hostId
- Single: `?hostId=`
- Multiple: `?hostId=&hostId=`
- Null: `?hostId=null`
**guestId** (`ID`): Filter by guestId
- Single: `?guestId=`
- Multiple: `?guestId=&guestId=`
- Null: `?guestId=null`
**checkIn** (`Date`): Filter by checkIn
- Single date: `?checkIn=2024-01-15`
- Multiple dates: `?checkIn=2024-01-15&checkIn=2024-01-20`
- Special: `$today`, `$ltoday`, `$week`, `$lweek`, `$month`, `$leq-`, `$lin-`
- Null: `?checkIn=null`
**paymentConfirmation** (`Enum`): An automatic property that is used to check the confirmed status of the payment set by webhooks.
- Single: `?paymentConfirmation=` (case-insensitive)
- Multiple: `?paymentConfirmation=&paymentConfirmation=`
- Null: `?paymentConfirmation=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservations**
```js
axios({
method: 'GET',
url: '/v1/reservations',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// listingId: '' // Filter by listingId
// approvalType: '' // Filter by approvalType
// bookingStatus: '' // Filter by bookingStatus
// hostId: '' // Filter by hostId
// guestId: '' // Filter by guestId
// checkIn: '' // Filter by checkIn
// paymentConfirmation: '' // Filter by paymentConfirmation
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservations",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"reservations": [
{
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"listingJoins": [
{
"title": "String",
"amenityIds": "ID",
"hostId": "ID",
"mainPhoto": "String",
"photos": "String",
"address": "String",
"propertyType": "Enum",
"propertyType_idx": "Integer",
"location": "Object"
},
{},
{}
],
"hostDetails": [
{
"email": "String",
"fullname": "String",
"avatar": "String"
},
{},
{}
]
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Reservation` API
Guest initiates a reservation for a listing (instant or manual). Handles calendar check, approvalType, payment intent, and booking policies. Triggers Stripe checkout. Only allowed if dates are available and not conflicting. Guest is current user.
**Rest Route**
The `createReservation` API REST controller can be triggered via the following route:
`/v1/reservations`
**Rest Request Parameters**
The `createReservation` api has got 14 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| listingId | ID | true | request.body?.["listingId"] |
| approvalType | Enum | true | request.body?.["approvalType"] |
| bookingStatus | Enum | true | request.body?.["bookingStatus"] |
| hostId | ID | true | request.body?.["hostId"] |
| checkOut | Date | true | request.body?.["checkOut"] |
| checkIn | Date | true | request.body?.["checkIn"] |
| currency | String | true | request.body?.["currency"] |
| guestCount | Integer | true | request.body?.["guestCount"] |
| totalPrice | Double | true | request.body?.["totalPrice"] |
| iCalExportUrl | String | false | request.body?.["iCalExportUrl"] |
| disputeStatus | Enum | true | request.body?.["disputeStatus"] |
| bookingPoliciesSnapshot | Object | true | request.body?.["bookingPoliciesSnapshot"] |
| iCalImportSource | String | false | request.body?.["iCalImportSource"] |
| cancellationPolicySnapshot | Object | true | request.body?.["cancellationPolicySnapshot"] |
**listingId** :
**approvalType** :
**bookingStatus** :
**hostId** :
**checkOut** :
**checkIn** :
**currency** :
**guestCount** :
**totalPrice** :
**iCalExportUrl** :
**disputeStatus** :
**bookingPoliciesSnapshot** :
**iCalImportSource** :
**cancellationPolicySnapshot** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/reservations**
```js
axios({
method: 'POST',
url: '/v1/reservations',
data: {
listingId:"ID",
approvalType:"Enum",
bookingStatus:"Enum",
hostId:"ID",
checkOut:"Date",
checkIn:"Date",
currency:"String",
guestCount:"Integer",
totalPrice:"Double",
iCalExportUrl:"String",
disputeStatus:"Enum",
bookingPoliciesSnapshot:"Object",
iCalImportSource:"String",
cancellationPolicySnapshot:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Create Paymentrecord` API
Creates or logs payment record for a reservation (from payment success or admin/manual trigger). Populates from Stripe events/webhooks. Only creates; no update/delete (for compliance/audit).
**Rest Route**
The `createPaymentRecord` API REST controller can be triggered via the following route:
`/v1/paymentrecords`
**Rest Request Parameters**
The `createPaymentRecord` api has got 11 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.body?.["reservationId"] |
| stripeChargeId | String | false | request.body?.["stripeChargeId"] |
| payoutAmountHost | Double | false | request.body?.["payoutAmountHost"] |
| paymentIntentId | String | true | request.body?.["paymentIntentId"] |
| currency | String | true | request.body?.["currency"] |
| cityTax | Double | false | request.body?.["cityTax"] |
| refundAmount | Double | false | request.body?.["refundAmount"] |
| amountPaid | Double | true | request.body?.["amountPaid"] |
| paymentStatus | Enum | true | request.body?.["paymentStatus"] |
| platformFee | Double | false | request.body?.["platformFee"] |
| paymentDate | Date | false | request.body?.["paymentDate"] |
**reservationId** :
**stripeChargeId** :
**payoutAmountHost** :
**paymentIntentId** :
**currency** :
**cityTax** :
**refundAmount** :
**amountPaid** :
**paymentStatus** :
**platformFee** :
**paymentDate** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/paymentrecords**
```js
axios({
method: 'POST',
url: '/v1/paymentrecords',
data: {
reservationId:"ID",
stripeChargeId:"String",
payoutAmountHost:"Double",
paymentIntentId:"String",
currency:"String",
cityTax:"Double",
refundAmount:"Double",
amountPaid:"Double",
paymentStatus:"Enum",
platformFee:"Double",
paymentDate:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "paymentRecord",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"paymentRecord": {
"id": "ID",
"reservationId": "ID",
"stripeChargeId": "String",
"payoutAmountHost": "Double",
"paymentIntentId": "String",
"currency": "String",
"cityTax": "Double",
"refundAmount": "Double",
"amountPaid": "Double",
"paymentStatus": "Enum",
"paymentStatus_idx": "Integer",
"platformFee": "Double",
"paymentDate": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Paymentrecords` API
List payment records (reservation/guest/host or admin, includes filters if needed). Used for financial histories/exports. No selectJoin, for privacy and performance.
**Rest Route**
The `listPaymentRecords` API REST controller can be triggered via the following route:
`/v1/paymentrecords`
**Rest Request Parameters**
The `listPaymentRecords` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentrecords**
```js
axios({
method: 'GET',
url: '/v1/paymentrecords',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "paymentRecords",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"paymentRecords": [
{
"id": "ID",
"reservationId": "ID",
"stripeChargeId": "String",
"payoutAmountHost": "Double",
"paymentIntentId": "String",
"currency": "String",
"cityTax": "Double",
"refundAmount": "Double",
"amountPaid": "Double",
"paymentStatus": "Enum",
"paymentStatus_idx": "Integer",
"platformFee": "Double",
"paymentDate": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Delete Reservation` API
Cancels or removes a reservation (soft-delete). Guest, host or admin may delete (ownership enforced). Used for cancellations before stay begins or admin moderation.
**Rest Route**
The `deleteReservation` API REST controller can be triggered via the following route:
`/v1/reservations/:reservationId`
**Rest Request Parameters**
The `deleteReservation` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.params?.["reservationId"] |
**reservationId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/reservations/:reservationId**
```js
axios({
method: 'DELETE',
url: `/v1/reservations/${reservationId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Reservation` API
Update an existing reservation (allowed fields: only those which do not affect core identity/relations—e.g., guestCount if update allowed, NOT dates/listingId). Used for confirming cancellation, updating status by host/guest, or marking as completed. Permission: must be guest, host, or admin.
**Rest Route**
The `updateReservation` API REST controller can be triggered via the following route:
`/v1/reservations/:reservationId`
**Rest Request Parameters**
The `updateReservation` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.params?.["reservationId"] |
| bookingStatus | Enum | false | request.body?.["bookingStatus"] |
| iCalExportUrl | String | false | request.body?.["iCalExportUrl"] |
| disputeStatus | Enum | false | request.body?.["disputeStatus"] |
| iCalImportSource | String | false | request.body?.["iCalImportSource"] |
**reservationId** : This id paremeter is used to select the required data object that will be updated
**bookingStatus** :
**iCalExportUrl** :
**disputeStatus** :
**iCalImportSource** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/reservations/:reservationId**
```js
axios({
method: 'PATCH',
url: `/v1/reservations/${reservationId}`,
data: {
bookingStatus:"Enum",
iCalExportUrl:"String",
disputeStatus:"Enum",
iCalImportSource:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Disputes` API
List disputes visible to the user (as guest, host, or admin). Used for admin screening and user support view. No joins for privacy. Filterable by reservationId, raisedBy, status, etc.
**Rest Route**
The `listDisputes` API REST controller can be triggered via the following route:
`/v1/disputes`
**Rest Request Parameters**
The `listDisputes` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/disputes**
```js
axios({
method: 'GET',
url: '/v1/disputes',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "disputes",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"disputes": [
{
"id": "ID",
"reportedAt": "Date",
"reservationId": "ID",
"raisedBy": "ID",
"adminId": "ID",
"issueType": "String",
"description": "Text",
"relatedPaymentId": "ID",
"resolutionStatus": "Enum",
"resolutionStatus_idx": "Integer",
"resolvedAt": "Date",
"refundApproved": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Dispute` API
Fetch a dispute by ID (guest, host, assigned admin, or admin role). No joins for privacy. Used for support/moderation flows.
**Rest Route**
The `getDispute` API REST controller can be triggered via the following route:
`/v1/disputes/:disputeId`
**Rest Request Parameters**
The `getDispute` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| disputeId | ID | true | request.params?.["disputeId"] |
**disputeId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/disputes/:disputeId**
```js
axios({
method: 'GET',
url: `/v1/disputes/${disputeId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "dispute",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"dispute": {
"id": "ID",
"reportedAt": "Date",
"reservationId": "ID",
"raisedBy": "ID",
"adminId": "ID",
"issueType": "String",
"description": "Text",
"relatedPaymentId": "ID",
"resolutionStatus": "Enum",
"resolutionStatus_idx": "Integer",
"resolvedAt": "Date",
"refundApproved": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Reservationpayment` API
This route is used to get the payment information by ID.
**Rest Route**
The `getReservationPayment` API REST controller can be triggered via the following route:
`/v1/reservationpayment/:sys_reservationPaymentId`
**Rest Request Parameters**
The `getReservationPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_reservationPaymentId | ID | true | request.params?.["sys_reservationPaymentId"] |
**sys_reservationPaymentId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservationpayment/:sys_reservationPaymentId**
```js
axios({
method: 'GET',
url: `/v1/reservationpayment/${sys_reservationPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Reservationpayments` API
This route is used to list all payments.
**Rest Route**
The `listReservationPayments` API REST controller can be triggered via the following route:
`/v1/reservationpayments`
**Rest Request Parameters**
**Filter Parameters**
The `listReservationPayments` api supports 6 optional filter parameters for filtering list results:
**ownerId** (`ID`): An ID value to represent owner user who created the order
- Single: `?ownerId=`
- Multiple: `?ownerId=&ownerId=`
- Null: `?ownerId=null`
**orderId** (`ID`): an ID value to represent the orderId which is the ID parameter of the source reservation object
- Single: `?orderId=`
- Multiple: `?orderId=&orderId=`
- Null: `?orderId=null`
**paymentId** (`String`): A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
- Single (partial match, case-insensitive): `?paymentId=`
- Multiple: `?paymentId=&paymentId=`
- Null: `?paymentId=null`
**paymentStatus** (`String`): A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
- Single (partial match, case-insensitive): `?paymentStatus=`
- Multiple: `?paymentStatus=&paymentStatus=`
- Null: `?paymentStatus=null`
**statusLiteral** (`String`): A string value to represent the logical payment status which belongs to the application lifecycle itself.
- Single (partial match, case-insensitive): `?statusLiteral=`
- Multiple: `?statusLiteral=&statusLiteral=`
- Null: `?statusLiteral=null`
**redirectUrl** (`String`): A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
- Single (partial match, case-insensitive): `?redirectUrl=`
- Multiple: `?redirectUrl=&redirectUrl=`
- Null: `?redirectUrl=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservationpayments**
```js
axios({
method: 'GET',
url: '/v1/reservationpayments',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// ownerId: '' // Filter by ownerId
// orderId: '' // Filter by orderId
// paymentId: '' // Filter by paymentId
// paymentStatus: '' // Filter by paymentStatus
// statusLiteral: '' // Filter by statusLiteral
// redirectUrl: '' // Filter by redirectUrl
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayments",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_reservationPayments": [
{
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Reservationpayment` API
This route is used to create a new payment.
**Rest Route**
The `createReservationPayment` API REST controller can be triggered via the following route:
`/v1/reservationpayment`
**Rest Request Parameters**
The `createReservationPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.body?.["orderId"] |
| paymentId | String | true | request.body?.["paymentId"] |
| paymentStatus | String | true | request.body?.["paymentStatus"] |
| statusLiteral | String | true | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source reservation object
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/reservationpayment**
```js
axios({
method: 'POST',
url: '/v1/reservationpayment',
data: {
orderId:"ID",
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Reservationpayment` API
This route is used to update an existing payment.
**Rest Route**
The `updateReservationPayment` API REST controller can be triggered via the following route:
`/v1/reservationpayment/:sys_reservationPaymentId`
**Rest Request Parameters**
The `updateReservationPayment` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_reservationPaymentId | ID | true | request.params?.["sys_reservationPaymentId"] |
| paymentId | String | false | request.body?.["paymentId"] |
| paymentStatus | String | false | request.body?.["paymentStatus"] |
| statusLiteral | String | false | request.body?.["statusLiteral"] |
| redirectUrl | String | false | request.body?.["redirectUrl"] |
**sys_reservationPaymentId** : This id paremeter is used to select the required data object that will be updated
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type
**paymentStatus** : A string value to represent the payment status which belongs to the lifecyle of a Stripe payment.
**statusLiteral** : A string value to represent the logical payment status which belongs to the application lifecycle itself.
**redirectUrl** : A string value to represent return page of the frontend to show the result of the payment, this is used when the callback is made to server not the client.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/reservationpayment/:sys_reservationPaymentId**
```js
axios({
method: 'PATCH',
url: `/v1/reservationpayment/${sys_reservationPaymentId}`,
data: {
paymentId:"String",
paymentStatus:"String",
statusLiteral:"String",
redirectUrl:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Reservationpayment` API
This route is used to delete a payment.
**Rest Route**
The `deleteReservationPayment` API REST controller can be triggered via the following route:
`/v1/reservationpayment/:sys_reservationPaymentId`
**Rest Request Parameters**
The `deleteReservationPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_reservationPaymentId | ID | true | request.params?.["sys_reservationPaymentId"] |
**sys_reservationPaymentId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/reservationpayment/:sys_reservationPaymentId**
```js
axios({
method: 'DELETE',
url: `/v1/reservationpayment/${sys_reservationPaymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Reservationpaymentbyorderid` API
This route is used to get the payment information by order id.
**Rest Route**
The `getReservationPaymentByOrderId` API REST controller can be triggered via the following route:
`/v1/reservationpaymentbyorderid/:orderId`
**Rest Request Parameters**
The `getReservationPaymentByOrderId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| orderId | ID | true | request.params?.["orderId"] |
**orderId** : an ID value to represent the orderId which is the ID parameter of the source reservation object. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservationpaymentbyorderid/:orderId**
```js
axios({
method: 'GET',
url: `/v1/reservationpaymentbyorderid/${orderId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Reservationpaymentbypaymentid` API
This route is used to get the payment information by payment id.
**Rest Route**
The `getReservationPaymentByPaymentId` API REST controller can be triggered via the following route:
`/v1/reservationpaymentbypaymentid/:paymentId`
**Rest Request Parameters**
The `getReservationPaymentByPaymentId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| paymentId | String | true | request.params?.["paymentId"] |
**paymentId** : A String value to represent the paymentId which is generated on the Stripe gateway. This id may represent different objects due to the payment gateway and the chosen flow type. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reservationpaymentbypaymentid/:paymentId**
```js
axios({
method: 'GET',
url: `/v1/reservationpaymentbypaymentid/${paymentId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_reservationPayment",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_reservationPayment": {
"id": "ID",
"ownerId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "String",
"statusLiteral": "String",
"redirectUrl": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Start Reservationpayment` API
Start payment for reservation
**Rest Route**
The `startReservationPayment` API REST controller can be triggered via the following route:
`/v1/startreservationpayment/:reservationId`
**Rest Request Parameters**
The `startReservationPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.params?.["reservationId"] |
| paymentUserParams | Object | true | request.body?.["paymentUserParams"] |
**reservationId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to start a stripe payment process. Must include paymentMethodId.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/startreservationpayment/:reservationId**
```js
axios({
method: 'PATCH',
url: `/v1/startreservationpayment/${reservationId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Refresh Reservationpayment` API
Refresh payment info for reservation from Stripe
**Rest Route**
The `refreshReservationPayment` API REST controller can be triggered via the following route:
`/v1/refreshreservationpayment/:reservationId`
**Rest Request Parameters**
The `refreshReservationPayment` api has got 2 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | true | request.params?.["reservationId"] |
| paymentUserParams | Object | false | request.body?.["paymentUserParams"] |
**reservationId** : This id paremeter is used to select the required data object that will be updated
**paymentUserParams** : The user parameters that should be defined to refresh a stripe payment process
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/refreshreservationpayment/:reservationId**
```js
axios({
method: 'PATCH',
url: `/v1/refreshreservationpayment/${reservationId}`,
data: {
paymentUserParams:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Callback Reservationpayment` API
Refresh payment values by gateway webhook call for reservation
**Rest Route**
The `callbackReservationPayment` API REST controller can be triggered via the following route:
`/v1/callbackreservationpayment`
**Rest Request Parameters**
The `callbackReservationPayment` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reservationId | ID | false | request.body?.["reservationId"] |
**reservationId** : The order id parameter that will be read from webhook callback params
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/callbackreservationpayment**
```js
axios({
method: 'POST',
url: '/v1/callbackreservationpayment',
data: {
reservationId:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reservation",
"method": "POST",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"reservation": {
"id": "ID",
"listingId": "ID",
"approvalType": "Enum",
"approvalType_idx": "Integer",
"bookingStatus": "Enum",
"bookingStatus_idx": "Integer",
"hostId": "ID",
"checkOut": "Date",
"guestId": "ID",
"checkIn": "Date",
"currency": "String",
"guestCount": "Integer",
"totalPrice": "Double",
"iCalExportUrl": "String",
"disputeStatus": "Enum",
"disputeStatus_idx": "Integer",
"bookingPoliciesSnapshot": "Object",
"iCalImportSource": "String",
"cancellationPolicySnapshot": "Object",
"paymentConfirmation": "Enum",
"paymentConfirmation_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
"paymentResult": {
"paymentTicketId": "ID",
"orderId": "ID",
"paymentId": "String",
"paymentStatus": "Enum",
"paymentIntentInfo": "Object",
"statusLiteral": "String",
"amount": "Double",
"currency": "String",
"success": true,
"description": "String",
"metadata": "Object",
"paymentUserParams": "Object"
}
}
```
### `Get Paymentcustomerbyuserid` API
This route is used to get the payment customer information by user id.
**Rest Route**
The `getPaymentCustomerByUserId` API REST controller can be triggered via the following route:
`/v1/paymentcustomers/:userId`
**Rest Request Parameters**
The `getPaymentCustomerByUserId` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who is created as a stripe customer. The parameter is used to query data.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomers/${userId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomer",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_paymentCustomer": {
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Paymentcustomers` API
This route is used to list all payment customers.
**Rest Route**
The `listPaymentCustomers` API REST controller can be triggered via the following route:
`/v1/paymentcustomers`
**Rest Request Parameters**
**Filter Parameters**
The `listPaymentCustomers` api supports 3 optional filter parameters for filtering list results:
**userId** (`ID`): An ID value to represent the user who is created as a stripe customer
- Single: `?userId=`
- Multiple: `?userId=&userId=`
- Null: `?userId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the Stripe gateway. This id is used to represent the customer in the Stripe gateway
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**platform** (`String`): A String value to represent payment platform which is used to make the payment. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomers**
```js
axios({
method: 'GET',
url: '/v1/paymentcustomers',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// userId: '' // Filter by userId
// customerId: '' // Filter by customerId
// platform: '' // Filter by platform
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentCustomers",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentCustomers": [
{
"id": "ID",
"userId": "ID",
"customerId": "String",
"platform": "String",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Paymentcustomermethods` API
This route is used to list all payment customer methods.
**Rest Route**
The `listPaymentCustomerMethods` API REST controller can be triggered via the following route:
`/v1/paymentcustomermethods/:userId`
**Rest Request Parameters**
The `listPaymentCustomerMethods` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| userId | ID | true | request.params?.["userId"] |
**userId** : An ID value to represent the user who owns the payment method. The parameter is used to query data.
**Filter Parameters**
The `listPaymentCustomerMethods` api supports 6 optional filter parameters for filtering list results:
**paymentMethodId** (`String`): A string value to represent the id of the payment method on the payment platform.
- Single (partial match, case-insensitive): `?paymentMethodId=`
- Multiple: `?paymentMethodId=&paymentMethodId=`
- Null: `?paymentMethodId=null`
**customerId** (`String`): A string value to represent the customer id which is generated on the payment gateway.
- Single (partial match, case-insensitive): `?customerId=`
- Multiple: `?customerId=&customerId=`
- Null: `?customerId=null`
**cardHolderName** (`String`): A string value to represent the name of the card holder. It can be different than the registered customer.
- Single (partial match, case-insensitive): `?cardHolderName=`
- Multiple: `?cardHolderName=&cardHolderName=`
- Null: `?cardHolderName=null`
**cardHolderZip** (`String`): A string value to represent the zip code of the card holder. It is used for address verification in specific countries.
- Single (partial match, case-insensitive): `?cardHolderZip=`
- Multiple: `?cardHolderZip=&cardHolderZip=`
- Null: `?cardHolderZip=null`
**platform** (`String`): A String value to represent payment platform which teh paymentMethod belongs. It is stripe as default. It will be used to distinguesh the payment gateways in the future.
- Single (partial match, case-insensitive): `?platform=`
- Multiple: `?platform=&platform=`
- Null: `?platform=null`
**cardInfo** (`Object`): A Json value to store the card details of the payment method.
- Single: `?cardInfo=`
- Multiple: `?cardInfo=&cardInfo=`
- Null: `?cardInfo=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/paymentcustomermethods/:userId**
```js
axios({
method: 'GET',
url: `/v1/paymentcustomermethods/${userId}`,
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// paymentMethodId: '' // Filter by paymentMethodId
// customerId: '' // Filter by customerId
// cardHolderName: '' // Filter by cardHolderName
// cardHolderZip: '' // Filter by cardHolderZip
// platform: '' // Filter by platform
// cardInfo: '' // Filter by cardInfo
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_paymentMethods",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_paymentMethods": [
{
"id": "ID",
"paymentMethodId": "String",
"userId": "ID",
"customerId": "String",
"cardHolderName": "String",
"cardHolderZip": "String",
"platform": "String",
"cardInfo": "Object",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### Authentication Specific Routes
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-reviewsystem-service
**Version:** `1.0.7`
Handles double-blind, moderated reviews and rating aggregation for stays. Allows guests/hosts to review each other and listings, supports moderation, and exposes aggregate stats for listings/profiles...
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the ReviewSystem Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our ReviewSystem Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the ReviewSystem Service via HTTP requests for purposes such as creating, updating, deleting and querying ReviewSystem objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the ReviewSystem Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the ReviewSystem service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the ReviewSystem service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the ReviewSystem service.
This service is configured to listen for HTTP requests on port `3004`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/reviewsystem-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/reviewsystem-api`
* **Production:** `https://airbnb3.mindbricks.co/reviewsystem-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the ReviewSystem service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `ReviewSystem` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `ReviewSystem` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `ReviewSystem` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
ReviewSystem service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### ReviewAggregate resource
*Resource Definition* : Cached aggregate rating stats for a listing, host, or guest. Used for fast lookup and display of averages, counts, etc.
*ReviewAggregate Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **revieweeId** | ID | | | ** |
| **revieweeType** | Enum | | | ** |
| **averageRating** | Double | | | ** |
| **reviewCount** | Integer | | | ** |
| **visibilityStatus** | Enum | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### revieweeType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **host** | `"host""` | 0 |
| **guest** | `"guest""` | 1 |
| **listing** | `"listing""` | 2 |
##### visibilityStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **public** | `"public""` | 0 |
| **hidden** | `"hidden""` | 1 |
### Review resource
*Resource Definition* : Review submitted by a guest or host after a completed stay. Enables double-blind, supports moderation, and links to reservation/listing and users.
*Review Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **moderationStatus** | Enum | | | ** |
| **isPublished** | Boolean | | | ** |
| **reviewText** | Text | | | ** |
| **rating** | Integer | | | ** |
| **blindSubmissionCode** | String | | | ** |
| **revieweeId** | ID | | | ** |
| **reservationId** | ID | | | ** |
| **reviewerId** | ID | | | ** |
| **revieweeType** | Enum | | | ** |
| **submittedAt** | Date | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### moderationStatus Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **approved** | `"approved""` | 1 |
| **rejected** | `"rejected""` | 2 |
##### revieweeType Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **host** | `"host""` | 0 |
| **guest** | `"guest""` | 1 |
| **listing** | `"listing""` | 2 |
## Business Api
### `Get Review` API
Retrieve a review and, if double-blind complete, return full info. Enrich with reviewer/reviewee & reservation if allowed by publish and moderation/business rules.
**Rest Route**
The `getReview` API REST controller can be triggered via the following route:
`/v1/reviews/:reviewId`
**Rest Request Parameters**
The `getReview` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reviewId | ID | true | request.params?.["reviewId"] |
**reviewId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reviews/:reviewId**
```js
axios({
method: 'GET',
url: `/v1/reviews/${reviewId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Reviewaggregates` API
List aggregate rating stats for listings or user profiles (cache-friendly, e.g., for search results or admin export).
**Rest Route**
The `listReviewAggregates` API REST controller can be triggered via the following route:
`/v1/reviewaggregates`
**Rest Request Parameters**
**Filter Parameters**
The `listReviewAggregates` api supports 2 optional filter parameters for filtering list results:
**revieweeId** (`ID`): Filter by revieweeId
- Single: `?revieweeId=`
- Multiple: `?revieweeId=&revieweeId=`
- Null: `?revieweeId=null`
**revieweeType** (`Enum`): Filter by revieweeType
- Single: `?revieweeType=` (case-insensitive)
- Multiple: `?revieweeType=&revieweeType=`
- Null: `?revieweeType=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reviewaggregates**
```js
axios({
method: 'GET',
url: '/v1/reviewaggregates',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// revieweeId: '' // Filter by revieweeId
// revieweeType: '' // Filter by revieweeType
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviewAggregates",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"reviewAggregates": [
{
"id": "ID",
"revieweeId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"averageRating": "Double",
"reviewCount": "Integer",
"visibilityStatus": "Enum",
"visibilityStatus_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Review` API
Guest or host submits review for completed reservation. Double-blind: published after both reviews or expiry. Moderation applies. Only allowed if session.user is guest/host of reservation and not already reviewed.
**Rest Route**
The `createReview` API REST controller can be triggered via the following route:
`/v1/reviews`
**Rest Request Parameters**
The `createReview` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| moderationStatus | Enum | true | request.body?.["moderationStatus"] |
| isPublished | Boolean | true | request.body?.["isPublished"] |
| reviewText | Text | true | request.body?.["reviewText"] |
| rating | Integer | true | request.body?.["rating"] |
| revieweeId | ID | true | request.body?.["revieweeId"] |
| reservationId | ID | true | request.body?.["reservationId"] |
| revieweeType | Enum | true | request.body?.["revieweeType"] |
**moderationStatus** :
**isPublished** :
**reviewText** :
**rating** :
**revieweeId** :
**reservationId** :
**revieweeType** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/reviews**
```js
axios({
method: 'POST',
url: '/v1/reviews',
data: {
moderationStatus:"Enum",
isPublished:"Boolean",
reviewText:"Text",
rating:"Integer",
revieweeId:"ID",
reservationId:"ID",
revieweeType:"Enum",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Delete Review` API
Allows hard or soft-delete of review pre-publish (reviewer) or at any time (admin/moderator). Deletion triggers aggregate recalc.
**Rest Route**
The `deleteReview` API REST controller can be triggered via the following route:
`/v1/reviews/:reviewId`
**Rest Request Parameters**
The `deleteReview` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reviewId | ID | true | request.params?.["reviewId"] |
**reviewId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/reviews/:reviewId**
```js
axios({
method: 'DELETE',
url: `/v1/reviews/${reviewId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": false,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Get Reviewaggregate` API
Get aggregate rating stats for listing or user profile (fast lookup cache for UI display).
**Rest Route**
The `getReviewAggregate` API REST controller can be triggered via the following route:
`/v1/reviewaggregates/:reviewAggregateId`
**Rest Request Parameters**
The `getReviewAggregate` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reviewAggregateId | ID | true | request.params?.["reviewAggregateId"] |
**reviewAggregateId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reviewaggregates/:reviewAggregateId**
```js
axios({
method: 'GET',
url: `/v1/reviewaggregates/${reviewAggregateId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviewAggregate",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"reviewAggregate": {
"id": "ID",
"revieweeId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"averageRating": "Double",
"reviewCount": "Integer",
"visibilityStatus": "Enum",
"visibilityStatus_idx": "Integer",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Reviews` API
List published/approved reviews for listing, host, or guest profile. Double-blind: only list reviews when available (both submitted or timer expired & published). Optional filters: revieweeId, revieweeType, reservationId.
**Rest Route**
The `listReviews` API REST controller can be triggered via the following route:
`/v1/reviews`
**Rest Request Parameters**
**Filter Parameters**
The `listReviews` api supports 4 optional filter parameters for filtering list results:
**revieweeId** (`ID`): Filter by revieweeId
- Single: `?revieweeId=`
- Multiple: `?revieweeId=&revieweeId=`
- Null: `?revieweeId=null`
**reservationId** (`ID`): Filter by reservationId
- Single: `?reservationId=`
- Multiple: `?reservationId=&reservationId=`
- Null: `?reservationId=null`
**reviewerId** (`ID`): Filter by reviewerId
- Single: `?reviewerId=`
- Multiple: `?reviewerId=&reviewerId=`
- Null: `?reviewerId=null`
**revieweeType** (`Enum`): Filter by revieweeType
- Single: `?revieweeType=` (case-insensitive)
- Multiple: `?revieweeType=&revieweeType=`
- Null: `?revieweeType=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/reviews**
```js
axios({
method: 'GET',
url: '/v1/reviews',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// revieweeId: '' // Filter by revieweeId
// reservationId: '' // Filter by reservationId
// reviewerId: '' // Filter by reviewerId
// revieweeType: '' // Filter by revieweeType
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "reviews",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"reviews": [
{
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Review` API
Allows reviewer to edit own review before publish OR admin/mod to update moderation fields. Enforces state business rules.
**Rest Route**
The `updateReview` API REST controller can be triggered via the following route:
`/v1/reviews/:reviewId`
**Rest Request Parameters**
The `updateReview` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| reviewId | ID | true | request.params?.["reviewId"] |
| moderationStatus | Enum | false | request.body?.["moderationStatus"] |
| isPublished | Boolean | false | request.body?.["isPublished"] |
| reviewText | Text | false | request.body?.["reviewText"] |
**reviewId** : This id paremeter is used to select the required data object that will be updated
**moderationStatus** :
**isPublished** :
**reviewText** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/reviews/:reviewId**
```js
axios({
method: 'PATCH',
url: `/v1/reviews/${reviewId}`,
data: {
moderationStatus:"Enum",
isPublished:"Boolean",
reviewText:"Text",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "review",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"review": {
"id": "ID",
"moderationStatus": "Enum",
"moderationStatus_idx": "Integer",
"isPublished": "Boolean",
"reviewText": "Text",
"rating": "Integer",
"blindSubmissionCode": "String",
"revieweeId": "ID",
"reservationId": "ID",
"reviewerId": "ID",
"revieweeType": "Enum",
"revieweeType_idx": "Integer",
"submittedAt": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### Authentication Specific Routes
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-platformadmin-service
**Version:** `1.0.69`
Administrative and compliance management backend for moderation, audit, dispute, financial oversight, localization, and GDPR in the Airbnb-style rental platform.
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the PlatformAdmin Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our PlatformAdmin Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the PlatformAdmin Service via HTTP requests for purposes such as creating, updating, deleting and querying PlatformAdmin objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the PlatformAdmin Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the PlatformAdmin service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the PlatformAdmin service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the PlatformAdmin service.
This service is configured to listen for HTTP requests on port `3003`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/platformadmin-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/platformadmin-api`
* **Production:** `https://airbnb3.mindbricks.co/platformadmin-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the PlatformAdmin service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `PlatformAdmin` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `PlatformAdmin` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `PlatformAdmin` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
PlatformAdmin service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### LocalizationSetting resource
*Resource Definition* : Admin-configured valid languages/currencies for site usage and preference.
*LocalizationSetting Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **languageCode** | String | | | ** |
| **effectiveFrom** | Date | | | ** |
| **effectiveTo** | Date | | | ** |
| **currencyCode** | String | | | ** |
| **isCurrencyActive** | Boolean | | | ** |
### AdminDisputeAction resource
*Resource Definition* : Record of an admin's moderation/decision action on a dispute.
*AdminDisputeAction Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **disputeId** | ID | | | ** |
| **actionTaken** | String | | | ** |
| **notes** | Text | | | ** |
| **adminId** | ID | | | ** |
| **outcome** | String | | | ** |
| **actionDate** | Date | | | ** |
### ApiKey resource
*Resource Definition* : Admin-generated API key for internal/external integration—has revocation, audit trail.
*ApiKey Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **key** | String | | | ** |
| **active** | Boolean | | | ** |
| **description** | String | | | ** |
| **revokedAt** | Date | | | ** |
| **createdBy** | ID | | | ** |
### FinancialReport resource
*Resource Definition* : System-generated or admin-generated report snapshots of platform financials for a given period (GDPR/tax).
*FinancialReport Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **period** | String | | | ** |
| **cityTaxByLocation** | Object | | | ** |
| **totalPayouts** | Double | | | ** |
| **createdBy** | ID | | | ** |
| **totalRefunds** | Double | | | ** |
| **currency** | String | | | ** |
| **generatedAt** | Date | | | ** |
| **totalRevenue** | Double | | | ** |
### AuditLog resource
*Resource Definition* : Immutable audit log for recording sensitive admin actions and platform changes.
*AuditLog Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **performedBy** | ID | | | ** |
| **objectId** | ID | | | ** |
| **details** | Object | | | ** |
| **ipAddress** | String | | | ** |
| **actionObject** | String | | | ** |
| **occurredAt** | Date | | | ** |
| **actionType** | String | | | ** |
### GdprAction resource
*Resource Definition* : Record of individual user GDPR/consent/export/delete request flow. Used for logs, compliance, and controls.
*GdprAction Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **requestedAt** | Date | | | ** |
| **status** | Enum | | | ** |
| **actionType** | String | | | ** |
| **userId** | ID | | | ** |
| **processedAt** | Date | | | ** |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### status Enum Property
*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **pending** | `"pending""` | 0 |
| **complete** | `"complete""` | 1 |
| **failed** | `"failed""` | 2 |
## Business Api
### `Get Auditlog` API
Fetch audit log entry by ID (admin only).
**Rest Route**
The `getAuditLog` API REST controller can be triggered via the following route:
`/v1/auditlogs/:auditLogId`
**Rest Request Parameters**
The `getAuditLog` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| auditLogId | ID | true | request.params?.["auditLogId"] |
**auditLogId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/auditlogs/:auditLogId**
```js
axios({
method: 'GET',
url: `/v1/auditlogs/${auditLogId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "auditLog",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"auditLog": {
"id": "ID",
"performedBy": "ID",
"objectId": "ID",
"details": "Object",
"ipAddress": "String",
"actionObject": "String",
"occurredAt": "Date",
"actionType": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Get Financialreport` API
Retrieve financial/tax report snapshot by ID (admin only).
**Rest Route**
The `getFinancialReport` API REST controller can be triggered via the following route:
`/v1/financialreports/:financialReportId`
**Rest Request Parameters**
The `getFinancialReport` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| financialReportId | ID | true | request.params?.["financialReportId"] |
**financialReportId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/financialreports/:financialReportId**
```js
axios({
method: 'GET',
url: `/v1/financialreports/${financialReportId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "financialReport",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"financialReport": {
"id": "ID",
"period": "String",
"cityTaxByLocation": "Object",
"totalPayouts": "Double",
"createdBy": "ID",
"totalRefunds": "Double",
"currency": "String",
"generatedAt": "Date",
"totalRevenue": "Double",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Create Financialreport` API
Snapshot financial and tax data for a period. Immutable after creation.
**Rest Route**
The `createFinancialReport` API REST controller can be triggered via the following route:
`/v1/financialreports`
**Rest Request Parameters**
The `createFinancialReport` api has got 7 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| period | String | true | request.body?.["period"] |
| cityTaxByLocation | Object | false | request.body?.["cityTaxByLocation"] |
| totalPayouts | Double | true | request.body?.["totalPayouts"] |
| createdBy | ID | true | request.body?.["createdBy"] |
| totalRefunds | Double | true | request.body?.["totalRefunds"] |
| currency | String | true | request.body?.["currency"] |
| totalRevenue | Double | true | request.body?.["totalRevenue"] |
**period** :
**cityTaxByLocation** :
**totalPayouts** :
**createdBy** :
**totalRefunds** :
**currency** :
**totalRevenue** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/financialreports**
```js
axios({
method: 'POST',
url: '/v1/financialreports',
data: {
period:"String",
cityTaxByLocation:"Object",
totalPayouts:"Double",
createdBy:"ID",
totalRefunds:"Double",
currency:"String",
totalRevenue:"Double",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "financialReport",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"financialReport": {
"id": "ID",
"period": "String",
"cityTaxByLocation": "Object",
"totalPayouts": "Double",
"createdBy": "ID",
"totalRefunds": "Double",
"currency": "String",
"generatedAt": "Date",
"totalRevenue": "Double",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `List Auditlogs` API
List audit log entries (admin only). Filterable by type, performer, object, date.
**Rest Route**
The `listAuditLogs` API REST controller can be triggered via the following route:
`/v1/auditlogs`
**Rest Request Parameters**
**Filter Parameters**
The `listAuditLogs` api supports 5 optional filter parameters for filtering list results:
**performedBy** (`ID`): Filter by performedBy
- Single: `?performedBy=`
- Multiple: `?performedBy=&performedBy=`
- Null: `?performedBy=null`
**objectId** (`ID`): Filter by objectId
- Single: `?objectId=`
- Multiple: `?objectId=&objectId=`
- Null: `?objectId=null`
**actionObject** (`String`): Filter by actionObject
- Single (partial match, case-insensitive): `?actionObject=`
- Multiple: `?actionObject=&actionObject=`
- Null: `?actionObject=null`
**occurredAt** (`Date`): Filter by occurredAt
- Single date: `?occurredAt=2024-01-15`
- Multiple dates: `?occurredAt=2024-01-15&occurredAt=2024-01-20`
- Special: `$today`, `$ltoday`, `$week`, `$lweek`, `$month`, `$leq-`, `$lin-`
- Null: `?occurredAt=null`
**actionType** (`String`): Filter by actionType
- Single (partial match, case-insensitive): `?actionType=`
- Multiple: `?actionType=&actionType=`
- Null: `?actionType=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/auditlogs**
```js
axios({
method: 'GET',
url: '/v1/auditlogs',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// performedBy: '' // Filter by performedBy
// objectId: '' // Filter by objectId
// actionObject: '' // Filter by actionObject
// occurredAt: '' // Filter by occurredAt
// actionType: '' // Filter by actionType
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "auditLogs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"auditLogs": [
{
"id": "ID",
"performedBy": "ID",
"objectId": "ID",
"details": "Object",
"ipAddress": "String",
"actionObject": "String",
"occurredAt": "Date",
"actionType": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `List Financialreports` API
List period financial/tax reports for admin/AUDIT purposes.
**Rest Route**
The `listFinancialReports` API REST controller can be triggered via the following route:
`/v1/financialreports`
**Rest Request Parameters**
**Filter Parameters**
The `listFinancialReports` api supports 1 optional filter parameter for filtering list results:
**period** (`String`): Filter by period
- Single (partial match, case-insensitive): `?period=`
- Multiple: `?period=&period=`
- Null: `?period=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/financialreports**
```js
axios({
method: 'GET',
url: '/v1/financialreports',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// period: '' // Filter by period
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "financialReports",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"financialReports": [
{
"id": "ID",
"period": "String",
"cityTaxByLocation": "Object",
"totalPayouts": "Double",
"createdBy": "ID",
"totalRefunds": "Double",
"currency": "String",
"generatedAt": "Date",
"totalRevenue": "Double",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Auditlog` API
Record an admin/platform action/event in the audit log. Called from side-effect flows, not direct user.
**Rest Route**
The `createAuditLog` API REST controller can be triggered via the following route:
`/v1/auditlogs`
**Rest Request Parameters**
The `createAuditLog` api has got 6 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| performedBy | ID | true | request.body?.["performedBy"] |
| objectId | ID | false | request.body?.["objectId"] |
| details | Object | false | request.body?.["details"] |
| ipAddress | String | false | request.body?.["ipAddress"] |
| actionObject | String | true | request.body?.["actionObject"] |
| actionType | String | true | request.body?.["actionType"] |
**performedBy** :
**objectId** :
**details** :
**ipAddress** :
**actionObject** :
**actionType** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/auditlogs**
```js
axios({
method: 'POST',
url: '/v1/auditlogs',
data: {
performedBy:"ID",
objectId:"ID",
details:"Object",
ipAddress:"String",
actionObject:"String",
actionType:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "auditLog",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"auditLog": {
"id": "ID",
"performedBy": "ID",
"objectId": "ID",
"details": "Object",
"ipAddress": "String",
"actionObject": "String",
"occurredAt": "Date",
"actionType": "String",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Create Localizationsetting` API
Add a supported language/currency for global usage.
**Rest Route**
The `createLocalizationSetting` API REST controller can be triggered via the following route:
`/v1/localizationsettings`
**Rest Request Parameters**
The `createLocalizationSetting` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| languageCode | String | true | request.body?.["languageCode"] |
| effectiveFrom | Date | false | request.body?.["effectiveFrom"] |
| effectiveTo | Date | false | request.body?.["effectiveTo"] |
| currencyCode | String | true | request.body?.["currencyCode"] |
| isCurrencyActive | Boolean | true | request.body?.["isCurrencyActive"] |
**languageCode** :
**effectiveFrom** :
**effectiveTo** :
**currencyCode** :
**isCurrencyActive** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/localizationsettings**
```js
axios({
method: 'POST',
url: '/v1/localizationsettings',
data: {
languageCode:"String",
effectiveFrom:"Date",
effectiveTo:"Date",
currencyCode:"String",
isCurrencyActive:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "localizationSetting",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"localizationSetting": {
"id": "ID",
"languageCode": "String",
"effectiveFrom": "Date",
"effectiveTo": "Date",
"currencyCode": "String",
"isCurrencyActive": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Admindisputeactions` API
List all moderation/decision records by admins for disputes. Filter by disputeId/adminId.
**Rest Route**
The `listAdminDisputeActions` API REST controller can be triggered via the following route:
`/v1/admindisputeactions`
**Rest Request Parameters**
**Filter Parameters**
The `listAdminDisputeActions` api supports 2 optional filter parameters for filtering list results:
**disputeId** (`ID`): Filter by disputeId
- Single: `?disputeId=`
- Multiple: `?disputeId=&disputeId=`
- Null: `?disputeId=null`
**adminId** (`ID`): Filter by adminId
- Single: `?adminId=`
- Multiple: `?adminId=&adminId=`
- Null: `?adminId=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/admindisputeactions**
```js
axios({
method: 'GET',
url: '/v1/admindisputeactions',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// disputeId: '' // Filter by disputeId
// adminId: '' // Filter by adminId
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "adminDisputeActions",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"adminDisputeActions": [
{
"id": "ID",
"disputeId": "ID",
"actionTaken": "String",
"notes": "Text",
"adminId": "ID",
"outcome": "String",
"actionDate": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Admindisputeaction` API
Admin records moderation/decision action on a dispute (creates audit log as side effect).
**Rest Route**
The `createAdminDisputeAction` API REST controller can be triggered via the following route:
`/v1/admindisputeactions`
**Rest Request Parameters**
The `createAdminDisputeAction` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| disputeId | ID | true | request.body?.["disputeId"] |
| actionTaken | String | true | request.body?.["actionTaken"] |
| notes | Text | false | request.body?.["notes"] |
| adminId | ID | true | request.body?.["adminId"] |
| outcome | String | false | request.body?.["outcome"] |
**disputeId** :
**actionTaken** :
**notes** :
**adminId** :
**outcome** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/admindisputeactions**
```js
axios({
method: 'POST',
url: '/v1/admindisputeactions',
data: {
disputeId:"ID",
actionTaken:"String",
notes:"Text",
adminId:"ID",
outcome:"String",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "adminDisputeAction",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"adminDisputeAction": {
"id": "ID",
"disputeId": "ID",
"actionTaken": "String",
"notes": "Text",
"adminId": "ID",
"outcome": "String",
"actionDate": "Date",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Localizationsetting` API
Update a localization setting. Admin only.
**Rest Route**
The `updateLocalizationSetting` API REST controller can be triggered via the following route:
`/v1/localizationsettings/:localizationSettingId`
**Rest Request Parameters**
The `updateLocalizationSetting` api has got 6 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| localizationSettingId | ID | true | request.params?.["localizationSettingId"] |
| languageCode | String | false | request.body?.["languageCode"] |
| effectiveFrom | Date | false | request.body?.["effectiveFrom"] |
| effectiveTo | Date | false | request.body?.["effectiveTo"] |
| currencyCode | String | false | request.body?.["currencyCode"] |
| isCurrencyActive | Boolean | false | request.body?.["isCurrencyActive"] |
**localizationSettingId** : This id paremeter is used to select the required data object that will be updated
**languageCode** :
**effectiveFrom** :
**effectiveTo** :
**currencyCode** :
**isCurrencyActive** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/localizationsettings/:localizationSettingId**
```js
axios({
method: 'PATCH',
url: `/v1/localizationsettings/${localizationSettingId}`,
data: {
languageCode:"String",
effectiveFrom:"Date",
effectiveTo:"Date",
currencyCode:"String",
isCurrencyActive:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "localizationSetting",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"localizationSetting": {
"id": "ID",
"languageCode": "String",
"effectiveFrom": "Date",
"effectiveTo": "Date",
"currencyCode": "String",
"isCurrencyActive": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `Update Gdpraction` API
Compliance admin records status of a GDPR request (pending/complete/failed). No delete allowed for compliance records.
**Rest Route**
The `updateGdprAction` API REST controller can be triggered via the following route:
`/v1/gdpractions/:gdprActionId`
**Rest Request Parameters**
The `updateGdprAction` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| gdprActionId | ID | true | request.params?.["gdprActionId"] |
| status | Enum | false | request.body?.["status"] |
| processedAt | Date | false | request.body?.["processedAt"] |
**gdprActionId** : This id paremeter is used to select the required data object that will be updated
**status** :
**processedAt** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/gdpractions/:gdprActionId**
```js
axios({
method: 'PATCH',
url: `/v1/gdpractions/${gdprActionId}`,
data: {
status:"Enum",
processedAt:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gdprAction",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"gdprAction": {
"id": "ID",
"requestedAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"actionType": "String",
"userId": "ID",
"processedAt": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `List Gdpractions` API
List all GDPR/compliance records with status for audit/compliance purposes.
**Rest Route**
The `listGdprActions` API REST controller can be triggered via the following route:
`/v1/gdpractions`
**Rest Request Parameters**
The `listGdprActions` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/gdpractions**
```js
axios({
method: 'GET',
url: '/v1/gdpractions',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gdprActions",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"gdprActions": [
{
"id": "ID",
"requestedAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"actionType": "String",
"userId": "ID",
"processedAt": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Apikey` API
Create/administer an API key (for integrations, partners, automation). Key is hashed at rest.
**Rest Route**
The `createApiKey` API REST controller can be triggered via the following route:
`/v1/apikeys`
**Rest Request Parameters**
The `createApiKey` api has got 5 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| key | String | true | request.body?.["key"] |
| active | Boolean | true | request.body?.["active"] |
| description | String | false | request.body?.["description"] |
| revokedAt | Date | false | request.body?.["revokedAt"] |
| createdBy | ID | true | request.body?.["createdBy"] |
**key** :
**active** :
**description** :
**revokedAt** :
**createdBy** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/apikeys**
```js
axios({
method: 'POST',
url: '/v1/apikeys',
data: {
key:"String",
active:"Boolean",
description:"String",
revokedAt:"Date",
createdBy:"ID",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "apiKey",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"apiKey": {
"id": "ID",
"key": "String",
"active": "Boolean",
"description": "String",
"revokedAt": "Date",
"createdBy": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Apikeys` API
Show all API keys with status (hash only, never show the sensitive key string itself).
**Rest Route**
The `listApiKeys` API REST controller can be triggered via the following route:
`/v1/apikeys`
**Rest Request Parameters**
The `listApiKeys` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/apikeys**
```js
axios({
method: 'GET',
url: '/v1/apikeys',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "apiKeys",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"apiKeys": [
{
"id": "ID",
"key": "String",
"active": "Boolean",
"description": "String",
"revokedAt": "Date",
"createdBy": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Apikey` API
Update API key metadata or deactivate (e.g. revoke). Only admin allowed.
**Rest Route**
The `updateApiKey` API REST controller can be triggered via the following route:
`/v1/apikeys/:apiKeyId`
**Rest Request Parameters**
The `updateApiKey` api has got 4 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| apiKeyId | ID | true | request.params?.["apiKeyId"] |
| active | Boolean | false | request.body?.["active"] |
| description | String | false | request.body?.["description"] |
| revokedAt | Date | false | request.body?.["revokedAt"] |
**apiKeyId** : This id paremeter is used to select the required data object that will be updated
**active** :
**description** :
**revokedAt** :
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/apikeys/:apiKeyId**
```js
axios({
method: 'PATCH',
url: `/v1/apikeys/${apiKeyId}`,
data: {
active:"Boolean",
description:"String",
revokedAt:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "apiKey",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"apiKey": {
"id": "ID",
"key": "String",
"active": "Boolean",
"description": "String",
"revokedAt": "Date",
"createdBy": "ID",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
}
}
```
### `List Localizationsettings` API
Show all currently configured languages/currencies.
**Rest Route**
The `listLocalizationSettings` API REST controller can be triggered via the following route:
`/v1/localizationsettings`
**Rest Request Parameters**
**Filter Parameters**
The `listLocalizationSettings` api supports 3 optional filter parameters for filtering list results:
**languageCode** (`String`): Filter by languageCode
- Single (partial match, case-insensitive): `?languageCode=`
- Multiple: `?languageCode=&languageCode=`
- Null: `?languageCode=null`
**currencyCode** (`String`): Filter by currencyCode
- Single (partial match, case-insensitive): `?currencyCode=`
- Multiple: `?currencyCode=¤cyCode=`
- Null: `?currencyCode=null`
**isCurrencyActive** (`Boolean`): Filter by isCurrencyActive
- True: `?isCurrencyActive=true`
- False: `?isCurrencyActive=false`
- Null: `?isCurrencyActive=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/localizationsettings**
```js
axios({
method: 'GET',
url: '/v1/localizationsettings',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// languageCode: '' // Filter by languageCode
// currencyCode: '' // Filter by currencyCode
// isCurrencyActive: '' // Filter by isCurrencyActive
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "localizationSettings",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"localizationSettings": [
{
"id": "ID",
"languageCode": "String",
"effectiveFrom": "Date",
"effectiveTo": "Date",
"currencyCode": "String",
"isCurrencyActive": "Boolean",
"isActive": true,
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID"
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Create Gdpraction` API
User/admin submits GDPR request (export/delete/consent). Logged for compliance; status may be updated by compliance admin only.
**Rest Route**
The `createGdprAction` API REST controller can be triggered via the following route:
`/v1/gdpractions`
**Rest Request Parameters**
The `createGdprAction` api has got 3 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| actionType | String | true | request.body?.["actionType"] |
| userId | ID | true | request.body?.["userId"] |
| processedAt | Date | false | request.body?.["processedAt"] |
**actionType** :
**userId** :
**processedAt** :
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/gdpractions**
```js
axios({
method: 'POST',
url: '/v1/gdpractions',
data: {
actionType:"String",
userId:"ID",
processedAt:"Date",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "gdprAction",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"gdprAction": {
"id": "ID",
"requestedAt": "Date",
"status": "Enum",
"status_idx": "Integer",
"actionType": "String",
"userId": "ID",
"processedAt": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### Authentication Specific Routes
### Common Routes
### Route: currentuser
*Route Definition*: Retrieves the currently authenticated user's session information.
*Route Type*: sessionInfo
*Access Route*: `GET /currentuser`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Returns the authenticated session object associated with the current access token.
- If no valid session exists, responds with a 401 Unauthorized.
```js
// Sample GET /currentuser call
axios.get("/currentuser", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns the session object, including user-related data and token information.
````
{
"sessionId": "9cf23fa8-07d4-4e7c-80a6-ec6d6ac96bb9",
"userId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"email": "user@example.com",
"fullname": "John Doe",
"roleId": "user",
"tenantId": "abc123",
"accessToken": "jwt-token-string",
...
}
````
**Error Response**
**401 Unauthorized:** No active session found.
````
{
"status": "ERR",
"message": "No login found"
}
````
**Notes**
* This route is typically used by frontend or mobile applications to fetch the current session state after login.
* The returned session includes key user identity fields, tenant information (if applicable), and the access token for further authenticated requests.
* Always ensure a valid access token is provided in the request to retrieve the session.
### Route: permissions
`*Route Definition*`: Retrieves all effective permission records assigned to the currently authenticated user.
`*Route Type*`: permissionFetch
*Access Route*: `GET /permissions`
#### Parameters
This route does **not** require any request parameters.
#### Behavior
- Fetches all active permission records (`givenPermissions` entries) associated with the current user session.
- Returns a full array of permission objects.
- Requires a valid session (`access token`) to be available.
```js
// Sample GET /permissions call
axios.get("/permissions", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
Returns an array of permission objects.
```json
[
{
"id": "perm1",
"permissionName": "adminPanel.access",
"roleId": "admin",
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
},
{
"id": "perm2",
"permissionName": "orders.manage",
"roleId": null,
"subjectUserId": "d92b9d4c-9b1e-4e95-842e-3fb9c8c1df38",
"subjectUserGroupId": null,
"objectId": null,
"canDo": true,
"tenantCodename": "store123"
}
]
````
Each object reflects a single permission grant, aligned with the givenPermissions model:
- `**permissionName**`: The permission the user has.
- `**roleId**`: If the permission was granted through a role.
-` **subjectUserId**`: If directly granted to the user.
- `**subjectUserGroupId**`: If granted through a group.
- `**objectId**`: If tied to a specific object (OBAC).
- `**canDo**`: True or false flag to represent if permission is active or restricted.
**Error Responses**
* **401 Unauthorized**: No active session found.
```json
{
"status": "ERR",
"message": "No login found"
}
````
* **500 Internal Server Error**: Unexpected error fetching permissions.
**Notes**
* The /permissions route is available across all backend services generated by Mindbricks, not just the auth service.
* Auth service: Fetches permissions freshly from the live database (givenPermissions table).
* Other services: Typically use a cached or projected view of permissions stored in a common ElasticSearch store, optimized for faster authorization checks.
> **Tip**:
> Applications can cache permission results client-side or server-side, but should occasionally refresh by calling this endpoint, especially after login or permission-changing operations.
### Route: permissions/:permissionName
*Route Definition*: Checks whether the current user has access to a specific permission, and provides a list of scoped object exceptions or inclusions.
*Route Type*: permissionScopeCheck
*Access Route*: `GET /permissions/:permissionName`
#### Parameters
| Parameter | Type | Required | Population |
|------------------|--------|----------|------------------------|
| permissionName | String | Yes | `request.params.permissionName` |
#### Behavior
- Evaluates whether the current user **has access** to the given `permissionName`.
- Returns a structured object indicating:
- Whether the permission is generally granted (`canDo`)
- Which object IDs are explicitly included or excluded from access (`exceptions`)
- Requires a valid session (`access token`).
```js
// Sample GET /permissions/orders.manage
axios.get("/permissions/orders.manage", {
headers: {
"Authorization": "Bearer your-jwt-token"
}
});
````
**Success Response**
```json
{
"canDo": true,
"exceptions": [
"a1f2e3d4-xxxx-yyyy-zzzz-object1",
"b2c3d4e5-xxxx-yyyy-zzzz-object2"
]
}
````
* If `canDo` is `true`, the user generally has the permission, but not for the objects listed in `exceptions` (i.e., restrictions).
* If `canDo` is `false`, the user does not have the permission by default — but only for the objects in `exceptions`, they do have permission (i.e., selective overrides).
* The exceptions array contains valid **UUID strings**, each corresponding to an object ID (typically from the data model targeted by the permission).
## Copyright
All sources, documents and other digital materials are copyright of .
## About Us
For more information please visit our website: .
.
.
---
# REST API GUIDE
## airbnb-agenthub-service
**Version:** `1.0.0`
AI Agent Hub
## Architectural Design Credit and Contact Information
The architectural design of this microservice is credited to .
For inquiries, feedback, or further information regarding the architecture, please direct your communication to:
Email:
We encourage open communication and welcome any questions or discussions related to the architectural aspects of this microservice.
## Documentation Scope
Welcome to the official documentation for the AgentHub Service's REST API. This document is designed to provide a comprehensive guide to interfacing with our AgentHub Service exclusively through RESTful API endpoints.
**Intended Audience**
This documentation is intended for developers and integrators who are looking to interact with the AgentHub Service via HTTP requests for purposes such as creating, updating, deleting and querying AgentHub objects.
**Overview**
Within these pages, you will find detailed information on how to effectively utilize the REST API, including authentication methods, request and response formats, endpoint descriptions, and examples of common use cases.
Beyond REST
It's important to note that the AgentHub Service also supports alternative methods of interaction, such as gRPC and messaging via a Message Broker. These communication methods are beyond the scope of this document. For information regarding these protocols, please refer to their respective documentation.
## Authentication And Authorization
To ensure secure access to the AgentHub service's protected endpoints, a project-wide access token is required. This token serves as the primary method for authenticating requests to our service. However, it's important to note that access control varies across different routes:
**Protected API**:
Certain API (routes) require specific authorization levels. Access to these routes is contingent upon the possession of a valid access token that meets the route-specific authorization criteria. Unauthorized requests to these routes will be rejected.
**Public API **:
The service also includes public API (routes) that are accessible without authentication. These public endpoints are designed for open access and do not require an access token.
### Token Locations
When including your access token in a request, ensure it is placed in one of the following specified locations. The service will sequentially search these locations for the token, utilizing the first one it encounters.
| Location | Token Name / Param Name |
| ---------------------- | ---------------------------- |
| Query | access_token |
| Authorization Header | Bearer |
| Header | airbnb3-access-token|
| Cookie | airbnb3-access-token|
Please ensure the token is correctly placed in one of these locations, using the appropriate label as indicated. The service prioritizes these locations in the order listed, processing the first token it successfully identifies.
## Api Definitions
This section outlines the API endpoints available within the AgentHub service. Each endpoint can receive parameters through various methods, meticulously described in the following definitions. It's important to understand the flexibility in how parameters can be included in requests to effectively interact with the AgentHub service.
This service is configured to listen for HTTP requests on port `3006`,
serving both the main API interface and default administrative endpoints.
The following routes are available by default:
* **API Test Interface (API Face):** `/`
* **Swagger Documentation:** `/swagger`
* **Postman Collection Download:** `/getPostmanCollection`
* **Health Checks:** `/health` and `/admin/health`
* **Current Session Info:** `/currentuser`
* **Favicon:** `/favicon.ico`
This service is accessible via the following environment-specific URLs:
* **Preview:** `https://airbnb3.prw.mindbricks.com/agenthub-api`
* **Staging:** `https://airbnb3-stage.mindbricks.co/agenthub-api`
* **Production:** `https://airbnb3.mindbricks.co/agenthub-api`
**Parameter Inclusion Methods:**
Parameters can be incorporated into API requests in several ways, each with its designated location. Understanding these methods is crucial for correctly constructing your requests:
**Query Parameters:** Included directly in the URL's query string.
**Path Parameters:** Embedded within the URL's path.
**Body Parameters:** Sent within the JSON body of the request.
**Session Parameters:** Automatically read from the session object. This method is used for parameters that are intrinsic to the user's session, such as userId. When using an API that involves session parameters, you can omit these from your request. The service will automatically bind them to the API layer, provided that a session is associated with your request.
**Note on Session Parameters:**
Session parameters represent a unique method of parameter inclusion, relying on the context of the user's session. A common example of a session parameter is userId, which the service automatically associates with your request when a session exists. This feature ensures seamless integration of user-specific data without manual input for each request.
By adhering to the specified parameter inclusion methods, you can effectively utilize the AgentHub service's API endpoints. For detailed information on each endpoint, including required parameters and their accepted locations, refer to the individual API definitions below.
### Common Parameters
The `AgentHub` service's business API support several common parameters designed to modify and enhance the behavior of API requests. These parameters are not individually listed in the API route definitions to avoid repetition. Instead, refer to this section to understand how to leverage these common behaviors across different routes. Note that all common parameters should be included in the query part of the URL.
### Supported Common Parameters:
- **getJoins (BOOLEAN)**: Controls whether to retrieve associated objects along with the main object. By default, `getJoins` is assumed to be `true`. Set it to `false` if you prefer to receive only the main fields of an object, excluding its associations.
- **excludeCQRS (BOOLEAN)**: Applicable only when `getJoins` is `true`. By default, `excludeCQRS` is set to `false`. Enabling this parameter (`true`) omits non-local associations, which are typically more resource-intensive as they require querying external services like ElasticSearch for additional information. Use this to optimize response times and resource usage.
- **requestId (String)**: Identifies a request to enable tracking through the service's log chain. A random hex string of 32 characters is assigned by default. If you wish to use a custom `requestId`, simply include it in your query parameters.
- **caching (BOOLEAN)**: Determines the use of caching for query API. By default, caching is enabled (`true`). To ensure the freshest data directly from the database, set this parameter to `false`, bypassing the cache.
- **cacheTTL (Integer)**: Specifies the Time-To-Live (TTL) for query caching, in seconds. This is particularly useful for adjusting the default caching duration (5 minutes) for `get list` queries. Setting a custom `cacheTTL` allows you to fine-tune the cache lifespan to meet your needs.
- **pageNumber (Integer)**: For paginated `get list` API's, this parameter selects which page of results to retrieve. The default is `1`, indicating the first page. To disable pagination and retrieve all results, set `pageNumber` to `0`.
- **pageRowCount (Integer)**: In conjunction with paginated API's, this parameter defines the number of records per page. The default value is `25`. Adjusting `pageRowCount` allows you to control the volume of data returned in a single request.
By utilizing these common parameters, you can tailor the behavior of API requests to suit your specific requirements, ensuring optimal performance and usability of the `AgentHub` service.
### Error Response
If a request encounters an issue, whether due to a logical fault or a technical problem, the service responds with a standardized JSON error structure. The HTTP status code within this response indicates the nature of the error, utilizing commonly recognized codes for clarity:
- **400 Bad Request**: The request was improperly formatted or contained invalid parameters, preventing the server from processing it.
- **401 Unauthorized**: The request lacked valid authentication credentials or the credentials provided do not grant access to the requested resource.
- **404 Not Found**: The requested resource was not found on the server.
- **500 Internal Server Error**: The server encountered an unexpected condition that prevented it from fulfilling the request.
Each error response is structured to provide meaningful insight into the problem, assisting in diagnosing and resolving issues efficiently.
```js
{
"result": "ERR",
"status": 400,
"message": "errMsg_organizationIdisNotAValidID",
"errCode": 400,
"date": "2024-03-19T12:13:54.124Z",
"detail": "String"
}
````
### Object Structure of a Successfull Response
When the `AgentHub` service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope not only contains the data but also includes essential metadata, such as configuration details and pagination information, to enrich the response and provide context to the client.
**Key Characteristics of the Response Envelope:**
- **Data Presentation**: Depending on the nature of the request, the service returns either a single data object or an array of objects encapsulated within the JSON envelope.
- **Creation and Update API**: These API routes return the unmodified (pure) form of the data object(s), without any associations to other data objects.
- **Delete API**: Even though the data is removed from the database, the last known state of the data object(s) is returned in its pure form.
- **Get Requests**: A single data object is returned in JSON format.
- **Get List Requests**: An array of data objects is provided, reflecting a collection of resources.
- **Data Structure and Joins**: The complexity of the data structure in the response can vary based on the API's architectural design and the join options specified in the request. The architecture might inherently limit join operations, or they might be dynamically controlled through query parameters.
- **Pure Data Forms**: In some cases, the response mirrors the exact structure found in the primary data table, without extensions.
- **Extended Data Forms**: Alternatively, responses might include data extended through joins with tables within the same service or aggregated from external sources, such as ElasticSearch indices related to other services.
- **Join Varieties**: The extensions might involve one-to-one joins, resulting in single object associations, or one-to-many joins, leading to an array of objects. In certain instances, the data might even feature nested inclusions from other data objects.
**Design Considerations**: The structure of a API's response data is meticulously crafted during the service's architectural planning. This design ensures that responses adequately reflect the intended data relationships and service logic, providing clients with rich and meaningful information.
**Brief Data**: Certain API's return a condensed version of the object data, intentionally selecting only specific fields deemed useful for that request. In such instances, the API documentation will detail the properties included in the response, guiding developers on what to expect.
### API Response Structure
The API utilizes a standardized JSON envelope to encapsulate responses. This envelope is designed to consistently deliver both the requested data and essential metadata, ensuring that clients can efficiently interpret and utilize the response.
**HTTP Status Codes:**
- **200 OK**: This status code is returned for successful GET, LIST, UPDATE, or DELETE operations, indicating that the request has been processed successfully.
- **201 Created**: This status code is specific to CREATE operations, signifying that the requested resource has been successfully created.
**Success Response Format:**
For successful operations, the response includes a `"status": "OK"` property, signaling the successful execution of the request. The structure of a successful response is outlined below:
```json
{
"status":"OK",
"statusCode": 200,
"elapsedMs":126,
"ssoTime":120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName":"products",
"method":"GET",
"action":"list",
"appVersion":"Version",
"rowCount":3
"products":[{},{},{}],
"paging": {
"pageNumber":1,
"pageRowCount":25,
"totalRowCount":3,
"pageCount":1
},
"filters": [],
"uiPermissions": []
}
````
- **`products`**: In this example, this key contains the actual response content, which may be a single object or an array of objects depending on the operation performed.
**Handling Errors:**
For details on handling error scenarios and understanding the structure of error responses, please refer to the "Error Response" section provided earlier in this documentation. It outlines how error conditions are communicated, including the use of HTTP status codes and standardized JSON structures for error messages.
## Resources
AgentHub service provides the following resources which are stored in its own database as a data object. Note that a resource for an api access is a data object for the service.
### Sys_agentOverride resource
*Resource Definition* : Runtime overrides for design-time agents. Null fields use the design default.
*Sys_agentOverride Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **agentName** | String | | | *Design-time agent name this override applies to.* |
| **provider** | String | | | *Override AI provider (e.g., openai, anthropic).* |
| **model** | String | | | *Override model name.* |
| **systemPrompt** | Text | | | *Override system prompt.* |
| **temperature** | Double | | | *Override temperature (0-2).* |
| **maxTokens** | Integer | | | *Override max tokens.* |
| **responseFormat** | String | | | *Override response format (text/json).* |
| **selectedTools** | Object | | | *Array of tool names from the catalog that this agent can use.* |
| **guardrails** | Object | | | *Override guardrails: { maxToolCalls, timeout, maxTokenBudget }.* |
| **enabled** | Boolean | | | *Enable or disable this agent.* |
| **updatedBy** | ID | | | *User who last updated this override.* |
### Sys_agentExecution resource
*Resource Definition* : Agent execution log. Records each agent invocation with input, output, and performance metrics.
*Sys_agentExecution Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **agentName** | String | | | *Agent that was executed.* |
| **agentType** | Enum | | | *Whether this was a design-time or dynamic agent.* |
| **source** | Enum | | | *How the agent was triggered.* |
| **userId** | ID | | | *User who triggered the execution.* |
| **input** | Object | | | *Request input (truncated for large payloads).* |
| **output** | Object | | | *Response output (truncated for large payloads).* |
| **toolCalls** | Integer | | | *Number of tool calls made during execution.* |
| **tokenUsage** | Object | | | *Token usage: { prompt, completion, total }.* |
| **durationMs** | Integer | | | *Execution time in milliseconds.* |
| **status** | Enum | | | *Execution status.* |
| **error** | Text | | | *Error message if execution failed.* |
#### Enum Properties
Enum properties are represented as strings in the database. The values are mapped to their corresponding names in the application layer.
##### agentType Enum Property
*Property Definition* : Whether this was a design-time or dynamic agent.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **design** | `"design""` | 0 |
| **dynamic** | `"dynamic""` | 1 |
##### source Enum Property
*Property Definition* : How the agent was triggered.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **rest** | `"rest""` | 0 |
| **sse** | `"sse""` | 1 |
| **kafka** | `"kafka""` | 2 |
| **agent** | `"agent""` | 3 |
##### status Enum Property
*Property Definition* : Execution status.*Enum Options*
| Name | Value | Index |
| ---- | ----- | ----- |
| **success** | `"success""` | 0 |
| **error** | `"error""` | 1 |
| **timeout** | `"timeout""` | 2 |
### Sys_toolCatalog resource
*Resource Definition* : Cached tool catalog discovered from project services. Refreshed periodically.
*Sys_toolCatalog Resource Properties*
| Name | Type | Required | Default | Definition |
| ---- | ---- | -------- | ------- | ---------- |
| **toolName** | String | | | *Full tool name (e.g., service:apiName).* |
| **serviceName** | String | | | *Source service name.* |
| **description** | Text | | | *Tool description.* |
| **parameters** | Object | | | *JSON Schema of tool parameters.* |
| **lastRefreshed** | Date | | | *When this tool was last discovered/refreshed.* |
## Business Api
### `Get Agentoverride` API
**[Default get API]** — This is the designated default `get` API for the `sys_agentOverride` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `getAgentOverride` API REST controller can be triggered via the following route:
`/v1/agentoverride/:sys_agentOverrideId`
**Rest Request Parameters**
The `getAgentOverride` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_agentOverrideId | ID | true | request.params?.["sys_agentOverrideId"] |
**sys_agentOverrideId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/agentoverride/:sys_agentOverrideId**
```js
axios({
method: 'GET',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `List Agentoverrides` API
**[Default list API]** — This is the designated default `list` API for the `sys_agentOverride` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `listAgentOverrides` API REST controller can be triggered via the following route:
`/v1/agentoverrides`
**Rest Request Parameters**
The `listAgentOverrides` api has got no request parameters.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/agentoverrides**
```js
axios({
method: 'GET',
url: '/v1/agentoverrides',
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverrides",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_agentOverrides": [
{
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Update Agentoverride` API
**[Default update API]** — This is the designated default `update` API for the `sys_agentOverride` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `updateAgentOverride` API REST controller can be triggered via the following route:
`/v1/agentoverride/:sys_agentOverrideId`
**Rest Request Parameters**
The `updateAgentOverride` api has got 10 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_agentOverrideId | ID | true | request.params?.["sys_agentOverrideId"] |
| provider | String | | request.body?.["provider"] |
| model | String | | request.body?.["model"] |
| systemPrompt | Text | | request.body?.["systemPrompt"] |
| temperature | Double | | request.body?.["temperature"] |
| maxTokens | Integer | | request.body?.["maxTokens"] |
| responseFormat | String | | request.body?.["responseFormat"] |
| selectedTools | Object | | request.body?.["selectedTools"] |
| guardrails | Object | | request.body?.["guardrails"] |
| enabled | Boolean | | request.body?.["enabled"] |
**sys_agentOverrideId** : This id paremeter is used to select the required data object that will be updated
**provider** : Override AI provider (e.g., openai, anthropic).
**model** : Override model name.
**systemPrompt** : Override system prompt.
**temperature** : Override temperature (0-2).
**maxTokens** : Override max tokens.
**responseFormat** : Override response format (text/json).
**selectedTools** : Array of tool names from the catalog that this agent can use.
**guardrails** : Override guardrails: { maxToolCalls, timeout, maxTokenBudget }.
**enabled** : Enable or disable this agent.
**REST Request**
To access the api you can use the **REST** controller with the path **PATCH /v1/agentoverride/:sys_agentOverrideId**
```js
axios({
method: 'PATCH',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
provider:"String",
model:"String",
systemPrompt:"Text",
temperature:"Double",
maxTokens:"Integer",
responseFormat:"String",
selectedTools:"Object",
guardrails:"Object",
enabled:"Boolean",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "PATCH",
"action": "update",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Create Agentoverride` API
**[Default create API]** — This is the designated default `create` API for the `sys_agentOverride` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `createAgentOverride` API REST controller can be triggered via the following route:
`/v1/agentoverride`
**Rest Request Parameters**
The `createAgentOverride` api has got 9 regular request parameters
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| agentName | String | true | request.body?.["agentName"] |
| provider | String | false | request.body?.["provider"] |
| model | String | false | request.body?.["model"] |
| systemPrompt | Text | false | request.body?.["systemPrompt"] |
| temperature | Double | false | request.body?.["temperature"] |
| maxTokens | Integer | false | request.body?.["maxTokens"] |
| responseFormat | String | false | request.body?.["responseFormat"] |
| selectedTools | Object | false | request.body?.["selectedTools"] |
| guardrails | Object | false | request.body?.["guardrails"] |
**agentName** : Design-time agent name this override applies to.
**provider** : Override AI provider (e.g., openai, anthropic).
**model** : Override model name.
**systemPrompt** : Override system prompt.
**temperature** : Override temperature (0-2).
**maxTokens** : Override max tokens.
**responseFormat** : Override response format (text/json).
**selectedTools** : Array of tool names from the catalog that this agent can use.
**guardrails** : Override guardrails: { maxToolCalls, timeout, maxTokenBudget }.
**REST Request**
To access the api you can use the **REST** controller with the path **POST /v1/agentoverride**
```js
axios({
method: 'POST',
url: '/v1/agentoverride',
data: {
agentName:"String",
provider:"String",
model:"String",
systemPrompt:"Text",
temperature:"Double",
maxTokens:"Integer",
responseFormat:"String",
selectedTools:"Object",
guardrails:"Object",
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "201",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "POST",
"action": "create",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `Delete Agentoverride` API
**[Default delete API]** — This is the designated default `delete` API for the `sys_agentOverride` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `deleteAgentOverride` API REST controller can be triggered via the following route:
`/v1/agentoverride/:sys_agentOverrideId`
**Rest Request Parameters**
The `deleteAgentOverride` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_agentOverrideId | ID | true | request.params?.["sys_agentOverrideId"] |
**sys_agentOverrideId** : This id paremeter is used to select the required data object that will be deleted
**REST Request**
To access the api you can use the **REST** controller with the path **DELETE /v1/agentoverride/:sys_agentOverrideId**
```js
axios({
method: 'DELETE',
url: `/v1/agentoverride/${sys_agentOverrideId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_agentOverride",
"method": "DELETE",
"action": "delete",
"appVersion": "Version",
"rowCount": 1,
"sys_agentOverride": {
"id": "ID",
"agentName": "String",
"provider": "String",
"model": "String",
"systemPrompt": "Text",
"temperature": "Double",
"maxTokens": "Integer",
"responseFormat": "String",
"selectedTools": "Object",
"guardrails": "Object",
"enabled": "Boolean",
"updatedBy": "ID",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": false
}
}
```
### `List Toolcatalog` API
**[Default list API]** — This is the designated default `list` API for the `sys_toolCatalog` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `listToolCatalog` API REST controller can be triggered via the following route:
`/v1/toolcatalog`
**Rest Request Parameters**
**Filter Parameters**
The `listToolCatalog` api supports 1 optional filter parameter for filtering list results:
**serviceName** (`String`): Source service name.
- Single (partial match, case-insensitive): `?serviceName=`
- Multiple: `?serviceName=&serviceName=`
- Null: `?serviceName=null`
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/toolcatalog**
```js
axios({
method: 'GET',
url: '/v1/toolcatalog',
data: {
},
params: {
// Filter parameters (see Filter Parameters section above)
// serviceName: '' // Filter by serviceName
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_toolCatalogs",
"method": "GET",
"action": "list",
"appVersion": "Version",
"rowCount": "\"Number\"",
"sys_toolCatalogs": [
{
"id": "ID",
"toolName": "String",
"serviceName": "String",
"description": "Text",
"parameters": "Object",
"lastRefreshed": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
},
{},
{}
],
"paging": {
"pageNumber": "Number",
"pageRowCount": "NUmber",
"totalRowCount": "Number",
"pageCount": "Number"
},
"filters": [],
"uiPermissions": []
}
```
### `Get Toolcatalogentry` API
**[Default get API]** — This is the designated default `get` API for the `sys_toolCatalog` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `getToolCatalogEntry` API REST controller can be triggered via the following route:
`/v1/toolcatalogentry/:sys_toolCatalogId`
**Rest Request Parameters**
The `getToolCatalogEntry` api has got 1 regular request parameter
| Parameter | Type | Required | Population |
| ---------------------- | ---------------------- | -------- | ---------------------------- |
| sys_toolCatalogId | ID | true | request.params?.["sys_toolCatalogId"] |
**sys_toolCatalogId** : This id paremeter is used to query the required data object.
**REST Request**
To access the api you can use the **REST** controller with the path **GET /v1/toolcatalogentry/:sys_toolCatalogId**
```js
axios({
method: 'GET',
url: `/v1/toolcatalogentry/${sys_toolCatalogId}`,
data: {
},
params: {
}
});
```
**REST Response**
```json
{
"status": "OK",
"statusCode": "200",
"elapsedMs": 126,
"ssoTime": 120,
"source": "db",
"cacheKey": "hexCode",
"userId": "ID",
"sessionId": "ID",
"requestId": "ID",
"dataName": "sys_toolCatalog",
"method": "GET",
"action": "get",
"appVersion": "Version",
"rowCount": 1,
"sys_toolCatalog": {
"id": "ID",
"toolName": "String",
"serviceName": "String",
"description": "Text",
"parameters": "Object",
"lastRefreshed": "Date",
"recordVersion": "Integer",
"createdAt": "Date",
"updatedAt": "Date",
"_owner": "ID",
"isActive": true
}
}
```
### `List Agentexecutions` API
**[Default list API]** — This is the designated default `list` API for the `sys_agentExecution` data object. Frontend generators and AI agents should use this API for standard CRUD operations.
**Rest Route**
The `listAgentExecutions` API REST controller can be triggered via the following route:
`/v1/agentexecutions`
**Rest Request Parameters**
**Filter Parameters**
The `listAgentExecutions` api supports 5 optional filter parameters for filtering list results:
**agentName** (`String`): Agent that was executed.
- Single (partial match, case-insensitive): `?agentName=`
- Multiple: `?agentName=&agentName=`
- Null: `?agentName=null`
**agentType** (`Enum`): Whether this was a design-time or dynamic agent.
- Single: `?agentType=` (case-insensitive)
- Multiple: `?agentType=&agentType=`
- Null: `?agentType=null`
**source** (`Enum`): How the agent was triggered.
- Single: `?source=` (case-insensitive)
- Multiple: `?source=&source=