drkbcn/json_listings_feed
Composer 安装命令:
composer require drkbcn/json_listings_feed
包简介
Transform legacy Amazon XML feeds into the new JSON_LISTINGS_FEED format for SP-API.
README 文档
README
Transform your legacy Amazon XML feeds into the new JSON_LISTINGS_FEED format for SP-API. Free and Open Source!
🚀 Why this project?
Amazon is deprecating its legacy XML and flat-file feeds and migrating to the new JSON_LISTINGS_FEED format for SP-API. While the excellent jlevers/selling-partner-api library provides comprehensive SP-API access (and is completely free!), the author also created a separate commercial feed transformer tool by Highside Labs that charges $299-$899 per feed type to handle this migration.
At @labelgrupnetworks, we faced the same situation and needed a cost-effective solution, so we built this free and open-source transformer for the community.
✨ Features
- 🔄 Transform legacy Amazon XML to JSON_LISTINGS_FEED
- 🛒 Supports inventory, pricing, product, image, and relationship feeds
- 🧩 Direct integration with jlevers/selling-partner-api
- 🆓 100% Open Source and free
- 🏷️ Designed for migrations and automations
- 🛠️ Easy to use, no commercial dependencies
- 📦 Uses PATCH operations for optimal performance
📦 Installation
git clone https://github.com/drkbcn/json_listings_feed.git
cd json_listings_feed
composer install
Copy .env.example to .env and configure your Amazon SP-API credentials.
📝 Quick Usage
Basic Transformation
use Labelgrup\AmazonTransformer\Transformer; $transformer = new Transformer($sellerId, $marketplaceId); $json = $transformer->transformXmlToJson($xmlContent); echo $json;
Complete Workflow (Inventory Update)
use Labelgrup\AmazonTransformer\{AmazonXMLFunctions, Transformer}; use SellingPartnerApi\{FeedType, Api\FeedsV20210630Api}; // Generate XML (for compatibility with existing systems) $xmlBuilder = new AmazonXMLFunctions($sellerId); $messages = [$xmlBuilder->getQtyMessage($sku, $newQuantity)]; $xmlContent = $xmlBuilder->buildXmlInventoryData($messages); // Transform to JSON $transformer = new Transformer($sellerId, $marketplaceId); $jsonOutput = $transformer->transformXmlToJson($xmlContent); // Send to Amazon $feedsApi = new FeedsV20210630Api($config); // ... (see examples for complete implementation)
🧑💻 Migration Examples
Inventory Update
Old XML Format:
<AmazonEnvelope> <Header> <DocumentVersion>1.01</DocumentVersion> <MerchantIdentifier>A3UM3SGRVK155I</MerchantIdentifier> </Header> <MessageType>Inventory</MessageType> <Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Inventory> <SKU>B0182SJFQQ</SKU> <Quantity>5</Quantity> </Inventory> </Message> </AmazonEnvelope>
New JSON Format (Generated):
{
"header": {
"sellerId": "A3UM3SGRVK155I",
"version": "2.0",
"issueLocale": "es_ES"
},
"messages": [
{
"messageId": 1,
"sku": "B0182SJFQQ",
"operationType": "PATCH",
"productType": "PRODUCT",
"patches": [
{
"op": "replace",
"path": "/attributes/fulfillment_availability",
"value": [
{
"fulfillment_channel_code": "DEFAULT",
"quantity": 5
}
]
}
]
}
]
}
Price Update
Old XML Format:
<AmazonEnvelope> <MessageType>Price</MessageType> <Message> <MessageID>1</MessageID> <OperationType>Update</OperationType> <Price> <SKU>RS-7IGC-AFXK</SKU> <StandardPrice currency="EUR">18.78</StandardPrice> </Price> </Message> </AmazonEnvelope>
New JSON Format (Generated):
{
"messages": [
{
"messageId": 1,
"sku": "RS-7IGC-AFXK",
"operationType": "PATCH",
"productType": "PRODUCT",
"patches": [
{
"op": "replace",
"path": "/attributes/purchasable_offer",
"value": [
{
"audience": "ALL",
"currency": "EUR",
"our_price": [
{
"schedule": [
{
"value_with_tax": 18.78
}
]
}
]
}
]
}
]
}
]
}
🧪 Examples & Testing
Available Examples
examples/inventory.php— Complete inventory update workflowexamples/pricing.php— Complete pricing update workflow
Utility Scripts
check_feed.php— Monitor feed processing statuscheck_product.php— Get product information and pricing details
Running Examples
# Update inventory php examples/inventory.php # Update pricing php examples/pricing.php # Check feed status php check_feed.php [feedId] [--detailed] # Get product info php check_product.php [SKU]
🔧 Supported Feed Types
- ✅ POST_INVENTORY_AVAILABILITY_DATA - Inventory quantity updates
- ✅ POST_PRODUCT_PRICING_DATA - Product pricing updates
- ✅ POST_PRODUCT_DATA - Product information updates
- ✅ POST_PRODUCT_IMAGE_DATA - Product image updates
- ✅ POST_PRODUCT_RELATIONSHIP_DATA - Variation relationships
🏢 About Us
Created with ❤️ by @drkbcn at Labelgrup Networks.
- 💼 Company: labelgrup.com
- ☕ Support: Ko-fi
- 📧 Contact: hello@labelgrup.com
🤝 Contributing
Did this project save you money? Consider:
- ⭐ Starring this repository
- 🐛 Reporting issues or requesting features
- 🔀 Contributing code improvements
- ☕ Buying me a coffee
📄 License
MIT License - Free to use, modify, and distribute!
� Credits
- Inspiration: Amazon Sellers community facing migration challenges
- Built on: jlevers/selling-partner-api (the excellent free SP-API library)
- Alternative to: Highside Labs' commercial Feed Transformer (which charges $299-$899 per feed type)
📚 Resources
We hope this helps you migrate your Amazon integrations without breaking the bank! 💰
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-26