# mulesoft API Functional Monitoring - Full Documentation --- product: API Functional Monitoring --- # Adding Schedules > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You can add a schedule to an existing monitor if either of the following two conditions is true: - You plan to run the test associated with the schedule in a public location, and the allocation of schedules for your Anypoint Platform organization is not exhausted. - You plan to run the test associated with the schedule in a private location. ## Before You Begin Ensure that you have the following permission set in Access Management: - **Exchange > Exchange Administrator** or **Exchange > Exchange Contributor** An Anypoint Platform administrator for your organization grants permission. See [Manage Permissions](https://docs.mulesoft.com/access-management/managing-permissions). ## Add a Schedule 1. Select the monitor in which you want to add a schedule. 2. Click **Add Schedule** from the **Schedules** table. 3. In the **Add Schedule** dialog box, select the following: - The location in which to run the test - The monitor schedule interval and its required information:
IntervalRequired InformationDefinition

Hourly

The minute

The minute at which the test begins, starting 60 minutes after you create the schedule

Daily

The time of each day

The time each day (hour and minutes) at which the test begins

Weekly

Day of the week and time of day

The day of the week and the time of that day that initiates the test

Monthly

Day of the month and time of day

The day of the month and the time of that day that initiates the test

Advanced

Cron

The cron expression for the frequency of the test.

4. Set **Configuration**. 5. Click **Add**. The countdown to the first run of the selected test begins. > [!NOTE] Specified test times correspond with your time zone. ## Limits for Schedule Intervals by Location The minimum interval for schedules that run in private locations is always five minutes. The minimum interval for schedules that run in public locations depends on the number of schedule entitlements, or API monitor entitlements, that you have. If you have more than five, the limit is five minutes. Otherwise, it is fifteen minutes. The limit depends on the type of location, not on whether the API is public or private, because you can test a public API from a private location.
Location TypeNumber of EntitlementsAccount TypeInterval Time Allowed

Public

5 or less

Developer

15 minutes

Public

5 or less

Other

15 minutes

Public

More than 5

Developer

15 minutes

Public

More than 5

Other

5 minutes

Private

Any number

N/A

5 minutes

