We have created public API collections for
Gift Card module and its
Gift Card Account submodule with all available queries and sample data that you can both test via our demo endpoints and copy to run local tests in your Magento environment. More details about using public collections can be found in the following
FAQ post.
1. Amasty\GiftCard\Api\ImageRepositoryInterface - class for managing gift card images:
- POST /V1/amgcard/image, method="save" - save a gift card image;
- PUT /V1/amgcard/image/:id, method="save" - save a gift card image by ID;
- DELETE /V1/amgcard/image/:id, method="deleteById" - delete a gift card image by ID;
- GET /V1/amgcard/image/:id, method="getById" - get a gift card image by ID;
- GET /V1/amgcard/image/all, method="getList" - get a list of all gift card images.
2. Amasty\GiftCard\Api\CodePoolRepositoryInterface - class for managing gift card code pools:
- POST /V1/amgcard/code-pool, method="save" - create a code pool;
- PUT /V1/amgcard/code-pool/:id, method="save" - edit a specific code pool by ID;
- DELETE /V1/amgcard/code-pool/:id, method="deleteById" - delete a code pool by ID;
- GET /V1/amgcard/code-pool/:id, method="getById" - get a code pool data by ID;
- GET /V1/amgcard/code-pool/all, method="getList" - get the list of all code pools.
3. Amasty\GiftCard\Api\CodeGeneratorManagementInterface - class for gift card code generation:
- PUT /V1/amgcard/code-generator/code-pool/:codePoolId/qty/:qty, method="generateCodesForCodePool" - generate gift card codes;
- PUT /V1/amgcard/code-generator/code-pool/:codePoolId, method="generateCodesByTemplate" - generate gift card codes by template.
4. Amasty\GiftCardAccount\Api\GiftCardAccountRepositoryInterface - class for gift account processing:
- POST /V1/amgcard/account, method="save" - save a gift card account;
- PUT /V1/amgcard/account/, method="save" - save a gift card account by ID;
- DELETE /V1/amgcard/account/:id, method="deleteById" - delete a gift card account by ID;
- GET /V1/amgcard/account/:id, method="getById"/> - get a gift card account by ID;
- GET /V1/amgcard/account/code/:code, method="getByCode - get a gift card account by code;
- GET /V1/amgcard/account/order/:orderId, method="getByOrderId" - get a gift card account by order ID;
- GET /V1/amgcard/account/all, method="getList" - get all gift card accounts;
- POST /V1/amgcard/account/send, method="send" - send a gift card account email;
- DELETE /V1/guest-carts/:cartId/gift-card/:giftCardCode, method="removeGiftCardFromCart"/> - delete gift card from guest cart;
- PUT /V1/guest-carts/:cartId/gift-card/:giftCardCode, method="applyGiftCardToCart"/> - apply a gift card to guest cart;
- DELETE /V1/carts/mine/gift-card/:giftCardCode, method="removeGiftCardFromCart - delete a gift card from customer cart;
- PUT /V1/carts/mine/gift-card/:giftCardCode, method="applyGiftCardToCart - apply a gift card to customer cart;
- PUT V1/carts/mine/gift-card-account/:giftCardCode, method="applyGiftCardAccountToCart"/> - apply a gift card account to customer cart.
FAQ
Q: Can I get an example of Gift Card account creation via API?
A: A new gift card account can be created with the following API request: /rest/V1/amgcard/account. It requires specific parameters to be passed in the request body. Please find the example of the request body below:
{
"account": {
"code_id": 1,
"image_id": 1,
"website_id": 1,
"status": 1,
"initial_value": 10,
"current_value": 6
}
}
Fill in the values in the request body with the required data. Kindly note that to create a new entity (i.e. for a request with POST type), you don't need to specify the account ID, since it is auto-incremented.
Click the Send button and check the created gift card account in Magento admin.