If a request times out or an internal server error occurs when you call a PrivateLink operation, the client attempts to resend the request. In this case, you can specify the ClientToken parameter in the request to prevent the client from repeatedly sending the request.

What is idempotence

Idempotence is the property of certain operations or resources in mathematics and computer science whereby they can be applied multiple times without changing the result beyond the initial application. Idempotence plays an important role in distributed system design.

Ensure idempotence

In most cases, a client attempts to resend a request only when the HTTP status code 500 with the InternalError error code is returned, the HTTP status code 503 with the ServiceUnavailable error code is returned, or when no response is returned. When you call the PrivateLink API, the client generates a parameter value with a maximum of 64 ASCII characters, and assigns the value to ClientToken. This can ensure the idempotence of the requests that the client resends.

ClientToken details

The following information lists the details about the ClientToken parameter.

  • ClientToken is a unique and case-sensitive string that is generated by a client and can contain up to 64 ASCII characters in length. Example: ClientToken=123e4567-e89b-12d3-a456-426655440000.
  • If you retry a request with the same ClientToken but different request parameters, PrivateLink returns the error code IdempotentParameterMismatch.
    Note You must change the values of SignatureNonce, Timestamp, and Signature when you retry an API request. This is because PrivateLink uses SignatureNonce to prevent replay attacks and uses Timestamp to record the time when each request is sent. Therefore, you must specify different SignatureNonce and Timestamp values in a retried request. Consequently, this changes the value of Signature.
  • After you add the ClientToken parameter to a retried request:
    • If HTTP status code 200 is returned, this indicates that the same result as the last request is returned and your server status is not affected.
    • If HTTP status code 4xx is returned, the retried request fails. You must troubleshoot the error based on the error message. An exception is that the status code is returned with the error message try it later. This indicates that the server is busy. Try again later.