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.list()
.then(({ products, count, limit, offset }) => {
console.log(products)
}){
"limit": 123,
"offset": 123,
"count": 123,
"products": [
{}
]
}Retrieve a list of products. The products can be filtered by fields such as id. The products can also be sorted or paginated.
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.list()
.then(({ products, count, limit, offset }) => {
console.log(products)
}){
"limit": 123,
"offset": 123,
"count": 123,
"products": [
{}
]
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
The number of items to skip when retrieving a list.
Limit the number of items returned in the list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Filter by a price list's ID to retrieve its associated products.
Search term to filter a product's searchable properties.
Filter by a product status.
Filter by a sales channel's ID to retrieve its associated products.
Filter by a title.
Filter by a handle.
Filter by a product ID.
Filter by whether a product is a gift card.
Filter by a product type's ID to retrieve its associated products.
Filter by a product category's ID to retrieve its associated products.
Filter by a product's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by a product's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by a product's deletion date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by a product collection ID.
Filter the retrieved products' variants.
Show child attributes
Filter by a variant's ID.
Filter by whether the Medusa application manages the variant's inventory.
Filter by whether the variant can be ordered even if it's out of stock.
Filter by the variant's creation date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Filter by the variant's update date.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
The variant's deleted at.
Show child attributes
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by an exact match.
Filter by values not equal to this parameter.
Filter by values in this array.
Filter by values in this array.
Filter by values not in this array.
Filter by values not in this array.
Filter by values not matching the conditions in this parameter.
Filter by values greater than this parameter. Useful for numbers and dates only.
Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
Filter by values less than this parameter. Useful for numbers and dates only.
Filter by values less than or equal to this parameter. Useful for numbers and dates only.
Apply a like filter. Useful for strings only.
Apply a regex filter. Useful for strings only.
Apply a case-insensitive like filter. Useful for strings only.
Filter to apply on full-text properties.
Filter arrays that have overlapping values with this parameter.
Filter arrays that have overlapping values with this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain some of the values of this parameter.
Filter arrays that contain all values of this parameter.
Filter arrays that contain all values of this parameter.
Filter by whether a value for this parameter exists (not null).
Limit the number of items returned in the list.
The number of items to skip when retrieving a list.
The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with -.
Comma-separated fields that should be included in the returned data. if a field is prefixed with + it will be added to the default fields, using - will remove it from the default fields. without prefix it will replace the entire default fields.
Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
Filter by a variant's ean.
Filter by a variant's upc.
Filter by a variant's barcode.
Whether to include deleted variants.
Whether to include deleted products.
OK