@Path(value="shops/{shopId}/products")
@RolesAllowed(value={"sf","admin"})
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 |
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,
int page,
int resultsPerPage,
java.lang.String query,
ProductApi.SortAttribute sort,
SortDirection direction)
Fetches all products for the provided parameters
|
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) |
private final ShopRequestContextService shopService
private final ProductService productService
@Inject public ProductResource(ShopRequestContextService shopService, ProductService productService)
@GET @Produces(value="application/vnd.epages.v1+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, @QueryParam(value="page") int page, @QueryParam(value="resultsPerPage") int resultsPerPage, @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.page
- Paging Parameter which defines the page number. Minimum is 1.resultsPerPage
- 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") 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.@GET @Path(value="{productId}/custom-attributes") @Produces(value="application/vnd.epages.v1+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") 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)