This page describes how to call Mercury Cloud OpenAPI.
3.1 Base URL
The base service endpoint is at:
https://domain.com/openapi/face/v1
Mercury Cloud API is served only over HTTPS to ensure your data privacy.
The domain.com might differ according to your service region. Please find this information in your service starting email.
3.2 Common parameters
Each API call requires a few common parameters, HTTP method, App ID, Access Key, and Secret Key.
GET, POST, and DELETE are the HTTP method used in Mercury Cloud. Refer to the API References for details on the method of each API. This method will also be used in API authentication.
The App ID, the Access Key, and the Secret Key are included in your service starting email. Please keep them in a safe place and do not disclose them to others. They will be used in setting the API URL and calculating the API auth token.
3.3 API authentication
All Mercury APIs require auth tokens to verify valid clients. There are two types of additional headers (x-date and Authorization) needed in each API call. If they are not included, you will get a 401 HTTP error code.
The x-date header
The x-date header uses an RFC-7231 formatted UTC date-time string.
For example:
x-date: Fri,09 Jul 202101:51:02GMT
This stands for 2021-07-09T01:51:02Z. Please notice that the x-date is the time of the GMT, not your local time.
The Authorization header
The Authorization header is generated based on a given URL path, HTTP method, App ID, Access Key, and Secret Key. For some APIs related to Features DBs, the DB ID is also required. The Authorization follows the following format.
POST is the HTTP method. Make it consistent with the API you are going to use.
/openapi/face/v1/abc1a8a7-038f-4f9a-b98a-5b602978b135/detect is the URL path including the abc1a8a7-038f-4f9a-b98a-5b602978b135 part as the APP ID. Replace it with your own APP ID. Also, substitute this part with the URL path of your designated API. In some APIs, DB ID is also needed. For example,
SwaggerHub offers interactive ways to let you test API calls directly from the browser using the "Try it out" button. Mercury Cloud Interactive API Documentation requires a special Authentication before you can use this function. Here is the guide to using the "Try it out" function in the Mercury Cloud Interactive API Documentation.