Pikbase Docs
Open console (opens the console)
Esc

Type to search.

API reference

getCommonPropertyDefs() — Schema Manager

Purpose : Retrieves available property data types in the system. When to use : Creating entity definitions Adding properties to entities Finding data ty…

Contract source@gsb-core/mcp-docs:getCommonPropertyDefs

General Description

The getCommonPropertyDefs operation retrieves the list of common property definitions available in the system.

Detailed Description

This operation returns a list of all common property definitions that can be used when defining entity properties. Property definitions represent the data types (like string, number, boolean, date, reference, etc.) that can be assigned to properties in entity definitions. Each property definition includes metadata about the data type, such as its name, description, and validation rules.

Input Parameters

Parameter Type Required Description
token string No Authentication token for your request. If not provided, the system will use the default API key from environment variables.
tenantCode string No Tenant code to specify which tenant's data to access. If not provided, the system will extract it from the token or use the default tenant code from environment variables.

Response

Success Response

{
    "success": true,
    "data": [
        {
            "id": "string",
            "dataType": number,
            "title": "string",
            "name": "string",
            "description": "string",
            "maxLength": number,
            "scale": number,
            "regex": "string",
            "usage": number,
            "createDate": "string",
            "lastUpdateDate": "string",
            "defaultControlComponent": {
                "title": "string",
                "id": "string"
            }
        }
    ]
}

Error Response

{
    "success": false,
    "error": "Error message describing what went wrong"
}

Example Usage

Get All Common Property Definitions

const result = await getCommonPropertyDefs({
  token: "your-auth-token"
});

if (result.success) {
  const propertyDefs = result.data;
  console.log("Available property definitions:", propertyDefs.length);
  
  // List all property definitions
  propertyDefs.forEach(def => {
    console.log(`- ${def.title} (ID: ${def.id}): ${def.description}`);
  });
} else {
  console.error("Error:", result.error);
}

Find a Specific Property Definition

const result = await getCommonPropertyDefs({
  token: "your-auth-token"
});

if (result.success) {
  // Find string property definition
  const stringDef = result.data.find(def => def.name === "String");
  if (stringDef) {
    console.log("String property definition ID:", stringDef.id);
    console.log("Description:", stringDef.description);
  }
  
  // Find reference property definition
  const refDef = result.data.find(def => def.name === "Reference");
  if (refDef) {
    console.log("Reference property definition ID:", refDef.id);
  }
} else {
  console.error("Error:", result.error);
}

Common Property Definition IDs

Here are the IDs of commonly used property definitions:

Type ID Description
String c6c34bf3-f51b-4e69-a689-b09847be74b9 Text string
Number 35efcf9c-fff0-44d4-8972-73a9a32b93fa Numeric value
Boolean 7868afdf-2709-45be-87e3-87de8d35f30f True/false value
DateTime 12e647e0-ebd2-4ec2-a4e3-82c1dfe07da2 Date and time
Reference 924acba8-58c5-4881-940d-472ec01eba5f Entity reference
Enum 7bf08f4f-7de0-469e-bbfb-f4c43762f4d7 Enumerated value
RichText e07f578e-2705-49c1-b97f-3ca5963c67c0 Rich text content
Email df7ce94b-d59c-4b67-8519-aa4c98ab477c Email address
Password 7291fbc2-a7cf-4713-a876-0cff085cc035 Password field

Additional Information

  • Property definitions represent the data types available for entity properties.
  • Each property definition has a unique ID that should be used when creating or updating entity properties.
  • The response includes metadata about each property definition, such as:
    • Data type information
    • Default validation rules
    • Maximum length (for string types)
    • Scale (for numeric types)
    • Default UI component for rendering
  • When creating entity definitions or adding properties, you'll need to reference these property definition IDs.
  • The list of available property definitions may vary based on system configuration and extensions.
  • Access permissions are enforced based on the provided token.