Products API

Base URL

All URLs referenced in the documentation have the following base:

https://api.meetandrock.com/v1/dev

Product Management

Endpoints for managing products

List Products

Retrieve products for the project with pagination and search

curl -X GET "https://api.meetandrock.com/v1/dev/products?page=1&limit=10&search=widget&status=active&category=Electronics" \
  -H "Authorization: Bearer YOUR_API_KEY"

Query Parameters:
- page: Page number (default: 1)
- limit: Number of items per page (default: 10)
- search: Search term to filter by name, description, SKU, or category
- status: Filter by status (active, inactive, discontinued)
- category: Filter by category

Response:
{
  "data": [
    {
      "id": "uuid",
      "name": "string",
      "description": "string",
      "price": "number",
      "units_in_stock": "number",
      "sku": "string",
      "category": "string",
      "status": "active|inactive|discontinued",
      "project_id": "uuid",
      "createdAt": "datetime",
      "updatedAt": "datetime",
      "images": [
        {
          "id": "uuid",
          "url": "string",
          "name": "string",
          "mimetype": "string"
        }
      ]
    }
  ],
  "pagination": {
    "total": 100,
    "page": 1,
    "limit": 10
  }
}

Search: The search parameter searches across product name, description, SKU, and category fields.

Pagination: Use page and limit parameters to control pagination. The response includes pagination metadata.

Create Product

Create a new product with optional images

curl -X POST "https://api.meetandrock.com/v1/dev/products" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "name=Premium Widget" \
  -F "description=High-quality widget for professional use" \
  -F "price=99.99" \
  -F "units_in_stock=100" \
  -F "sku=WID-001" \
  -F "category=Electronics" \
  -F "status=active" \
  -F "files=@/path/to/product-image1.jpg" \
  -F "files=@/path/to/product-image2.jpg"

Response:
{
  "data": {
    "id": "uuid",
    "name": "Premium Widget",
    "description": "High-quality widget for professional use",
    "price": 99.99,
    "units_in_stock": 100,
    "sku": "WID-001",
    "category": "Electronics",
    "status": "active",
    "images": [
      {
        "id": "uuid",
        "url": "https://...",
        "name": "product-image1.jpg",
        "mimetype": "image/jpeg"
      }
    ],
    "createdAt": "datetime",
    "updatedAt": "datetime"
  }
}

Required fields: name, price, units_in_stock

Optional fields: description, sku, category, status

Status values: active, inactive, discontinued

Images: You can upload multiple images using the "files" field. Supported formats: jpg, jpeg, png, gif, webp

Update Product

Update an existing product

curl -X PUT "https://api.meetandrock.com/v1/dev/products/:productId" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "name=Updated Product Name" \
  -F "price=129.99" \
  -F "units_in_stock=150" \
  -F "files=@/path/to/new-image.jpg"

Response:
{
  "data": {
    "id": "uuid",
    "name": "Updated Product Name",
    "price": 129.99,
    "units_in_stock": 150,
    "images": [
      {
        "id": "uuid",
        "url": "https://...",
        "name": "new-image.jpg"
      }
    ],
    ...
  }
}

Note: You can update any field. New images will be added to existing images.

Delete Product

Delete a product

curl -X DELETE "https://api.meetandrock.com/v1/dev/products/:productId" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response: 204 No Content

Error Responses

400 Bad Request
{
  "message": "Invalid request parameters"
}

400 Bad Request (Invalid file format)
{
  "message": "Invalid file format"
}

401 Unauthorized
{
  "message": "Invalid or missing API key"
}

404 Not Found
{
  "message": "Product not found"
}

500 Internal Server Error
{
  "message": "Something went wrong"
}

Contents