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.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 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.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.
The name of the file as stored in the configured File Module Provider.
The file's original name.
The file's extension.
"csv"
The file's size in bytes.
The file's mime type.
"text/csv"
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.