• Home
  • Integration System

System Integration

Documentation for integrating with our products API. This page provides comprehensive information about the products synchronization endpoint.

Download catalogue as CSV

Get all products from the catalogue in CSV format (according to the current language) for integration with your system.

Products Synchronization API

Endpoint
GET https://www.combatzonetactical.com/api/products/sync-products
Description

This endpoint returns a complete list of all products available in our system, including their names, descriptions, reference codes, prices, and stock levels.

Response Format

The API returns a JSON array containing product objects with the following structure:

[
                        {
                          "productName": "Extensión para cargador de gas Raccoon - RCT002",
                          "productDescription": "",
                          "referenceCode": "5382",
                          "msrp": 2.7,
                          "stock": 0
                        },
                        {
                          "productName": "OF PARACORD BRACELET Cierre Acero BK",
                          "productDescription": "",
                          "referenceCode": "5140",
                          "msrp": 0,
                          "stock": 57
                        }
                      ]
                    
Response Parameters
FieldTypeDescription
productNamestringThe name of the product
productDescriptionstringDetailed description of the product (may be empty)
referenceCodestringUnique product reference code
msrpnumberManufacturer's Suggested Retail Price (0 if not available)
stocknumberCurrent stock quantity
Usage Examples

Here are some examples of how to use this API endpoint:

// JavaScript/TypeScript
fetch('https://www.combatzonetactical.com/api/products/sync-products')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// cURL
curl -X GET "https://www.combatzonetactical.com/api/products/sync-products" \
  -H "Content-Type: application/json"
Important Notes
  • This endpoint does not require authentication
  • The response is cached for performance optimization
  • Stock levels are updated in real-time

Add to Cart API

Endpoint
POST https://www.combatzonetactical.com/api/cart/add
Description

This endpoint allows you to add products to a customer's shopping cart. It requires authentication and returns detailed information about the cart item and total.

Request Body

The request must include the following parameters:

{
  "productId": "5382",
  "quantity": 2,
  "customerId": "customer123"
}
Request Parameters
FieldTypeDescription
productIdstringThe unique identifier of the product to add to cart
quantitynumberThe quantity of the product to add (must be a positive integer)
customerIdstringThe unique identifier of the customer
Response Format

The API returns a JSON object with the following structure:

{
  "success": true,
  "message": "Product added to cart successfully",
  "cartItem": {
    "id": "cart_item_123",
    "productId": "5382",
    "quantity": 2,
    "price": 5.4,
    "total": 10.8
  },
  "cartTotal": 10.8
}
Usage Examples

Here are some examples of how to use the Add to Cart API:

// JavaScript/TypeScript
const addToCart = async (productId, quantity, customerId) => {
  try {
    const response = await fetch('https://www.combatzonetactical.com/api/cart/add', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': 'Bearer YOUR_TOKEN'
      },
      body: JSON.stringify({
        productId,
        quantity,
        customerId
      })
    });
    
    const result = await response.json();
    console.log('Product added to cart:', result);
  } catch (error) {
    console.error('Error adding to cart:', error);
  }
};

// cURL
curl -X POST "https://www.combatzonetactical.com/api/cart/add" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "productId": "5382",
    "quantity": 2,
    "customerId": "customer123"
  }'
Important Notes
  • This endpoint requires authentication with a valid Bearer token
  • The customer must exist in the system before adding items to cart
  • Product availability is checked before adding to cart
  • Cart totals are calculated automatically including taxes and shipping

Authentication API

Endpoint
POST https://www.combatzonetactical.com/api/auth/login
Description

This endpoint authenticates users and returns a JWT token for accessing protected resources. The token must be included in subsequent API requests.

Request Body

The request must include the following parameters:

{
  "email": "customer@example.com",
  "password": "your_password"
}
Request Parameters
FieldTypeDescription
emailstringThe user's email address (must be valid email format)
passwordstringThe user's password (minimum 6 characters)
Response Format

