Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get listing policies of sku in an inventory items #159

Open
taaha1234 opened this issue Dec 14, 2023 · 1 comment
Open

get listing policies of sku in an inventory items #159

taaha1234 opened this issue Dec 14, 2023 · 1 comment
Assignees

Comments

@taaha1234
Copy link

app.get('/offersPolicies', async function (req, res) {
try {

const token = await getTokenInformation(1);

if(!token) {
  return res.sendStatus(403);
}
eBay.OAuth2.setCredentials(token);

eBay.OAuth2.on('refreshAuthToken', (refreshedToken) => {
  req.session.token = refreshedToken;
});

const viewItemSku = req.query.sku;
console.log('sku:', viewItemSku)

// const isValidSku = /^[a-zA-Z0-9]{1,50}$/.test(viewItemSku);
// if (!isValidSku) {
// return res.status(400).send({ error: 'Invalid SKU format' });
// }

const allOffers = await eBay.sell.inventory.getOffers(`${viewItemSku}`);
console.log(allOffers)




// res.json(allOffers);
res.send(allOffers)

} catch (error) {
console.error('Error:', error);
res.status(400).send({ error: error.message });
}
}); when i hit this api on postman ("/offersPolicies?sku=MG39-E29") the response was bad request and the error in message is show is ("{
"error": "This is an invalid value for a SKU. Only alphanumeric characters can be used for SKUs, and their length must not exceed 50 characters"
}") please guide me

@taaha1234 taaha1234 changed the title get listing policies of sku get listing policies of sku in an inventory items Dec 15, 2023
@dantio
Copy link
Collaborator

dantio commented Dec 21, 2023

Use the getInventoryItems method to retrieve SKU values.

Can you check your SKUs with the getInventoryItems() call?

const items = await eBay.sell.inventory.getInventoryItems();
console.log(items);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants