-
Notifications
You must be signed in to change notification settings - Fork 86
[Discounts] REST API #2780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.6
Are you sure you want to change the base?
[Discounts] REST API #2780
Conversation
Preview of modified files: no change to preview. |
35978c8
to
636c53c
Compare
docs/api/rest_api/rest_api_reference/input/ibexa-discounts.raml
Outdated
Show resolved
Hide resolved
* [PHP API REF] Added Discount packages * Generated PHP API for Discounts
* [Discounts] Added migration doc * Added files * Update docs/content_management/data_migration/importing_data.md
Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com>
* [Discounts] Search overview * Fixes before review * Reworded Type sort clause * Update docs/search/discounts_search_reference/discounts_sort_clauses.md Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com> --------- Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com>
* [Discounts] Added event reference * Fixed links * Fixes before review * Removed column
* Mentioned discounts in pricing and customer groups * Before review fixes * Added mention to the PIM guide
* Permissions * Build fixes * Fixed links * Fixed last links * Removed link * Apply suggestions from code review Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com> --------- Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com>
* Added update instructions * Fixed link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some error responses are missing but this isn't really important.
JSON object type description is incomplete as the wrapped XML part isn't accessible.
"DiscountCode": { | ||
"_media-type": "application\/vnd.ibexa.api.DiscountCode+json", | ||
"id": 1, | ||
"code": "my_secret_code", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like the response to the payload example. Shouldn't it be summer10
?
"code": "my_secret_code", | |
"code": "summer10", |
|
||
/{id}: | ||
get: | ||
displayName: Get discount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally this change, see next comment.
displayName: Get discount | |
displayName: Get discount by ID |
|
||
/{identifier}: | ||
get: | ||
displayName: Get discount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
responses: | ||
200: | ||
body: | ||
application/vnd.ibexa.api.Discount+json: | ||
type: DiscountWrapper | ||
example: !include examples/discounts/POST/DiscountCreateResponse.json.example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is likely some error responses as well. Probably 403 if user haven't the rights to create a discount and 500 if the payload is malformed.
It might not worth spending too much time into completing this in 4.6 RAML. It will be more important in 5.0 OpenAPI.
Remember https://redocly.com/docs/cli/rules/oas/operation-4xx-response 😉
DiscountListWrapper: | ||
type: object | ||
description: 'Wrapper object for DiscountList.' | ||
properties: | ||
DiscountList: | ||
type: DiscountList | ||
description: 'Object containing a list of discounts.' | ||
|
||
DiscountList: | ||
type: object | ||
description: 'Object containing a list of discounts.' | ||
properties: | ||
Discount: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
identifier: | ||
type: string | ||
description: "Discount identifier." | ||
type: | ||
type: string | ||
description: "Discount type: cart or catalog." | ||
priority: | ||
type: integer | ||
description: "Discount priority." | ||
isEnabled: | ||
type: boolean | ||
description: "Indicates whether the discount is enabled." | ||
userId: | ||
type: integer | ||
description: "User ID of discount creator." | ||
rule: | ||
type: object | ||
description: "Describes how the discount is calculated: percentage or fixed." | ||
properties: | ||
type: | ||
type: string | ||
description: "Discount type." | ||
amount: | ||
type: integer | ||
description: "Discount amount." | ||
startDate: | ||
type: datetime | ||
description: "Defines when the discount starts." | ||
endDate: | ||
type: datetime | ||
description: "Defines when the discount starts." | ||
translations: | ||
type: array | ||
description: "Translations of discount data." | ||
items: | ||
type: object | ||
properties: | ||
languageCode: | ||
type: string | ||
name: | ||
type: string | ||
description: | ||
type: string | ||
label: | ||
type: string | ||
labelDescription: | ||
type: string | ||
conditions: | ||
type: array | ||
description: "List of discount conditions." | ||
items: | ||
type: DiscountCondition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As only JSON is used, DiscountList can't be displayed.
When there is both, this no big deal that the Wrapper description is short, just close the JSON Wrapper type description and open the XML type description.
But here, there is no such possibility.
I would move DiscountList under its wrapper.
DiscountListWrapper: | |
type: object | |
description: 'Wrapper object for DiscountList.' | |
properties: | |
DiscountList: | |
type: DiscountList | |
description: 'Object containing a list of discounts.' | |
DiscountList: | |
type: object | |
description: 'Object containing a list of discounts.' | |
properties: | |
Discount: | |
type: array | |
items: | |
type: object | |
properties: | |
identifier: | |
type: string | |
description: "Discount identifier." | |
type: | |
type: string | |
description: "Discount type: cart or catalog." | |
priority: | |
type: integer | |
description: "Discount priority." | |
isEnabled: | |
type: boolean | |
description: "Indicates whether the discount is enabled." | |
userId: | |
type: integer | |
description: "User ID of discount creator." | |
rule: | |
type: object | |
description: "Describes how the discount is calculated: percentage or fixed." | |
properties: | |
type: | |
type: string | |
description: "Discount type." | |
amount: | |
type: integer | |
description: "Discount amount." | |
startDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
endDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
translations: | |
type: array | |
description: "Translations of discount data." | |
items: | |
type: object | |
properties: | |
languageCode: | |
type: string | |
name: | |
type: string | |
description: | |
type: string | |
label: | |
type: string | |
labelDescription: | |
type: string | |
conditions: | |
type: array | |
description: "List of discount conditions." | |
items: | |
type: DiscountCondition | |
DiscountListWrapper: | |
type: object | |
description: 'Wrapper object for DiscountList.' | |
properties: | |
DiscountList: | |
type: object | |
description: 'Object containing a list of discounts.' | |
properties: | |
Discount: | |
type: array | |
items: | |
type: object | |
properties: | |
identifier: | |
type: string | |
description: "Discount identifier." | |
type: | |
type: string | |
description: "Discount type: cart or catalog." | |
priority: | |
type: integer | |
description: "Discount priority." | |
isEnabled: | |
type: boolean | |
description: "Indicates whether the discount is enabled." | |
userId: | |
type: integer | |
description: "User ID of discount creator." | |
rule: | |
type: object | |
description: "Describes how the discount is calculated: percentage or fixed." | |
properties: | |
type: | |
type: string | |
description: "Discount type." | |
amount: | |
type: integer | |
description: "Discount amount." | |
startDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
endDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
translations: | |
type: array | |
description: "Translations of discount data." | |
items: | |
type: object | |
properties: | |
languageCode: | |
type: string | |
name: | |
type: string | |
description: | |
type: string | |
label: | |
type: string | |
labelDescription: | |
type: string | |
conditions: | |
type: array | |
description: "List of discount conditions." | |
items: | |
type: DiscountCondition |
Same for every JSON-only object types below…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added description of Discount REST API.
Previews: