Products API

Products API allows you to manage products via API. Access to these endpoints requires a token with Editor role.

POST/api/v1/products

Create Product

Creates a new product and automatically indexes it for search.

Required Role

EDITOR or higher

Request Parameters

  • Name
    title
    Type
    string
    Description
    Product title
  • Name
    description
    Type
    string
    Description
    Product description
  • Name
    price
    Type
    string
    Description
    Price with currency (e.g.: "$19.90")
  • Name
    hidden
    Type
    boolean
    Description
    Hide from search (default: false)

Request

curl -X POST "https://api.parsewise.ru/v1/products" \
  -H "Authorization: Bearer pw_editor_token" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Nike Air Max 90",
    "description": "Classic sneakers...",
    "price": "$129.90"
  }'

Response (201 Created)

{
  "id": 123,
  "title": "Nike Air Max 90",
  "description": "Classic sneakers...",
  "price": "$129.90",
  "hidden": false,
  "shop_id": 1,
  "created_at": "2024-01-15T10:30:00Z"
}

POST/api/v1/products/bulk

Bulk Create

Creates up to 100 products in a single request. All products are automatically indexed.

Required Role

EDITOR or higher

Request Parameters

  • Name
    products
    Type
    array
    Description
    Array of products (max 100)

Response

  • Name
    created_count
    Type
    integer
    Description
    Number of created products
  • Name
    created_ids
    Type
    array
    Description
    IDs of created products
  • Name
    errors
    Type
    array
    Description
    Errors (if any)

Request

curl -X POST "https://api.parsewise.ru/v1/products/bulk" \
  -H "Authorization: Bearer pw_editor_token" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      {"title": "Product 1", "price": "$10"},
      {"title": "Product 2", "price": "$20"},
      {"title": "Product 3", "price": "$30"}
    ]
  }'

Response (201 Created)

{
  "created_count": 3,
  "created_ids": [124, 125, 126],
  "errors": []
}

PUT/api/v1/products/{product_id}

Update Product

Updates an existing product. Automatically triggers reindexing.

Required Role

EDITOR or higher

URL Parameters

  • Name
    product_id
    Type
    integer
    Description
    Product ID

Request Parameters

Pass only the fields that need to be updated:
  • Name
    title
    Type
    string
    Description
    New title
  • Name
    description
    Type
    string
    Description
    New description
  • Name
    price
    Type
    string
    Description
    New price
  • Name
    hidden
    Type
    boolean
    Description
    Hide/show

Request

curl -X PUT "https://api.parsewise.ru/v1/products/123" \
  -H "Authorization: Bearer pw_editor_token" \
  -H "Content-Type: application/json" \
  -d '{
    "price": "$99.90",
    "description": "Updated description..."
  }'

Response

{
  "id": 123,
  "title": "Nike Air Max 90",
  "description": "Updated description...",
  "price": "$99.90",
  "hidden": false,
  "updated_at": "2024-01-15T11:00:00Z"
}

PUT/api/v1/products/bulk

Bulk Update

Updates up to 100 products in a single request. Each element must contain `id`.

Required Role

EDITOR or higher

Request Parameters

  • Name
    products
    Type
    array
    Description
    Array of objects with `id` and fields to update

Request

curl -X PUT "https://api.parsewise.ru/v1/products/bulk" \
  -H "Authorization: Bearer pw_editor_token" \
  -H "Content-Type: application/json" \
  -d '{
    "products": [
      {"id": 123, "price": "$89.90"},
      {"id": 124, "price": "$79.90"},
      {"id": 125, "hidden": true}
    ]
  }'

Response

{
  "updated_count": 3,
  "updated_ids": [123, 124, 125],
  "errors": []
}

DELETE/api/v1/products/{product_id}

Delete Product

Deletes product from database and search index.

Required Role

EDITOR or higher

URL Parameters

  • Name
    product_id
    Type
    integer
    Description
    Product ID

Request

curl -X DELETE "https://api.parsewise.ru/v1/products/123" \
  -H "Authorization: Bearer pw_editor_token"

Response

HTTP 204 No Content

DELETE/api/v1/products/bulk

Bulk Delete

Deletes up to 100 products in a single request.

Required Role

EDITOR or higher

Request Parameters

  • Name
    product_ids
    Type
    array
    Description
    Array of product IDs to delete

Request

curl -X DELETE "https://api.parsewise.ru/v1/products/bulk" \
  -H "Authorization: Bearer pw_editor_token" \
  -H "Content-Type: application/json" \
  -d '{"product_ids": [123, 124, 125]}'

Response

{
  "deleted_count": 3
}

Was this page helpful?