mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.2 KiB
68 lines
1.2 KiB
3 years ago
|
---
|
||
3 years ago
|
title: 'NocoDB SDK'
|
||
3 years ago
|
description: 'NocoDB SDK Overview'
|
||
3 years ago
|
---
|
||
|
|
||
3 years ago
|
We provide SDK for users to integrate with their applications. Currently only SDK for Javascript is supported.
|
||
|
|
||
1 year ago
|
:::note
|
||
|
|
||
|
The NocoDB SDK requires authorization token. If you haven't created one, please check out <a href="/developer-resources/accessing-apis" target="_blank">Accessing APIs</a> for details.
|
||
|
|
||
|
:::
|
||
3 years ago
|
|
||
3 years ago
|
## SDK For Javascript
|
||
|
|
||
|
### Install nocodb-sdk
|
||
|
|
||
|
```bash
|
||
|
npm i nocodb-sdk
|
||
|
```
|
||
|
|
||
|
### Import Api
|
||
3 years ago
|
|
||
|
```js
|
||
|
import { Api } from 'nocodb-sdk'
|
||
3 years ago
|
```
|
||
|
|
||
|
### Configure Api
|
||
|
|
||
|
The Api can be authorizated by either Auth Token or API Token.
|
||
3 years ago
|
|
||
3 years ago
|
#### Example: Auth Token
|
||
|
|
||
|
```js
|
||
3 years ago
|
const api = new Api({
|
||
3 years ago
|
baseURL: 'https://<HOST>:<PORT>',
|
||
3 years ago
|
headers: {
|
||
3 years ago
|
'xc-auth': '<AUTH_TOKEN>'
|
||
3 years ago
|
}
|
||
|
})
|
||
3 years ago
|
```
|
||
|
|
||
|
#### Example: API Token
|
||
3 years ago
|
|
||
3 years ago
|
```js
|
||
|
const api = new Api({
|
||
|
baseURL: 'https://<HOST>:<PORT>',
|
||
|
headers: {
|
||
|
'xc-token': '<API_TOKEN>'
|
||
|
}
|
||
|
})
|
||
3 years ago
|
```
|
||
|
|
||
3 years ago
|
### Call Functions
|
||
|
|
||
|
Once you have configured `api`, you can call different types of APIs by `api.<Tag>.<FunctionName>`.
|
||
|
|
||
1 year ago
|
:::note
|
||
|
|
||
|
For Tag and FunctionName, please check out the API table <a href="/developer-resources/rest-apis" target="_blank">here</a>.
|
||
|
|
||
|
:::
|
||
3 years ago
|
|
||
|
#### Example: Calling API - /api/v1/db/meta/projects/{projectId}/tables
|
||
|
|
||
|
```js
|
||
|
await api.dbTable.create(params)
|
||
|
```
|