Execute API

This document will give a scenario to use API created by Barktler. Before getting started, you can try to create an API with Barktler. See Create an API.

Install Driver

A driver is required for actually sending a request. For starters, we recommend @barktler/axios-driver. You can see the supported driver’s full list at Driver Modules Status List. You can also create your own driver if needed.

To install @barktler/axios-driver, run the following command under your project folder.

yarn add @barktler/axios-driver
# Or
npm install @barktler/axios-driver --save

Barktler instance has different ways to find a driver to use; see Search Driver for more details.


Run the following code with the GoogleSearchAPI created earlier.

import { createAxiosDriver } from "@barktler/driver-axios";

const api: GoogleSearchAPI = GoogleSearchAPI.create();

Note again that useDriver is required before you execute the action.

Unit Test

We also provided the @barktler/mock-driver that allow user mock and execute request locally for testing proposes.


See Data Verify for how to verify request and response data with your API.