API Documentation
7/24/2024, 9:25:05 AM

Seller API Documentation - Product State Management

Overview

These API endpoints allow sellers to enable and disable their products, controlling their visibility in the marketplace.

Authentication

All requests require authentication using your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Disable Product

Endpoint: POST /api/product/disable

Description: Removes a product from the marketplace by changing its state from AVAILABLE to OFF_MARKET. The product will no longer be visible to buyers in search results.

Request

{   "id": "product_id_here" }

Response

Success (200):

{   "message": "Product disabled successfully",   "productId": "product_id_here",   "newState": "OFF_MARKET" }

Error Responses:

401 UNAUTHORIZED // Missing or invalid API key
400 PRODUCT_ID_NOT_FOUND // Product ID not provided
403 PRODUCT_NOT_FOUND // Product doesn't exist or doesn't belong to you
400 PRODUCT_NOT_AVAILABLE // Product is not currently available (already disabled or in another state)

Example

curl -X POST <https://api.igitems.com/api/product/disable> \   -H "Authorization: Bearer YOUR_API_KEY" \   -H "Content-Type: application/json" \   -d '{"id": "abc123def456"}'

Enable Product

Endpoint: POST /api/product/enable

Description: Makes a product available in the marketplace by changing its state from OFF_MARKET to AVAILABLE. The product will become visible to buyers in search results.

Request

{   "id": "product_id_here" }

Response

Success (200):

{   "message": "Product enabled successfully",   "productId": "product_id_here",   "newState": "AVAILABLE" }

Error Responses:

401 UNAUTHORIZED // Missing or invalid API key
400 PRODUCT_ID_NOT_FOUND // Product ID not provided
403 PRODUCT_NOT_FOUND // Product doesn't exist or doesn't belong to you
400 PRODUCT_NOT_OFF_MARKET // Product is not currently disabled (already available or in another state)

Example

curl -X POST <https://api.igitems.com/api/product/enable> \   -H "Authorization: Bearer YOUR_API_KEY" \   -H "Content-Type: application/json" \   -d '{"id": "abc123def456"}'

Product States

AVAILABLE // Product is visible and purchasable by buyers
OFF_MARKET // Product is hidden from buyers but not deleted
SOLD // Product has been purchased (cannot be manually changed)
ARCHIVE // Product is archived (cannot be manually changed)
SUSPENDED // Product is suspended by admin (cannot be manually changed)

Important Notes

  1. State Validation: You can only disable products that are currently AVAILABLE and enable products that are currently OFF_MARKET.

  2. Search Index: When you disable a product, it's automatically removed from search results. When you enable it, it's automatically added back.

  3. Bulk Operations: To manage multiple products, make separate API calls for each product.

  4. Rate Limiting: Please be mindful of API rate limits when making multiple requests.

  5. Product Ownership: You can only manage products that belong to your seller account.

Use Cases

  • Temporary Unavailability: Disable products when you're temporarily unable to fulfill orders

  • Inventory Management: Disable products when out of stock, enable when restocked

  • Seasonal Products: Enable/disable products based on seasonal availability

  • Maintenance: Disable products while updating descriptions or images

Getting Your Product IDs

Use the existing /api/product/all endpoint to retrieve all your products and their IDs:

curl -X POST <https://api.igitems.com/api/product/all> \   -H "Authorization: Bearer YOUR_API_KEY" \   -H "Content-Type: application/json"

This will return an array of all your products with their IDs and current states.

Related Articles
You might also be interested in these articles
3 articles
Did this answer your question?