Skip to main content

Mercury Web API

Mercury exposes a standard RESTful API. All requests and responses use JSON, and operations correspond to HTTP verbs:

  • GET retrieves resources (e.g., fetch a customer record).
  • POST creates new resources (e.g., add a new order).
  • PUT updates existing resources (e.g., modify an existing user).

Authentication

Every request must include a Basic Authentication header:

Authorization Basic <base64-encoded-credentials>

Here, <base64-encoded-credentials> is the Base64 encoding of:

<username>:<password>

Error Handling

When an error occurs, the API returns JSON in this format:

{ 
    "error":"Invitation already created for mobile phone 306936787666",
  "errorCode":18
}

Typical HTTP Status Codes

StatusMeaning
200OK – The request was successful.
400Bad Request – The request contained malformed data or failed validation.
401Unauthorized – Missing or invalid authentication credentials.
404Not Found – The requested resource does not exist.
500Internal Server Error – An unexpected error occurred on the server side.
502Bad Gateway – Received an invalid response from an upstream server.
503Service Unavailable – The server is temporarily unable to handle the request.
504Gateway Timeout – The upstream server failed to send a request in time.

Localization – language handling

To request responses in a specific language, add this header to your API call:

Accept-Language: <two-letter code> (supported values are: en for english and el for greek.)

Logging and retries

When sending an API call, if it fails the error must be recorded on both sides along with the following information:

  • URL
  • Request payload
  • Reponse HTTP code
  • Error code
  • Error message
  • Full response body