Discount Reason API
For more details about this API usage check our API documentation
Introduction
The Discount Reason API has endpoints for adding, getting, updating, and deleting discount reasons.
Preparation
- Have an authenticated token from the authentication service, this token should be used as an authorization
bearer token
header for every request done in this API (more information about the authorization service here).
Retrieve (all) discount reasons
This endpoint is for getting one or all discount reasons that are created.
If you want to get all discount reasons, make GET request to /discountreasons
. As a response,
you will get a list of discount reasons.
If you want to get only one discount reason, make GET request to /discountreasons/{reasonId}
. You need to provide a
reasonId
. As a response you will get one discount reason with the provided reasonId
.
Example response:
These are some important attributes to clarify about stores, we are omitting the ones that are self-explanatory:
- The
reasonId
value represents the id of the discount reason. reasonName
is the name of the discount reason and is also the description.
Create discount reason
To create a new discount reason, make a POST request to /discountreasons
. You need to provide a body with reasonId
and reasonName
.
Example request body:
The reasonId
needs to be unique, otherwise the response will be 'Already exists'.
Delete discount reason
To delete a existing discount reason, make a DELETE request to /discountreasons/{reasonId}
. Make sure you are providing
a valid reasonId
.
Update discount reason
To update a existing discount reason, make a PATCH request to /discountreasons/{reasonId}
. You need to provide a
body with the new reasonName
. You can only update the reasonName
. The reasonId
cannot be changed with this endpoint.
Example request body:
As a response, you will get the updated discount reason.
Example response: