RestocksAIO Docs

Scrap Prices

Overview

The Scrap Prices API allows users to queue requests for scraping prices and retrieve the results of those requests. This API uses a two-step process: first queueing a request, then checking the status and retrieving results.

Authentication

All requests to the API require authentication using a license key and UID.

{
  "LicenseKey": "your-license-key",
  "UID": "your-uid"
}

Endpoints

1. Queue a Scrap Prices Request

Endpoint: POST /api/scrap_prices/queue

Request Body:

{
  "Authorization": {
    "LicenseKey": "your-license-key",
    "UID": "your-uid"
  },
  "Data": {
    "Sku": "product-sku",
    "SellingSites": [
      {
        // Selling site details
      }
    ]
  }
}

Response:

{
  "RequestId": "unique-request-id",
  "RequestStatus": 0  // 0 represents Pending status
}

Description: This endpoint queues a new request for scraping prices. The server generates a unique RequestId which can be used to check the status of the request later.

2. Check Request Status

Endpoint: GET /api/scrap_prices/{requestId}

Parameters:

  • requestId: The unique identifier returned when queueing the request

Response:

For a pending request:

{
  "RequestId": "unique-request-id",
  "RequestStatus": 0  // 0 represents Pending status
}

For a completed request:

{
  "RequestId": "unique-request-id",
  "RequestStatus": 2,  // 2 represents Completed status
  "Data": {
    // Scraped price data
  }
}

Description: This endpoint allows you to check the status of a previously queued request. If the request is completed, it will also return the scraped price data.

Request Lifecycle

  1. Requests are initially queued with a "Pending" status.
  2. Requests timeout after 5 minutes if not processed, changing to "Failed" status.
  3. Completed or failed requests are removed from the system after 5 minutes.

Status Codes

  • 0: Pending
  • 1: Failed
  • 2: Completed

Error Handling

  • If authentication fails, the API will return a 401 Unauthorized status.
  • The API will return a 400 Bad Request status if the request payload is invalid.
  • The API will return a 404 Not Found status if a request is not found.