import Switchyard from "@switchyard/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.import({
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/import API route.
import Switchyard from "@switchyard/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.import({
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 import's details.
A File to upload.
OK
The import process's details.
The ID of the workflow execution's transaction. This is useful to confirm the import using the /admin/products/:transaction-id/import API route.