Files
nocodb/packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/030.sdk.md
աɨռɢӄաօռɢ b1c90d51ac fix(docs): broken pages
2023-11-18 21:03:00 +08:00

68 lines
1.2 KiB
Markdown

---
title: 'NocoDB SDK'
description: 'NocoDB SDK Overview'
---
We provide SDK for users to integrate with their applications. Currently only SDK for Javascript is supported.
:::note
The NocoDB SDK requires authorization token. If you haven't created one, please check out <a href="/0.109.7/developer-resources/accessing-apis" target="_blank">Accessing APIs</a> for details.
:::
## SDK For Javascript
### Install nocodb-sdk
```bash
npm i nocodb-sdk
```
### Import Api
```js
import { Api } from 'nocodb-sdk'
```
### Configure Api
The Api can be authorizated by either Auth Token or API Token.
#### Example: Auth Token
```js
const api = new Api({
baseURL: 'https://<HOST>:<PORT>',
headers: {
'xc-auth': '<AUTH_TOKEN>'
}
})
```
#### Example: API Token
```js
const api = new Api({
baseURL: 'https://<HOST>:<PORT>',
headers: {
'xc-token': '<API_TOKEN>'
}
})
```
### Call Functions
Once you have configured `api`, you can call different types of APIs by `api.<Tag>.<FunctionName>`.
:::note
For Tag and FunctionName, please check out the API table <a href="/0.109.7/developer-resources/rest-apis" target="_blank">here</a>.
:::
#### Example: Calling API - /api/v1/db/meta/projects/`{projectId}`/tables
```js
await api.dbTable.create(params)
```