Troubleshooting AsyncOS API

This chapter contains the following sections:

API Logs

Subscribe to the API logs using System Administration > Log Subscriptions. For instructions, see the email gateway or Online Help.

The following are some of the events that are logged in the API logs:

  • API has started or stopped
  • Connection to the API failed or closed (after providing response)
  • Authentication succeeded or failed
  • Request contains errors
  • Error while communicating network configuration changes with AsyncOS API

Alerts

Ensure that the email gateway is configured to send you alerts related to AsyncOS API. You will receive alerts when:

Alert Description

Type

Severity

API has restarted due to an error

System

Warning

Handling Error Messages of Configuration APIs

This section lists the following error messages that you might receive when generating the following Configuration APIs ('Authentication,' 'URL lists,' 'Dictionary,' and 'HAT'):

  • Error - Unauthorised API calls

  • Error - Invalid credentials while generating token

  • Error - Token not authenticating API calls

  • Error - API calls give an expired token

  • Error - API Calls give unsupported operation for mode

Error - Unauthorised API Calls

Following is the error message you may receive for an unauthorized API call:
{
	     "error": {
		    "message": "Unauthorized.",
		    "code": "401",
		   "explanation": "401 = No permission -- see authorization schemes."
	    }
     }

Solution: See the Authentication APIssection for information about Authentication APIs.

Error - Invalid credentials while Generating Token

Following is the error message you may get when invalid credentials are received when generating the token:

{
	"error": {
		"message": "Invalid credentials.",
		"code": "400",
		"explanation": "400 = Bad request syntax or unsupported method."
	}
}

Solution: The client credentials might be incorrect. See the Client Credentials APIs for information on how to retrieve the client credentials correctly.

Error - Token not authenticating API Calls

Following is the error message you may receive when the token does not authenticate the API calls:

{
	"error": {
		"message": "InvalidTokenError.",
		"code": "401",
		"explanation": "401 = No permission -- see authorization schemes."
	}
}

Solution: The token might be incorrect. See the Generating JWT Token section for information on how to generate the token correctly.

Error - API Calls give Expired Token

Following is the error message you may receive when the API calls give an expired token:

{
	"error": {
		"message": "ExpiredSignatureError.",
		"code": "401",
		"explanation": "401 = No permission -- see authorization schemes."
	}
}

Solution: The token might have expired. You can regenerate a token using the Token API call. For more information, see Generating JWT Token.

Error - API Calls give unsupported operation for mode

Following is the error message you may receive when the API calls give unsupported operation for mode:

{
    "error": {
        "message": "Unsupported operation for machine mode. Override settings from the UI for sender_groups to configure through APIs.",
        "code": "404",
        "explanation": "404 = Nothing matches the given URI."
    }

}

Solution: You must override settings for the particular feature from the UI. In this example, you must override settings for sender groups from the UI to machine mode, after which API calls for sender groups for machine mode will return a successful response.