Update Inventory Price
See original GitHub issueHi @amz-tools, Thanks for this library, it’s really useful and good job!
I want to update the inventory price. I tried 4 different ways but neither worked. Am I missing something?
I’m working in the European zone.
Option 1
listingsItems.patchListingsItem request
.callAPI({
operation: 'listingsItems.patchListingsItem',
path: { sku:[sku], sellerId:[sellerId] },
query: { marketplaceIds: [marketPlaceId], issueLocale: 'en_US' },
body: { productType: 'PRODUCT', patches: [{ op: 'replace', path: '/attributes/item-price', value: 19.99 }] },
})
response
code:'InternalFailure'
details:''
message:'We encountered an internal error. Please try again.'
type:'error'
My opinion: I think this endpoint has not been implemented yet for Europe.
Option 2
JSON_LISTINGS_FEED
const feedType = 'JSON_LISTINGS_FEED';
const content = {
header: {
sellerId: aspConfig.sellerId,
version: '2.0',
issueLocale: 'en_US',
},
messages: [
{
messageId: 1,
sku: sku,
operationType: 'PATCH',
productType: 'PRODUCT',
patches: [{ op: 'replace', path: '/attributes/listing-price', value: [{ value: price }] }],
},
],
};
const contentType = 'application/json; charset=UTF-8';
const feedUploadDetails = await spService.callAPI({ operation: 'feeds.createFeedDocument', body: { contentType } });
await spService
.upload(feedUploadDetails, JSON.stringify(content), contentType)
.then(res => console.log(res))
.catch(err => console.log(err));
const inputFeedDocumentId = feedUploadDetails.feedDocumentId;
return spService
.callAPI({
operation: 'feeds.createFeed',
body: { feedType, marketplaceIds: [marketPlace.id], inputFeedDocumentId },
})
.then(res => console.log(res))
.catch(err => console.log(err));
The feed document was uploaded successfully and also the feed was created successfully, but the status of the feed is IN_PROGRESS for 12 hours.
createdTime:'2021-07-16T07:42:27+00:00'
feedId:'138122018824'
feedType:'JSON_LISTINGS_FEED'
marketplaceIds:(1) ['A1PA6795UKMFR9']
processingStartTime:'2021-07-16T07:42:35+00:00'
processingStatus:'IN_PROGRESS'
My opinion: I think this feed is related to listingsItems.patchListingsItem at the backend so may has the same problem.
Option 3 & Option 4
feeds: POST_FLAT_FILE_INVLOADER_DATA & POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA
const feedType = 'POST_FLAT_FILE_INVLOADER_DATA'; // or 'POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA'
const content = `sku price\n${sku} ${price}`;
const contentType = 'text/tab-separated-values; charset=UTF-8';
const feedUploadDetails = await spService.callAPI({ operation: 'feeds.createFeedDocument', body: { contentType } });
await spService
.upload(feedUploadDetails, content, contentType)
.then(res => console.log(res))
.catch(err => console.log(err));
const inputFeedDocumentId = feedUploadDetails.feedDocumentId;
await spService
.callAPI({
operation: 'feeds.createFeed',
body: { feedType, marketplaceIds: [marketPlace.id], inputFeedDocumentId },
})
.then(res => console.log(res))
.catch(err => console.log(err));
feeds status:
{ createdTime:'2021-07-17T19:12:48+00:00'
feedId:'139649018825'
feedType:'POST_FLAT_FILE_INVLOADER_DATA'
marketplaceIds:(1) ['A1PA6795UKMFR9']
processingStatus:'IN_QUEUE'
}
{
createdTime:'2021-07-17T16:52:53+00:00'
feedId:'139397018825'
feedType:'POST_FLAT_FILE_PRICEANDQUANTITYONLY_UPDATE_DATA'
marketplaceIds:(1) ['A1PA6795UKMFR9']
processingStatus:'IN_QUEUE'
}
I think I’m going to lose the remaining half of my hair because of seller-partner-api and it’s documentation.
Thanks for your help
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Related StackOverflow Question
@ahmetsametoglu No, we didn’t. Just had a quick look as well, seems you are not the only one having trouble with the patchListingsItem structure. There’s probably no helpful docs or explanation of it (yet). Let us know if you find out how to set the path correct.
i want to add a new product, how to write the
content