import Medusa from "@medusajs/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.product.createImport({
file // uploaded File instance
})
.then(({ transaction_id }) => {
console.log(transaction_id)
})
{
"transaction_id": "<string>",
"summary": {
"toCreate": 123,
"toUpdate": 123
}
}
Create a new product import process. The products aren’t imported until the import is confirmed with the /admin/products/:transaction-id/imports
API route.
import Medusa from "@medusajs/js-sdk"
export const sdk = new Medusa({
baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
debug: import.meta.env.DEV,
auth: {
type: "session",
},
})
sdk.admin.product.createImport({
file // uploaded File instance
})
.then(({ transaction_id }) => {
console.log(transaction_id)
})
{
"transaction_id": "<string>",
"summary": {
"toCreate": 123,
"toUpdate": 123
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
The details of the product's import file.
OK
The import process's details.