> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/api-reference/guides/how-to-test.md).

# How to test

Try a Norbix REST call with curl or Postman before you write code.

Before you write code, try the call by hand. You need three things: the address ([Base URLs](/codemash/api-reference/guides/base-urls.md)), a key ([Authentication](/codemash/api-reference/guides/authentication.md)) and your project id ([Keys and environments](/codemash/get-started/keys-and-environments.md)).

## How Norbix models it

| Tool                             | Best for                                                                                                 |
| -------------------------------- | -------------------------------------------------------------------------------------------------------- |
| **curl**                         | One call from the terminal; copy-paste into scripts                                                      |
| **Postman** (or any HTTP client) | Many calls, saved with their headers                                                                     |
| **The OpenAPI files**            | Importing every endpoint into a client at once                                                           |
| **SDK / CLI**                    | Calls from code or CI — see [Install the SDK](/codemash/sdks/install.md) and [CLI](/codemash/cli/cli.md) |

### curl

Put the key in an environment variable, so it does not end up in your shell history:

```sh
export NORBIX_API_KEY='nbsu_…'

# 1. is the installation there? (no key needed)
curl -s https://api.norbix.ai/v3/echo

# 2. count the records of a collection
curl -s "https://api.norbix.ai/v3/database/collections/books/count?projectId=pr_6JMU7afJi9tZQwfo6de4qq" \
  -H "Authorization: Bearer $NORBIX_API_KEY"
```

```json
{ "count": 2, "responseStatus": { "isSuccess": true, "errors": [] } }
```

Every call on these pages was run against a Norbix installation; only the host name was changed to the managed-service address.

### Postman

1. Create a request: method **GET**, URL `https://api.norbix.ai/v3/database/collections/books/count`.
2. **Params**: add `projectId` = your project id.
3. **Authorization**: type **Bearer Token**, paste your key.
4. Send. The body is the same JSON as with curl.

Save the base URL and the key as Postman variables, so the next request needs only the path.

### Import every endpoint

The API reference is built from two OpenAPI 3 files, one per service: [norbix-api-swagger.json](https://github.com/Isidos-co/codemash-docs/tree/main/.gitbook/assets/norbix-api-swagger.json) (Api) and [norbix-hub-swagger.json](https://github.com/Isidos-co/codemash-docs/tree/main/.gitbook/assets/norbix-hub-swagger.json) (Hub). Postman (**Import** → file) and most HTTP clients read them and create one request per endpoint.

A development installation also serves them live: `/swagger` (a browser UI), `/api-docs`, and `/swagger/v1/swagger.json`. They are off on the managed service and on production installations.

### Check the answer

* `responseStatus.isSuccess` is `true` → it worked.
* `false` → read `responseStatus.errors[]`: each error has a `message` and an `errorCode` (`CM-ERRORS-…`). See [Authentication → When it goes wrong](/codemash/api-reference/guides/authentication.md#when-it-goes-wrong).

## Where you use it

* [Base URLs](/codemash/api-reference/guides/base-urls.md) · [Authentication](/codemash/api-reference/guides/authentication.md) · [Environments](/codemash/api-reference/guides/environments.md)
* API: [Database → Collections](/codemash/api-reference/database/collections.md)