## Scheduling Long-Running Tests Tests for a monitor that are run in public locations silently fail when the run time exceeds 120 seconds. If you need longer tests, the best solution is to use a private location, because you can run tests that have a long duration in private locations. If you want to run longer-running tests in a public location, you can: 1. Download the monitor and split the tests across multiple monitors using the BAT CLI. 2. Run and time each test to ensure that their running times are under 120 seconds. 3. Upload the tests as separate monitors to run in the web UI or run them through BAT CLI. ## See Also - [Differences in the Monitoring of Public and Private APIs](https://docs.mulesoft.com/api-functional-monitoring/afm-monitoring-public-apis) - [Manage Permissions](https://docs.mulesoft.com/access-management/managing-permissions) --- product: API Functional Monitoring --- # API Functional Monitoring in Anypoint Monitoring > For the full documentation index, see: https://docs.mulesoft.com/llms.txt API Functional Monitoring enables you to monitor responses to requests sent to API resources at their endpoints. You monitor APIs by accessing the **Functional Monitoring** section of Anypoint Monitoring, which you select from the home page of Anypoint Platform. The **Functional Monitoring** section contains tools for creating and editing monitors. Additionally, you can upload custom test suites written in BAT, a Behavior Driven Development (BDD) language. The following image illustrates the components of a monitor: ![afm ui overview a new](/mulesoft/current/en-us/api-functional-monitoring/_images/afm-ui-overview-a-new.png) A monitor includes a test and one or more schedules for running tests. A monitor test includes the following: - The endpoints to verify - Optional assertions to verify at the endpoints (for example, a 200 status code) - Optional HTTP headers to include when sending requests to the endpoints - Optional tools, such as SumoLogic and Slack, used to send test reports A monitor test schedule includes the following: - The location from which to run the test Locations can be public or private. For details, see [Monitoring the Endpoints of Public APIs](https://docs.mulesoft.com/api-functional-monitoring/afm-monitoring-public-apis) and [Monitoring the Endpoints of Private APIs](https://docs.mulesoft.com/api-functional-monitoring/afm-monitoring-private-apis). - The time interval between tests The Functional Monitoring page with a monitor selected is shown in the following image: ![AFM page showing a selected monitor’s details](/mulesoft/current/en-us/api-functional-monitoring/_images/afm-ui-test-versions-and-schedules-new.png)
1Duration of the test for the selected monitor.
2Daily average response time in milliseconds of all tests to all endpoints. The colors in each bar indicate the breakdown of the average time for each of the steps in a test. Hover over the bar to see the breakdown details.
3Schedule information, including when the next run is scheduled, the schedule interval, and information about the location where the tests are scheduled to run.
4Details about the previous execution, including the method executed and the assertions.
5A summary list of the last few executions.
6Option to add schedules to the selected monitor.
The bar graph shows the daily average response time in milliseconds of all tests to all endpoints. The colors in each bar indicate the average time for each of the steps in a test. Hover over the bar to see the details. ## See Also - [Creating Monitors](https://docs.mulesoft.com/api-functional-monitoring/afm-create-monitor) - [Uploading Monitors](https://docs.mulesoft.com/api-functional-monitoring/afm-upload-monitor) --- product: API Functional Monitoring --- # API Functional Monitoring Overview > For the full documentation index, see: https://docs.mulesoft.com/llms.txt API Functional Monitoring is a component of Anypoint Platform that enables you to ensure the quality and reliability of public and private APIs that are being used in application networks. Developers and operators can use API Functional Monitoring to perform consistent testing of the functional behavior and performance of APIs throughout the API lifecycle, in testing and production environments. You can: - Monitor Public or Private APIs from the Anypoint Monitoring UI or by using the BAT command line interface (BAT CLI) - View and report on the results of monitor executions The Functional Monitoring page with a monitor selected is shown in the following image: ![AFM page showing a selected monitor’s details](/mulesoft/current/en-us/api-functional-monitoring/_images/afm-ui-test-versions-and-schedules-new.png)
1Duration of the test for the selected monitor.
2Daily average response time in milliseconds of all tests to all endpoints. The colors in each bar indicate the breakdown of the average time for each of the steps in a test. Hover over the bar to see the breakdown details.
3Schedule information, including when the next run is scheduled, the schedule interval, and information about the location where the tests are scheduled to run.
4Details about the previous execution, including the method executed and the assertions.
5A summary list of the last few executions.
6Option to add schedules to the selected monitor.
## Functional Monitoring Concepts Following are the concepts you need to know to use API Functional Monitoring. ### Monitors A monitor is a repeating schedule of one or more tests. Monitors are also called test suites. ### Tests Tests run in monitors on a defined schedule. Test cases are defined using Behavior Driven Development (BDD) language, a common, declarative, and easy-to-use behavior-description language. ### Behavior Driven Development (BDD) Language The BDD language is used to write tests. It is based on DataWeave and follows the “given-when-then” approach to describe behavior in terms of conditions and expected outcomes. ### Test Suites See [Monitors](#afm-monitors). ### Schedules Schedules are designated intervals and durations configured in monitors for test suites to run. ### Black Box Testing Black box testing validates the overall behavior of an API and its live dependencies as a whole, based entirely on inputs and outputs. These tests are done without knowing or altering the API internals &mdash and without simulation or mocking. ### White Box Testing White box testing validates the behavior of individual APIs against the understanding of how their internals work. As part of this type of testing, you mock and simulate dependencies, such as back-end systems and other APIs. ### Runtime Monitoring Runtime monitoring ensures that deployed APIs operate within the expected performance level in production environments. Runtime monitoring uses behavioral test cases with real inputs, expected outputs, and live dependencies. ### Private APIs Private APIs are APIs with endpoints that are accessible only within your network inside an Anypoint VPC. ### Public APIs Public APIs are APIs with endpoints that are exposed to the public internet. Tests of such endpoints are run by workers that themselves run in public locations or private locations. ### Private Locations A private location is a Mule application that runs in an environment in CloudHub 1.0 or Cloudhub 2.0. You can run tests against APIs that are accessible only within the private location. The private location environment might have an Anypoint VPC associated with it. You can create multiple private locations in a single instance of Anypoint VPC. ### Public Locations A public location is a region, or resource pool, that is shared with other MuleSoft customers. Examples of such regions are `us-east-1`, `us-east-2`, and `eu-central-1`. ## Next Steps Continue to [Getting Started with API Functional Monitoring](https://docs.mulesoft.com/api-functional-monitoring/afm-getting-started). ## See Also - [API Functional Monitoring in Anypoint Platform](https://docs.mulesoft.com/api-functional-monitoring/afm-in-anypoint-platform) - [API Functional Monitoring with the BAT CLI](https://docs.mulesoft.com/api-functional-monitoring/bat-top) --- product: API Functional Monitoring --- # API Functional Monitoring Release Notes > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following release notes are provided for API Functional Monitoring: - [API Functional Monitoring (AFM) Release Notes](https://docs.mulesoft.com/release-notes/api-functional-monitoring/api-functional-monitoring-release-notes) ## See Also - [API Functional Monitoring Overview](https://docs.mulesoft.com/api-functional-monitoring/) - [Known Issues](https://help.salesforce.com/s/issues) --- product: API Functional Monitoring --- # API Functional Monitoring with the Blackbox Automated Testing (BAT) CLI > For the full documentation index, see: https://docs.mulesoft.com/llms.txt You can use API Functional Monitoring to run a test or suite of tests on an API. API Functional Monitoring is based on Blackbox Automated Testing (BAT). Using API Functional Monitoring, you can automate testing and get test reports. You can test before pushing code into your repository and before deploying to production. Tests can verify API functionality and validate results the API generates. You can monitor APIs at each stage of the software development life cycle and in production. The prerequisites for testing and scheduling are: - One or more deployed APIs - Installation of BAT. - A directory that contains a test suite. - At least one test file in that directory. You write tests in Behavior Driven Development (BDD) syntax using a code or text editor, such as IntelliJ. Test files must use the `.dwl` extension for processing by DataWeave. An additional prerequisite, this one for monitoring scheduled tests in the cloud, is an account on Anypoint Platform. ## See Also - [Install BAT](https://docs.mulesoft.com/api-functional-monitoring/bat-install-task) - [BDD Test Writing Language Reference](https://docs.mulesoft.com/api-functional-monitoring/bat-bdd-reference) --- product: API Functional Monitoring --- # BAT CLI Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt BAT CLI provides an API Functional Monitoring command line interface through an integration with Anypoint Platform. The command line interface lets you run tests locally and schedule monitors for continuous API testing. You can schedule tests in the cloud using the CLI-xAPI. This reference covers the syntax and key options you can use with the `bat` commands. Using the `bat` commands, you can debug and run tests, get credentials for scheduling tests, schedule tests, list test schedules, and perform additional operations. For commands to execute successfully, the account under which BAT CLI logs in must have the required permissions for the action the command is executing. ## Permissions Required To use all of the `bat` commands to execute the corresponding actions in Anypoint Platform, you must have the following permissions.
PermissionActions