The API returns a JSON object with authentication details:

{
  "success": true,
  "message": "Login successful",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": "customer123",
    "email": "customer@example.com",
    "name": "John Doe",
    "role": "customer"
  },
  "expiresIn": 3600
}
Usage Examples

Here are some examples of how to use the Authentication API:

// JavaScript/TypeScript
const login = async (email, password) => {
  try {
    const response = await fetch('https://www.combatzonetactical.com/api/auth/login', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        email,
        password
      })
    });
    
    const result = await response.json();
    
    if (result.success) {
      // Store token for future requests
      localStorage.setItem('authToken', result.token);
      console.log('Login successful:', result.user);
    } else {
      console.error('Login failed:', result.message);
    }
  } catch (error) {
    console.error('Error during login:', error);
  }
};

// cURL
curl -X POST "https://www.combatzonetactical.com/api/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "customer@example.com",
    "password": "your_password"
  }'
Important Notes
  • The JWT token expires after the specified time (expiresIn)
  • Store the token securely for future authenticated requests
  • Include the token in the Authorization header: 'Bearer YOUR_TOKEN'
  • Invalid credentials will return a 401 Unauthorized response

Get Cart API

Endpoint
GET https://www.combatzonetactical.com/api/cart
Description

This endpoint retrieves the current shopping cart for the authenticated customer. It returns all cart items with detailed information including prices, quantities, and totals.

Required Headers

The request must include the following header for authentication:

Authorization: Bearer YOUR_JWT_TOKEN
Response Format

The API returns a JSON object with the complete cart information:

{
  "success": true,
  "cart": {
    "id": "cart_123",
    "customerId": "customer123",
    "items": [
      {
        "id": "cart_item_123",
        "productId": "5382",
        "productName": "Extensión para cargador de gas Raccoon - RCT002",
        "quantity": 2,
        "unitPrice": 2.7,
        "totalPrice": 5.4,
        "addedAt": "2024-01-15T10:30:00Z"
      },
      {
        "id": "cart_item_124",
        "productId": "5140",
        "productName": "OF PARACORD BRACELET Cierre Acero BK",
        "quantity": 1,
        "unitPrice": 0,
        "totalPrice": 0,
        "addedAt": "2024-01-15T11:15:00Z"
      }
    ],
    "subtotal": 5.4,
    "taxes": 1.08,
    "shipping": 5.0,
    "total": 11.48,
    "itemCount": 3,
    "lastUpdated": "2024-01-15T11:15:00Z"
  }
}
Response Parameters
FieldTypeDescription
cart.idstringUnique identifier of the shopping cart
cart.customerIdstringUnique identifier of the customer who owns the cart
cart.itemsarrayArray of cart items with product details and quantities
cart.subtotalnumberTotal price of all items before taxes and shipping
cart.totalnumberFinal total including taxes and shipping
Usage Examples

Here are some examples of how to use the Get Cart API:

// JavaScript/TypeScript
const getCart = async (token) => {
  try {
    const response = await fetch('https://www.combatzonetactical.com/api/cart', {
      method: 'GET',
      headers: {
        'Authorization': `Bearer ${token}`,
        'Content-Type': 'application/json'
      }
    });
    
    if (response.ok) {
      const result = await response.json();
      console.log('Cart retrieved:', result.cart);
      return result.cart;
    } else {
      console.error('Failed to get cart:', response.status);
    }
  } catch (error) {
    console.error('Error getting cart:', error);
  }
};

// Usage
const token = localStorage.getItem('authToken');
const cart = await getCart(token);

// cURL
curl -X GET "https://www.combatzonetactical.com/api/cart" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -H "Content-Type: application/json"
Important Notes
  • This endpoint requires a valid JWT token in the Authorization header
  • Returns an empty cart if the customer has no items
  • Cart data is updated in real-time and reflects current stock availability
  • Expired or invalid tokens will return a 401 Unauthorized response