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:
    Resposta:
    {
      "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#

    Campo: Preço#

    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#

    Produto 2: Camiseta#

    Produto 3: 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": {
          "nome": "iPhone 15",
          "preco": 4999.99,
          "categoria": "electronics",
          "disponivel": 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. 🚀
    Página anterior
    Concepts
    Próxima página
    Workspaces
    Built with