Enspace
    Enspace
    • Introduction
    • Authentication
    • Concepts
    • First Steps
    • Workspaces
      • Types
        • Fields
          • List Fields
          • Create Field
          • Get Field
          • Field Updated
          • Delete Field
        • Items
          • List Items
          • Create Item
          • Count Items
          • Get Item
          • Update Item
          • Delete item
        • List Types
        • Count Types
        • Get specific Type
        • Create Type
        • Update Type
        • Delete Type
      • Members
        • List Members
        • Count Members
        • Get Member
        • New Member
        • Update Member
        • Remove Member
      • Roles
        • List roles
        • Create role
        • Get specific job title
        • Count positions
        • Update job title
        • Delete role
        • List Role Permissions
        • Add Permission to Role
        • Remove Role Permission
      • Member Groups
        • List groups
        • New group
        • Get group
        • Update group
        • Delete group
        • Add Users
        • Remove Users
      • List Workspaces
        GET
      • Workspace Context
        GET
      • New Workspace
        POST
      • Leave the workspace
        POST
      • Workspace Statistics
        GET
      • Workspace Deletion Preview
        GET
      • Delete Workspace
        DELETE
    • User
      • Audit Logs
        GET
      • List API Keys
        GET

    First Steps

    ā–¶ļø Getting Started#

    Let's create your first integration with the ENSPACE API! This tutorial will guide you through the basic concepts with practical examples.

    šŸŽÆ What will we build?#

    We will create a simple product catalog that demonstrates the main concepts:
    1.
    āœ… Set up authentication
    2.
    āœ… Create a "Product" Type
    3.
    āœ… Add Fields to the Type
    4.
    āœ… Create some Items (products)
    5.
    āœ… List and search products

    šŸ“‹ Prerequisites#

    āœ… API token generated (see how)
    āœ… Workspace ID
    āœ… Tool to make requests (Postman, cURL, etc.)

    Base Configuration#

    ENSPACE_API_KEY=en.ushcHQHcREdPpe3ZKFCSfAASFE5VawTwTH
    ENSPACE_API_URL=https://api.leif.enspace.io
    ENSPACE_WORKSPACE_ID=ws-123

    šŸ”§ Step 1: Test Authentication#

    First, let's confirm that our authentication is working:
    Expected response:
    [
      // List of existing types (may be empty)
    ]
    āœ… Success! If you received an array (even empty), the authentication is working.
    āŒ Error? Check the following:
    The token is correct
    The workspace ID is correct
    Headers are being sent properly

    šŸ“Š Step 2: Create a "Product" Type#

    Let's create our first data model:
    Response:
    {
      "id": 1,
      "slug": "product",
      "name": "Product",
      "description": "Company product catalog",
      "active": true,
      "created_at": "2024-01-15T10:30:00Z",
      "updated_at": "2024-01-15T10:30:00Z",
      "workspace": {
        "id": "ws-123",
        "name": "You Workspace"
      }
    }
    šŸŽ‰ Great! Our Type was successfully created.

    šŸ·ļø Step 3: Add Fields#

    Now let's add fields to our Type:

    Field: Product Name#

    Field: Price#

    Field: Types#

    Field: Available#

    āœ… Excellent! We now have a complete Type with 4 fields.

    šŸ“„ Step 4: Create Items (Products)#

    Let's add some products to our catalog:

    Product 1: iPhone 15#

    Product 2: T-shirt#

    Product: Office Desk#

    šŸ›ļø Perfect! We have 3 products in our catalog.

    šŸ“‹ Step 5: List and Search Products#

    List all products#

    Response:
    [
      {
        "id": 1,
        "reference": "PROD-001",
        "status": "active",
        "data": {
          "product_name": "iPhone 15",
          "price": 4999.99,
          "type": "electronics",
          "available": true
        },
        "type": {
          "id": 1,
          "slug": "product",
          "name": "Product"
        },
        "created_at": "2024-01-15T10:30:00Z",
        "updated_at": "2024-01-15T10:30:00Z"
      },
      // ... others products
    ]

    Search for a specific product#

    List with pagination and sorting#

    Count total products#

    Response: 3

    šŸ”„ Step 6: Update a Product#

    Let's mark the table as available:
    šŸ’” Tip: You only need to send the fields you want to update!

    šŸŽÆ Complete Example in JavaScript#

    Here is a full example of how to use the API in JavaScript:

    šŸŽ‰ Congratulations!#

    You have just created your first integration with the ENSPACE API!

    What you learned:#

    āœ… Authentication - How to use tokens and required headers
    āœ… Types - How to create custom data models
    āœ… Fields - How to define the structure of your data
    āœ… Items - How to create, list, search, and update data
    āœ… Pagination - How to navigate large datasets

    šŸš€ Next Steps#

    1.
    Explore Members - Manage workspace users
    2.
    Work with Roles - Configure permissions
    3.
    API Reference - Explore all available endpoints
    4.
    Webhooks - Set up real-time integrations
    5.
    SDKs - Use our official libraries

    šŸ’” Advanced Tips#

    Custom Filters#

    Specific fields#

    Text search#

    Congratulations on making it this far! You now have a solid foundation for using the ENSPACE API. šŸš€
    Previous
    Concepts
    Next
    Workspaces
    Built with