跳到主要内容

OpenWES API Documentation

🔐 Authentication

All API requests must include an authentication token in the header:

Authorization: Bearer <your_access_token>

Token Format

  • JWT (JSON Web Token)
  • Expires after 24 hours
  • Must be included in all API requests

Authentication Errors

Status CodeDescriptionSolution
401Invalid tokenRefresh your token or log in again
403Insufficient permissionsContact administrator for required permissions
419Token expiredGet a new token using refresh token

🌐 Base Information

Base URL: https://api.warehouse.example.com/v1
Endpoint: POST /execute
Content-Type: application/json

📝 Request Format

Common Headers

Content-Type: application/json
Authorization: Bearer <your_access_token>
X-Request-ID: <unique_request_id>

Common Parameters

ParameterTypeRequiredDescription
apiTypeStringAPI type identifier
bodyJSONRequest body (varies by apiType)

📦 Available APIs

SKU Management


SKU_CREATE

Creates a new SKU (Stock Keeping Unit)

🔒 Required Permissions: sku.create

Request Body Schema:

{
"skuCode": "string",
"skuName": "string",
"attributes": {
"weight": "number",
"dimensions": {
"length": "number",
"width": "number",
"height": "number"
},
"category": "string",
"specifications": {
"color": "string",
"size": "string"
}
}
}

Success Response:

{
"success": true,
"code": "200",
"message": "SKU created successfully",
"data": {
"skuId": "string",
"createdAt": "datetime"
}
}

🔄 Response Format

All APIs return responses in the following format:

{
"success": boolean,
"code": "string",
"message": "string",
"data": object,
"requestId": "string",
"timestamp": "datetime"
}

⚠️ Error Handling

Common Error Codes

CodeStatusDescription
200SuccessRequest processed successfully
400Bad RequestInvalid parameters or request body
401UnauthorizedMissing or invalid authentication
403ForbiddenInsufficient permissions
404Not FoundResource not found
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer-side error

Error Response Example

{
"success": false,
"code": "400",
"message": "Invalid request parameters",
"errors": [
{
"field": "skuCode",
"message": "SKU code cannot be empty"
}
],
"requestId": "req-123456",
"timestamp": "2024-02-11T10:30:00Z"
}

📚 Best Practices

  1. Always include a unique X-Request-ID in headers for request tracking
  2. Handle token expiration by implementing refresh token logic
  3. Implement exponential backoff for failed requests
  4. Cache frequently used data to minimize API calls
  5. Use appropriate HTTP methods for different operations