Creating and Managing Data Systems

Creating a New Data System

To create a new data system, follow these steps:

API Request

Endpoint: POST /api/data/data_system

Request Body:

{
  "entity": {
    "name": "Data System example",
    "entity_type": "data_system",
    "label": "DSS",
    "description": "Example of data system",
    "owner_person": {
      "email": "[email protected]",
      "full_name": "System Administrator"
    }
  },
  "entity_info": {
    "owner": "[email protected]",
    "contact_ids": [
      "Data System contact"
    ],
    "links": [
      "example.com"
    ]
  }
}

Required Headers

Remember to include the necessary headers:

Authorization: Bearer {your_access_token}
x-org: {your_organization_name}

Key Fields Explanation

  • name: Must be unique across your organization's meshes

  • entity_type: Always "data_system" for this endpoint

  • label: Short identification code (typically 3 letters)

  • owner_person: The person responsible for this data system

  • entity_info: Contains contact information for the person/team responsible for this entity, which can be used to contact them if issues occur with the data system

Response

Upon successful creation, the API returns a response containing the data system details:

{
  "identifier": "79ba411c-1be9-495f-833f-c1353227ad8c",
  "urn": "urn:meshx:backend:data:root:data_system:79ba411c-1be9-495f-833f-c1353227ad8c",
  "name": "Data System example",
  "is_system": false,
  "description": "Example of data system",
  "label": "DSS",
  "created_at": "2025-04-10T11:31:00.558599Z",
  "state": {
    "code": "000",
    "reason": "Created.",
    "healthy": true
  },
  "owner_person": {
    "email": "[email protected]",
    "full_name": "System Administrator"
  }
}

Important: Store the identifier from the response for future operations with this data system.

Python Example

Here's a complete Python example for creating a data system:

import requests

def create_data_system(name, description, owner_email="[email protected]", owner_name="System Administrator"):
    """
    Create a new data system
    
    Args:
        name (str): Unique name for the data system
        description (str): Description of the data system
        owner_email (str): Email of the system owner
        owner_name (str): Full name of the system owner
    
    Returns:
        dict: Data system details if successful, None otherwise
    """
    data_system_resp = requests.post(
        f"{API_URL}/data/data_system",
        headers=get_headers(),  # This function should return headers with Authorization and x-org
        json={
            "entity": {
                "name": name,
                "entity_type": "data_system",
                "label": name[:3].upper(),  # Use first 3 letters as label
                "description": description,
                "owner_person": {
                    "email": owner_email,
                    "full_name": owner_name
                }
            },
            "entity_info": {
                "owner": owner_email,
                "contact_ids": [
                    f"{name} contact"
                ],
                "links": [
                    "example.com"
                ]
            }
        }
    )
    
    # Check response status
    if data_system_resp.status_code == 200:
        data_system_data = data_system_resp.json()
        print(f"Data system created successfully with ID: {data_system_data['identifier']}")
        return data_system_data
    else:
        print(f"Error creating data system: {data_system_resp.text}")
        return None

# Example usage
system_data = create_data_system(
    name="Customer Analytics System",
    description="System for managing customer-related data sources"
)

Managing Existing Data Systems

Once you have created data systems, you can perform various management operations:

List All Data Systems

GET /api/data/data_system/list

Get Specific Data System

GET /api/data/data_system?identifier={data_system_id}

Update Data System

PUT /api/data/data_system?identifier={data_system_id}

Delete Data System

DELETE /api/data/data_system?identifier={data_system_id}

Last updated