📊 State of Magento 2025

The Home for Magento 2 Excellence

Quality-tested Magento 2 modules. Explore. Evaluate. Elevate. #magento2

613 Modules
401 Ready
211 Need Help
🏆 Leaderboard
Potentially Abandoned vv2.0.2

Magento2 Idempotent Api

snowio/magento2-idempotent-api

Ensures API operations are idempotent by using a message group ID and timestamp. Prevents duplicate processing of the same request and handles late messages.

157,491
Downloads
Below average
4
GitHub Stars
Below average
4y ago
Last Release
2
Open Issues
Build Issues
2/3 checks passed

Build Tests

Composer Install
DI Compile
Templates

Code Quality

CS Coding Standard
2 errors , 22 warnings
PHPStan Failed

Tested on Magento 2.4.8-p3

Recent Test History

Each release is tested against the latest Magento version at that time.

vv2.0.2 on Magento 2.4.8-p3
Dec 27, 2025

Looking for Contributors

Dependency injection compilation fails. Your contribution could help the entire Magento community!

Contribute

Share This Module's Status

Magento2 Idempotent Api Magento compatibility status badge

README

Loaded from GitHub

Magento 2 Idempotent API

Description

Module that ensures all API operations are idempotent.

Idempotence : From a RESTful service standpoint, for an operation (or service call) to be idempotent, clients can make that same call repeatedly while producing the same result. In other words, making multiple identical requests has the same effect as making a single request. Note that while idempotent operations produce the same result on the server (no side effects), the response itself may not be the same (e.g. a resource's state may change between requests).

--RestApiTutorial.com http://www.restapitutorial.com/lessons/idempotency.html

Prerequisites

  • PHP 7.4 or newer
  • Composer (https://getcomposer.org/download/).
  • magento/framework 103 or newer
  • snowio/magento2-lock version 1 or newer.

Magento Versions

  • <= 2.3.x use 1.x tags
  • >= 2.4.x use master

Installation

composer require snowio/magento2-idempotent-api
php bin/magento setup:upgrade
php bin/magento module:enable SnowIO_IdempotentAPI
php bin/magento setup:di:compile
php bin/magento cache:flush

Usage

Request Headers

X-Message-Group-ID

The X-Message-Group-ID request-header field specifies the message group of the request. If no X-Message-Group-ID is specified then the request will not be treated idempotently.

X-Message-Timestamp

The X-Message-Timestamp request-header field corresponds to the time the message was created. If this field is not specified then this plugin uses \time() as the message timestamp, please note that the this is a Unix Timestamp.

Error Response Codes

409 Conflict

This error occurs when 2 or more requests with the same X-Message-Group-ID are processed at the simultaneously one of the requests will result in a 409 CONFLICT error response. The Idempotent API should ensure that the resource is not simultaneously updated.

412 Precondition Failed

This error occurs when a late message is received. Message A is a late message iff message B (which has the same X-Message-Group-ID) was created in the source client after A (has a larger X-Message-Timestamp than message A) and was received before message A. Message A will try update the resource but fails as message B is more recent than message A. This ensures that late messages do not affect the state of the resource.

License

This software is licensed under the MIT License. View the license

This content is fetched directly from the module's GitHub repository. We are not the authors of this content and take no responsibility for its accuracy, completeness, or any consequences arising from its use.