Create Applications (Runtime Manager)

Create private locations

Delete Applications (Runtime Manager)

Delete private locations

Manage Settings (Runtime Manager)

Update private locations

View Environment

Log in using BAT CLI

View Organization

Use Secrets Manager through BAT CLI

Exchange Contributor (Exchange)

Create or modify a monitor; add or modify a schedule

Exchange Administrator (Exchange)

Create, modify, or delete a monitor; add, modify, or delete a schedule

Grant access to secrets (Secrets Manager)

Use Secrets Manager

## Login Options To use the `bat` commands to execute API Functional Monitoring actions, you must first log in using one of the following login methods. ### Login Using Connected Apps `bat [login --client-id --client-secret [--profile=] --host=]` This option logs in to an Anypoint Platform account using the client ID and client secret from a connected app. This provides an alternative way to log in using MFA (multi-factor authentication) so that a second factor is not required. MFA is now required for non-SSO accounts unless they are on your organization’s exemption list. For information about connected apps, which are configured by organization administrators, see [Connected Apps](https://docs.mulesoft.com/access-management/connected-apps-overview). ### Login Using a Username and Password `bat [login --username= [--profile=] --host=]` This option logs in to an Anypoint Platform account using a username and password. It displays an interactive command for the password. `password for user [username]: ` You can include the option `--password=` in the `login` command. ## Execute Commands Stored in a File `bat [ …​ |