# Developer Tools

> Swagger docs per API user, TypeScript interfaces from your schemas, client code in 21 languages, a debugger for sandbox code, code search and editing in your own editor.

Source: https://docs.apimaker.dev/v1/docs/features/developer-tools.html

What API Maker gives a developer besides the APIs : documentation for the people who call them, types for the code which uses them, a debugger, and a way to work from your own editor.

## Swagger docs per API user

- Open an API user, enable Swagger docs and generate a **Swagger Token**. **View Swagger JSON** opens its URL.
- The docs list only the APIs that the API user can call, like its database, custom and system APIs.
- Share the URL with the team or partner that uses that API user.
- The URL answers only while Swagger docs are enabled for that API user. Disable them, or generate a new token, to stop an old URL from working.

## TypeScript interfaces from your schemas

- Your table schemas become TypeScript interfaces, grouped by instance and database : `db.<instance>.<database>.I<Table>`. See them in `Utility → Generated Interfaces`.
- Import them from `db-interfaces` in your code.

```typescript
import * as T from 'types';
import * as db from 'db-interfaces';

async function main(g: T.IAMGlobal) {
    const products = await g.sys.db.getAll<db.shop.main.IProducts>({
        instance: 'shop', database: 'main', collection: 'products',
    });
    return products.map(p => p.name); // p is typed
}
module.exports = main;
```

## API testing page

- Every API of your account in one place: pick an API, get a sample payload, set the headers and tokens, send it and read the response.
- `API Info → API Testing`, or **Test API** on the DB API, Custom API, System API, Events and Schedulers pages. On a listener the body holds the event data; on a scheduler, sending runs the code now.
- The request: **Headers**, **Params**, **Query Params**, **Body** (**Generate Data** builds a sample payload from the schema), **Code** (the code of a custom API, listener, scheduler or migration, with its versions), **Pre Hooks** and **Post Hooks** of the API. On a multi-tenant instance, **Select tenant**.
- The response: the answer or the errors, with the status code, the time taken and whether it came from the cache; the TypeScript interface of the answer; **Logs** with every `g.logger` line of the code which ran, hooks included.
- Every **Send** is recorded. Save a request as a state to run it again later, star it as a favourite. States go to Git with the project.
- Copy the same request as client code from **Integrations**: C, C#, cURL, Dart, Go, HTTP, Java, JavaScript, Kotlin, Node.js, Objective-C, OCaml, PHP, Postman CLI, PowerShell, Python, R, Ruby, Rust, Shell and Swift, with their variants.

## Debugger

- Enable debugging, attach Chrome DevTools to the sandbox and stop on breakpoints in your TypeScript.
- It works for code that runs in the sandbox, not for code that runs on the native process.
- Reach debugging ports only through an SSH tunnel: the debug settings show the command.

## Code finder

- Search a word in all your code at once: custom APIs, hooks, events, schedulers, migrations, utility classes, schemas, secrets and more, and open the result to edit it.
- Learn more [Code finder](https://docs.apimaker.dev/v1/docs/features/code-finder.html).

## Your own editor

- `localClient.js` in your Git repository syncs your files with API Maker both ways.
- Generate a sync token in your user profile and set it in `local-client.config.js`.
- `npm run start` keeps the folder in sync, `npm run test` runs the test cases of the account from the terminal and writes their code coverage to `coverage/lcov.info` for VS Code and WebStorm. Learn more [Test cases](https://docs.apimaker.dev/v1/docs/test-cases/test-cases.html).
- While it is connected, API Maker also scans the account on its own and keeps `src/API Security Report/` up to date on your disk and in git, so an AI assistant working in the folder reads a fresh report. Learn more [APIs Security Report & Actions](https://docs.apimaker.dev/v1/docs/apis-security/api-security-report.html).

```javascript
module.exports = () => {
    return {
        webSocketURL: 'wss://ws.example.com', // WebSocket URL of your API Maker
        syncToken: '...', // generate it in your user profile
        adminUserPath: 'admin',
    };
};
```

## Notes (deprecated)

- Personal notes inside the admin panel, a deprecated feature. Learn more [Notes](https://docs.apimaker.dev/v1/docs/notes/notes.html).
