@Path(value="shops/{shopId}/products")
@RolesAllowed(value={"sf","products_read"})
public final class ProductResource
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ProductService |
productService |
private ShopRequestContextService |
shopService |
Constructor and Description |
---|
ProductResource(ShopRequestContextService shopService,
ProductService productService) |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
delete(java.lang.String shopId,
GUID productId) |
javax.ws.rs.core.Response |
get(java.lang.String shopId,
GUID productId,
java.util.Locale locale,
java.util.Currency currency)
Fetches a single product by id
|
javax.ws.rs.core.Response |
getAll(java.lang.String shopId,
java.util.List<GUID> guids,
GUID categoryId,
java.util.Locale locale,
java.util.Currency currency,
PagerStartsFromOneBeanParam pager,
java.lang.String query,
ProductApi.SortAttribute sort,
SortDirection direction)
Fetches all products for the provided parameters
|
javax.ws.rs.core.Response |
getCategories(java.lang.String shopId,
GUID productId,
java.util.Locale locale) |
javax.ws.rs.core.Response |
getCustomAttributes(java.lang.String shopId,
GUID productId,
java.util.Locale locale) |
javax.ws.rs.core.Response |
getLowestPriceVariation(java.lang.String shopId,
GUID productId,
java.util.Currency currency,
java.util.Locale locale) |
javax.ws.rs.core.Response |
getStocklevel(java.lang.String shopId,
GUID productId) |
javax.ws.rs.core.Response |
updateStocklevel(StockLevelUpdate stockLevelUpdate,
java.lang.String shopId,
GUID productId) |
private final ShopRequestContextService shopService
private final ProductService productService
@Inject public ProductResource(ShopRequestContextService shopService, ProductService productService)
@GET @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response getAll(@PathParam(value="shopId") java.lang.String shopId, @Size(max=12) @QueryParam(value="id") java.util.List<GUID> guids, @QueryParam(value="categoryId") GUID categoryId, @QueryParam(value="locale") java.util.Locale locale, @QueryParam(value="currency") java.util.Currency currency, @BeanParam PagerStartsFromOneBeanParam pager, @QueryParam(value="q") java.lang.String query, @DefaultValue(value="name") @QueryParam(value="sort") ProductApi.SortAttribute sort, @DefaultValue(value="asc") @QueryParam(value="direction") SortDirection direction)
shopId
- The id of the shop.guids
- a list of product ids, which act as a filter on the results.
Maximum is 12. No other filtering, sorting or paging is
supported if this is used.locale
- The ISO 639-1 for language code and ISO 3166-1 for country
code. (Example: de_DE).currency
- The ISO 4217 currency code.pager
- BeanParams which defines the page number (Minimum is 1, also
default). Paging Parameter which defines the maximum number of
products per page.sort
- Sort Attribute (productId | name | price). Default: name.direction
- Sorting Direction (asc | desc). Default: asc.categoryId
- Filter products by category.@GET @Path(value="{productId}") @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response get(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId, @QueryParam(value="locale") java.util.Locale locale, @QueryParam(value="currency") java.util.Currency currency)
shopId
- The current shopproductId
- The current productlocale
- The ISO 639-1 for language code and ISO 3166-1 for country
code. (Example: de_DE).currency
- The ISO 4217 currency code.@DELETE @Path(value="{productId}") @RolesAllowed(value="products_write") public javax.ws.rs.core.Response delete(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId)
@GET @Path(value="{productId}/custom-attributes") @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response getCustomAttributes(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId, @QueryParam(value="locale") java.util.Locale locale)
@GET @Path(value="{productId}/lowest-price") @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response getLowestPriceVariation(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId, @QueryParam(value="currency") java.util.Currency currency, @QueryParam(value="locale") java.util.Locale locale)
@GET @Path(value="{productId}/categories") @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response getCategories(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId, @QueryParam(value="locale") java.util.Locale locale)
@GET @Path(value="{productId}/stock-level") @Produces(value="application/vnd.epages.v1+json, application/json") public javax.ws.rs.core.Response getStocklevel(@PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId)
@PUT @Path(value="{productId}/stock-level") @Produces(value="application/vnd.epages.v1+json, application/json") @RolesAllowed(value="products_write") public javax.ws.rs.core.Response updateStocklevel(StockLevelUpdate stockLevelUpdate, @PathParam(value="shopId") java.lang.String shopId, @PathParam(value="productId") GUID productId)