API Troubleshooting
This section helps you identify and resolve common issues you may encounter when working with the Metrix REST API.
1. Authentication & Access Issues
-
403 ForbiddenError:- Reason 1: Incorrect or invalid API Key.
- Solution: Re-verify your
APP_IDandAPI_Keyfrom the Application Settings section in the Metrix dashboard.
- Solution: Re-verify your
- Reason 2: IP WhiteList setting in the dashboard.
- Explanation: If you have configured an IP WhiteList for your API in the Metrix dashboard, only requests from authorized IPs will receive a response.
- Solution: Ensure that your requests are being sent from an IP registered in the WhiteList, or review the WhiteList settings in the dashboard and temporarily disable it if necessary.
- Reason 1: Incorrect or invalid API Key.
-
Exposed Server API Key:
- Security Note: The Server API Key should never be used or exposed in client-side code (web or mobile application).
- Solution: If your Server API Key is leaked or accidentally exposed, immediately change its type to Client in the Metrix dashboard and then create and replace it with a new API Key.
2. Data Format & Content Issues
-
400 Bad RequestError:- Likely reason: Invalid JSON structure or incomplete/incorrect fields.
- Solution:
- Ensure your request body is valid JSON.
- Check all mandatory fields (
type,id,time,name/customName, and relevant user identifiers). - Verify the data type of each field (e.g.,
timeandbirthdayas a Long number,revenueas a Double) according to the documentation.
-
Events are not displayed in the dashboard, but a
200 OKcode was received:- Explanation: Receiving a
200 OKcode only signifies that the request was successfully sent to the server, and does not necessarily mean the event was processed correctly. - Possible reasons:
- Duplicate Event: If you send an event with a consistent
metrixUserIdand the sametime, the Metrix system will automatically detect it as a duplicate and drop it. - Incorrect/incomplete
customUserIdormetrixUserId. - Invalid or empty
nameorcustomName.
- Duplicate Event: If you send an event with a consistent
- Solution:
- Ensure you are sending a unique
idfor each message and a correct, logicaltimefor each event. - Verify the correctness of the
customUserIdandmetrixUserIdidentifiers. - Confirm the accuracy of
nameorcustomNameand that it follows the Taxonomy.
- Ensure you are sending a unique
- Explanation: Receiving a
3. Messaging Channel Issues
- Message not received (Push/SMS/Email):
- Solution: Before testing via the API, you must have successfully tested sending a message for the desired channel (e.g., Push Notification or SMS) through the Metrix dashboard. This ensures that your channel settings in the dashboard are correct.
4. Server Connectivity Issues
-
Unable to connect to the Metrix Endpoint:
- Possible reasons: Your server’s firewall, network issues, or failed DNS resolution.
- Solutions:
- Check DNS Status: Make sure your server can resolve the
entry.metrix.iraddress to its corresponding IP. You can use thedigornslookupcommand in your server’s terminal:ordig entry.metrix.irnslookup entry.metrix.ir - Test Connection (Ping/Telnet/cURL): Check if your server can access the Metrix Endpoint.
- With Telnet (for port 443):
If the connection is successful, you will see a blank page or a “Connected” message. Otherwise, there is a firewall or network issue.
telnet entry.metrix.ir 443 - With cURL (a simple connection test):
This command will show connection details and can help identify SSL/TLS or network problems.
curl -v https://entry.metrix.ir/
- With Telnet (for port 443):
- Check Server Firewall: Ensure that your server’s firewall allows access to port 443 (HTTPS) and the
entry.metrix.irdomain. - Check Network Logs: Examine your server’s network logs for any connection errors or rejected requests.
- Check DNS Status: Make sure your server can resolve the
-
Server Errors (
5xx Server Error) or Timeout:- Possible reasons: These errors usually indicate temporary issues on the Metrix server side or more widespread network problems.
- Solution: The issue may be temporary. Retry the request (using a Retry and Exponential Backoff mechanism). If the problem persists, contact support.
5. Contacting Support
If you are still experiencing issues after performing the checks above, please contact the Metrix support team. To expedite the troubleshooting process, be sure to provide the following information:
- Your
APP_ID. - The full
curlrequest related to the issue (including Headers and Body). - The response received from the Metrix server (including the HTTP status code and response body).
- The exact date and time the issue occurred (UTC).
- Any relevant error messages from your server logs.
Last updated on