mirror of
https://github.com/nocodb/nocodb.git
synced 2026-05-03 14:07:08 +00:00
feat: Improved UI (#6222)
* feat: Improved ui (#6156) * refactor: revert Signed-off-by: Pranav C <pranavxc@gmail.com> feat: shared base Signed-off-by: Pranav C <pranavxc@gmail.com> fix: remove duplicate import statement Signed-off-by: Pranav C <pranavxc@gmail.com> fix: disable starred & license menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix airtable wait issue Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable mysql in ci Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix checkbox order for sqlite Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: disable quick tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: fix dbType env variable for CI Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: workspace API access error fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite CI CD Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: use DB_TYPE env variable Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: enable SQLite UT Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: isHub cleanup Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: add check for EE Timezone spec Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> chore: cleanup Signed-off-by: Pranav C <pranavxc@gmail.com> test: EE check fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: test correction Signed-off-by: Pranav C <pranavxc@gmail.com> chore: sync latest changes Signed-off-by: Pranav C <pranavxc@gmail.com> test: set EE=false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> test: set NC Edition to community in workflow file Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> chore: update sdk build command Signed-off-by: Pranav C <pranavxc@gmail.com> refactor: i18n and other changes Signed-off-by: Pranav C <pranavxc@gmail.com> feat: new ui Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: lint Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: shared view/base related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: checkbox verification sort order fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix sqlite reset Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable selfhosted runners Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table ops (draft) Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * Docs: screenshots for table-operations.md * refactor: introduce missing buttons Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: get all fields Signed-off-by: Pranav C <pranavxc@gmail.com> * test: UT fix- new data API response Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: EE is false Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: webhook lookup as string in CE Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: include created_at and updated_at Signed-off-by: Pranav C <pranavxc@gmail.com> * test: fix UT newDataAPI response for PG Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: separate api for webhook related plugins Signed-off-by: Pranav C <pranavxc@gmail.com> * test: msyql filter corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: mysql group by test corrections Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix datatype for rating field in groupby spec for pg Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: kanban datatype correction Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: column edit for mysql- rating field Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: misc fixes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 4 workers Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: enable 2 workers per shard only Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: table CRUD * Rename table-operations.md to table-crud.md * Create column-crud.md * docs: row CRUD * Rename row.md to row-crud.md * docs: project crud * docs: toolbar (skeleton) * refactor: single page UI and bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: sync tests playwright Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing dependency Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: single page ui, test corrections Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: tests Signed-off-by: Pranav C <pranavxc@gmail.com> * test: project rename test correction Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: remove only Signed-off-by: Pranav C <pranavxc@gmail.com> * test: remove wrong import statement Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: delete option not visible in project context menu Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: move ws access within isEE() Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: fix groupby * test: groupby fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: signup & landing page * docs: project crud * docs: project-crud misc * docs: toolbar fields * docs: toolbar / filters * docs: toolbar / group by * docs: toolbar / sort * docs: toolbar / row height * docs: filters additional options * docs: file re-order Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: add links to column types * docs: code snippets * docs: links * docs: lookup * docs: rollup * docs: formula * docs: primary key * docs: display value * docs: development setup * docs: swagger * fix(nc-gui): encodeURIComponent for row id - closes: #6202 * docs: language * docs: expanded record * docs: import airtable * docs: airtable * docs: webhook * docs: revert file rename Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * docs: account settings * docs: audit * docs: meta management * docs: project settings * docs: shared base * docs: shared view * docs: meta sync * docs: team-auth * docs: views * docs: fix URL * docs: URL corrections * fix: shared base, view related bugs Signed-off-by: Pranav C <pranavxc@gmail.com> * test: EE check for WSaccess Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * test: exclude EE tests Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> * fix: missing project delete closes #6215 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: merge existing project meta if found closes #6216 Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com> * refactor: docs and other bug fixes Signed-off-by: Pranav C <pranavxc@gmail.com> * feat: populate default project on super admin signup Signed-off-by: Pranav C <pranavxc@gmail.com> * fix: include created project details in signup response if avail, missing Dockerfile Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: use custom function for resolving ts path aliases Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: add missing generate script Signed-off-by: Pranav C <pranavxc@gmail.com> * chore: webpack build correction - ts path resolve Signed-off-by: Pranav C <pranavxc@gmail.com> --------- Signed-off-by: Pranav C <pranavxc@gmail.com> Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: mertmit <mertmit99@gmail.com> Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com> Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com> Co-authored-by: Wing-Kam Wong <wingkwong.code@gmail.com>
This commit is contained in:
31
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/010.accessing-apis.md
vendored
Normal file
31
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/010.accessing-apis.md
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: 'Accessing APIs'
|
||||
description: 'How to access NocoDB APIs with Auth or API token?'
|
||||
---
|
||||
|
||||
NocoDB APIs can be authorized by either Auth Token or API Token.
|
||||
|
||||
## Auth Token
|
||||
|
||||
Auth Token is a JWT Token generated based on the logged-in user. By default, the token is only valid for 10 hours. However, you can change the value by defining it using environment variable `NC_JWT_EXPIRES_IN`. If you are passing Auth Token, make sure that the header is called `xc-auth`.
|
||||
|
||||
- Go to NocoDB Project, click the rightmost button and click ``Copy Auth Token``.
|
||||
|
||||
<img width="357" alt="image" src="https://user-images.githubusercontent.com/35857179/194856397-b2e194e8-5ca1-420e-8b46-e1345d1d91d3.png" />
|
||||
|
||||
## API Token
|
||||
|
||||
API tokens allows us to integrate seamlessly with 3rd party apps. See [API Tokens Management](../setup-and-usages/team-and-auth#api-tokens-management) for more.
|
||||
|
||||
## Swagger UI
|
||||
|
||||
You can interact with the API's resources via Swagger UI.
|
||||
|
||||
- Go to NocoDB Project, click the rightmost button and click ``Swagger APIs Doc``.
|
||||
|
||||
<img width="325" alt="image" src="https://user-images.githubusercontent.com/35857179/194856535-c81bfc2a-8cdd-41aa-8aa6-9c667c972fa4.png" />
|
||||
|
||||
- Click ``Authorize``, paste the token you copied in above steps and click `Authorize` to save.
|
||||
|
||||

|
||||
|
||||
271
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/020.rest-apis.md
vendored
Normal file
271
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/020.rest-apis.md
vendored
Normal file
@@ -0,0 +1,271 @@
|
||||
---
|
||||
title: 'REST APIs'
|
||||
description: 'NocoDB REST API Overview'
|
||||
---
|
||||
|
||||
Once you've created the schemas, you can manipulate the data or invoke actions using the REST APIs. We provide several types of APIs for different usages as below.
|
||||
|
||||
## API Overview
|
||||
|
||||
Here's the overview of all APIs. For the details, please check out <a href="https://all-apis.nocodb.com/" target="_blank">NocoDB API Documentation</a>.
|
||||
|
||||
You may also interact with the API's resources via <a href="/developer-resources/accessing-apis#swagger-ui" target="_blank">Swagger UI</a>.
|
||||
|
||||
:::note
|
||||
|
||||
Currently, the default value for {orgs} is <b>noco</b>. Users will be able to change it in the future release.
|
||||
|
||||
:::
|
||||
|
||||
### Auth APIs
|
||||
|
||||
| Category | Method | Tag | Function Name | Path |
|
||||
|---|---|---|---|---|
|
||||
| Auth | Post | auth | signup | /api/v1/auth/user/signup |
|
||||
| Auth | Post | auth | signin | /api/v1/auth/user/signin |
|
||||
| Auth | Get | auth | me | /api/v1/auth/user/me |
|
||||
| Auth | Post | auth | passwordForgot | /api/v1/auth/password/forgot |
|
||||
| Auth | Post | auth | passwordChange | /api/v1/auth/password/change |
|
||||
| Auth | Post | auth | passwordReset | /api/v1/auth/password/reset/{token} |
|
||||
| Auth | Post | auth | tokenRefresh | /api/v1/auth/token/refresh |
|
||||
| Auth | Post | auth | passwordResetTokenValidate | /api/v1/auth/token/validate/{token} |
|
||||
| Auth | Post | auth | emailValidate | /api/v1/auth/email/validate/{email} |
|
||||
|
||||
### Public APIs
|
||||
|
||||
| Category | Method | Tag | Function Name | Path |
|
||||
|---|---|---|---|---|
|
||||
| Public | Get | public | sharedBaseGet | /api/v1/db/public/shared-base/{sharedBaseUuid}/meta |
|
||||
| Public | Post | public | dataList | /api/v1/db/public/shared-view/{sharedViewUuid}/rows |
|
||||
| Public | Get | public | dataNestedList | /api/v1/db/public/shared-view/{sharedViewUuid}/rows/{rowId}/{relationType}/{columnName} |
|
||||
| Public | Post | public | dataCreate | /api/v1/db/public/shared-view/{sharedViewUuid}/rows |
|
||||
| Public | Get | public | csvExport | /api/v1/db/public/shared-view/{sharedViewUuid}/rows/export/{type} |
|
||||
| Public | Get | public | dataRelationList | /api/v1/db/public/shared-view/{sharedViewUuid}/nested/{columnName} |
|
||||
| Public | Get | public | sharedViewMetaGet | /api/v1/db/public/shared-view/{sharedViewUuid}/meta |
|
||||
| Public | Get | public | groupedDataList | /api/v1/db/public/shared-view/{sharedViewUuid}/group/{columnId} |
|
||||
|
||||
### Data APIs
|
||||
|
||||
| Category | Method | Tag | Function Name | Path |
|
||||
|---|---|---|---|---|
|
||||
| Data | Delete| dbTableRow | bulkDelete | /api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/ |
|
||||
| Data | Post | dbTableRow | bulkCreate | /api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/ |
|
||||
| Data | Patch | dbTableRow | bulkUpdate | /api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/ |
|
||||
| Data | Patch | dbTableRow | bulkUpdateAll | /api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all |
|
||||
| Data | Delete| dbTableRow | bulkDeleteAll | /api/v1/db/data/bulk/{orgs}/{projectName}/{tableName}/all |
|
||||
| Data | Get | dbTableRow | list | /api/v1/db/data/{orgs}/{projectName}/{tableName} |
|
||||
| Data | Get | dbTableRow | findOne | /api/v1/db/data/{orgs}/{projectName}/{tableName}/find-one |
|
||||
| Data | Get | dbTableRow | groupBy | /api/v1/db/data/{orgs}/{projectName}/{tableName}/groupby |
|
||||
| Data | Get | dbTableRow | exist | /api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId}/exist |
|
||||
| Data | Post | dbTableRow | create | /api/v1/db/data/{orgs}/{projectName}/{tableName} |
|
||||
| Data | Get | dbTableRow | read | /api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} |
|
||||
| Data | Patch | dbTableRow | update | /api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} |
|
||||
| Data | Delete| dbTableRow | delete | /api/v1/db/data/{orgs}/{projectName}/{tableName}/{rowId} |
|
||||
| Data | Get | dbTableRow | count | /api/v1/db/data/{orgs}/{projectName}/{tableName}/count |
|
||||
| Data | Get | dbTableRow | groupedDataList | /api/v1/db/data/{orgs}/{projectName}/{tableName}/group/{columnId} |
|
||||
| Data | Get | dbViewRow | list | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} |
|
||||
| Data | Get | dbViewRow | findOne | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/find-one |
|
||||
| Data | Get | dbViewRow | groupBy | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/groupby |
|
||||
| Data | Get | dbViewRow | exist | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId}/exist |
|
||||
| Data | Post | dbViewRow | create | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName} |
|
||||
| Data | Get | dbViewRow | read | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} |
|
||||
| Data | Patch | dbViewRow | update | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} |
|
||||
| Data | Delete| dbViewRow | delete | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/{rowId} |
|
||||
| Data | Get | dbViewRow | count | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/count |
|
||||
| Data | Get | dbViewRow | groupedDataList | /api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}/group/{columnId} |
|
||||
|
||||
### Meta APIs
|
||||
|
||||
| Category | Method | Tag | Function Name | Path |
|
||||
|---|---|---|---|---|
|
||||
| Meta | Get | apiToken | list | /api/v1/db/meta/projects/{projectId}/api-tokens |
|
||||
| Meta | Post | apiToken | create | /api/v1/db/meta/projects/{projectId}/api-tokens |
|
||||
| Meta | Delete| apiToken | delete | /api/v1/db/meta/projects/{projectId}/api-tokens/{token} |
|
||||
| Meta | Get | auth | projectUserList | /api/v1/db/meta/projects/{projectId}/users |
|
||||
| Meta | Post | auth | projectUserAdd | /api/v1/db/meta/projects/{projectId}/users |
|
||||
| Meta | Patch | auth | projectUserUpdate | /api/v1/db/meta/projects/{projectId}/users/{userId} |
|
||||
| Meta | Delete| auth | projectUserRemove | /api/v1/db/meta/projects/{projectId}/users/{userId} |
|
||||
| Meta | Post | auth | projectUserResendInvite | /api/v1/db/meta/projects/{projectId}/users/{userId}/resend-invite |
|
||||
| Meta | Post | dbTable | create | /api/v1/db/meta/projects/{projectId}/tables |
|
||||
| Meta | Get | dbTable | list | /api/v1/db/meta/projects/{projectId}/tables |
|
||||
| Meta | Post | dbTableColumn | create | /api/v1/db/meta/tables/{tableId}/columns |
|
||||
| Meta | Patch | dbTableColumn | update | /api/v1/db/meta/tables/{tableId}/columns/{columnId} |
|
||||
| Meta | Delete| dbTableColumn | delete | /api/v1/db/meta/tables/{tableId}/columns/{columnId} |
|
||||
| Meta | Post | dbTableColumn | primaryColumnSet | /api/v1/db/meta/tables/{tableId}/columns/{columnId}/primary |
|
||||
| Meta | Get | dbTableFilter | get | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Patch | dbTableFilter | update | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Delete| dbTableFilter | delete | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Get | dbTableFilter | read | /api/v1/db/meta/views/{viewId}/filters |
|
||||
| Meta | Post | dbTableFilter | create | /api/v1/db/meta/views/{viewId}/filters |
|
||||
| Meta | Get | dbTableFilter | get | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Patch | dbTableFilter | update | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Delete| dbTableFilter | delete | /api/v1/db/meta/filters/{filterId} |
|
||||
| Meta | Get | dbTableFilter | childrenRead | /api/v1/db/meta/filters/{filterGroupId}/children |
|
||||
| Meta | Get | dbTableSort | list | /api/v1/db/meta/views/{viewId}/sorts |
|
||||
| Meta | Post | dbTableSort | create | /api/v1/db/meta/views/{viewId}/sorts |
|
||||
| Meta | Get | dbTableSort | read | /api/v1/db/meta/sorts/{sortId} |
|
||||
| Meta | Patch | dbTableSort | update | /api/v1/db/meta/sorts/{sortId} |
|
||||
| Meta | Delete| dbTableSort | delete | /api/v1/db/meta/sorts/{sortId}/api/v1/db |
|
||||
| Meta | Patch | dbTableWebhook | update | /api/v1/db/meta/hooks/{hookId} |
|
||||
| Meta | Delete| dbTableWebhook | delete | /api/v1/db/meta/hooks/{hookId} |
|
||||
| Meta | Get | dbTableWebhook | list | /api/v1/db/meta/tables/{tableId}/hooks |
|
||||
| Meta | Post | dbTableWebhook | create | /api/v1/db/meta/tables/{tableId}/hooks |
|
||||
| Meta | Post | dbTableWebhook | test | /api/v1/db/meta/tables/{tableId}/hooks/test |
|
||||
| Meta | Get | dbTableWebhook | samplePayloadGet | /api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation} |
|
||||
| Meta | Get | dbTableWebhookFilter | read | /api/v1/db/meta/hooks/{hookId}/filters |
|
||||
| Meta | Post | dbTableWebhookFilter | create | /api/v1/db/meta/hooks/{hookId}/filters |
|
||||
| Meta | Get | dbView | list | /api/v1/db/meta/tables/{tableId}/views |
|
||||
| Meta | Get | dbView | read | /api/v1/db/meta/tables/{tableId} |
|
||||
| Meta | Patch | dbView | update | /api/v1/db/meta/tables/{tableId} |
|
||||
| Meta | Delete| dbView | delete | /api/v1/db/meta/tables/{tableId} |
|
||||
| Meta | Post | dbView | reorder | /api/v1/db/meta/tables/{tableId}/reorder |
|
||||
| Meta | Post | dbView | formCreate | /api/v1/db/meta/tables/{tableId}/forms |
|
||||
| Meta | Patch | dbView | formUpdate | /api/v1/db/meta/forms/{formViewId} |
|
||||
| Meta | Get | dbView | formRead | /api/v1/db/meta/forms/{formViewId} |
|
||||
| Meta | Patch | dbView | formColumnUpdate | /api/v1/db/meta/form-columns/{formViewColumnId} |
|
||||
| Meta | Post | dbView | galleryCreate | /api/v1/db/meta/tables/{tableId}/galleries |
|
||||
| Meta | Patch | dbView | galleryUpdate | /api/v1/db/meta/galleries/{galleryViewId} |
|
||||
| Meta | Get | dbView | galleryRead | /api/v1/db/meta/galleries/{galleryViewId} |
|
||||
| Meta | Post | dbView | kanbanCreate | /api/v1/db/meta/tables/{tableId}/kanbans |
|
||||
| Meta | Patch | dbView | kanbanUpdate | /api/v1/db/meta/kanban/{kanbanViewId} |
|
||||
| Meta | Get | dbView | kanbanRead | /api/v1/db/meta/kanbans/{kanbanViewId} |
|
||||
| Meta | Post | dbView | mapCreate | /api/v1/db/meta/tables/{tableId}/maps |
|
||||
| Meta | Patch | dbView | mapUpdate | /api/v1/db/meta/maps/{mapViewId} |
|
||||
| Meta | Get | dbView | mapRead | /api/v1/db/meta/maps/{mapViewId} |
|
||||
| Meta | Post | dbView | gridCreate | /api/v1/db/meta/tables/{tableId}/grids |
|
||||
| Meta | Get | dbView | gridColumnsList | /api/v1/db/meta/grids/{gridId}/grid-columns |
|
||||
| Meta | Patch | dbView | gridColumnUpdate | /api/v1/db/meta/grid-columns/{columnId} |
|
||||
| Meta | Patch | dbView | update | /api/v1/db/meta/views/{viewId} |
|
||||
| Meta | Delete| dbView | delete | /api/v1/db/meta/views/{viewId} |
|
||||
| Meta | Post | dbView | showAllColumn | /api/v1/db/meta/views/{viewId}/show-all |
|
||||
| Meta | Post | dbView | hideAllColumn | /api/v1/db/meta/views/{viewId}/hide-all |
|
||||
| Meta | Get | dbViewColumn | list | /api/v1/db/meta/views/{viewId}/columns |
|
||||
| Meta | Post | dbViewColumn | create | /api/v1/db/meta/views/{viewId}/columns |
|
||||
| Meta | Patch | dbViewColumn | update | /api/v1/db/meta/views/{viewId}/columns/{columnId} |
|
||||
| Meta | Get | dbViewShare | list | /api/v1/db/meta/views/{viewId}/share |
|
||||
| Meta | Post | dbViewShare | create | /api/v1/db/meta/views/{viewId}/share |
|
||||
| Meta | Patch | dbViewShare | update | /api/v1/db/meta/views/{viewId}/share |
|
||||
| Meta | Delete| dbViewShare | delete | /api/v1/db/meta/views/{viewId}/share |
|
||||
| Meta | Get | plugin | list | /api/v1/db/meta/plugins |
|
||||
| Meta | Get | plugin | status | /api/v1/db/meta/plugins/{pluginTitle}/status |
|
||||
| Meta | Post | plugin | test | /api/v1/db/meta/plugins/test |
|
||||
| Meta | PATCH | plugin | update | /api/v1/db/meta/plugins/{pluginId} |
|
||||
| Meta | Get | plugin | read | /api/v1/db/meta/plugins/{pluginId} |
|
||||
| Meta | Get | project | metaGet | /api/v1/db/meta/projects/{projectId}/info |
|
||||
| Meta | Get | project | modelVisibilityList | /api/v1/db/meta/projects/{projectId}/visibility-rules |
|
||||
| Meta | Post | project | modelVisibilitySet | /api/v1/db/meta/projects/{projectId}/visibility-rules |
|
||||
| Meta | Get | project | list | /api/v1/db/meta/projects |
|
||||
| Meta | Post | project | create | /api/v1/db/meta/projects |
|
||||
| Meta | Get | project | read | /api/v1/db/meta/projects/{projectId} |
|
||||
| Meta | Delete| project | delete | /api/v1/db/meta/projects/{projectId} |
|
||||
| Meta | Get | project | auditList | /api/v1/db/meta/projects/{projectId}/audits |
|
||||
| Meta | Get | project | metaDiffGet | /api/v1/db/meta/projects/{projectId}/meta-diff |
|
||||
| Meta | Post | project | metaDiffSync | /api/v1/db/meta/projects/{projectId}/meta-diff |
|
||||
| Meta | Get | project | sharedBaseGet | /api/v1/db/meta/projects/{projectId}/shared |
|
||||
| Meta | Delete| project | sharedBaseDisable | /api/v1/db/meta/projects/{projectId}/shared |
|
||||
| Meta | Post | project | sharedBaseCreate | /api/v1/db/meta/projects/{projectId}/shared |
|
||||
| Meta | Patch | project | sharedBaseUpdate | /api/v1/db/meta/projects/{projectId}/shared |
|
||||
| Meta | Post | storage | upload | /api/v1/db/storage/upload |
|
||||
| Meta | Post | storage | uploadByUrl | /api/v1/db/storage/upload-by-url |
|
||||
| Meta | Get | utils | commentList | /api/v1/db/meta/audits/comments |
|
||||
| Meta | Post | utils | commentRow | /api/v1/db/meta/audits/comments |
|
||||
| Meta | Get | utils | commentCount | /api/v1/db/meta/audits/comments/count |
|
||||
| Meta | Post | utils | auditRowUpdate | /api/v1/db/meta/audits/update |
|
||||
| Meta | Get | utils | cacheGet | /api/v1/db/meta/cache |
|
||||
| Meta | Delete| utils | cacheDelete | /api/v1/db/meta/cache |
|
||||
| Meta | Post | utils | testConnection | /api/v1/db/meta/projects/connection/test |
|
||||
| Meta | Get | utils | appInfo | /api/v1/db/meta/nocodb/info |
|
||||
| Meta | Get | utils | appVersion | /api/v1/version |
|
||||
| Meta | Get | utils | appHealth | /api/v1/health |
|
||||
| Meta | Get | utils | aggregatedMetaInfo | /api/v1/aggregated-meta-info |
|
||||
| Meta | Get | orgUsers | list | /api/v1/users |
|
||||
| Meta | Post | orgUsers | add | /api/v1/users |
|
||||
| Meta | Patch | orgUsers | update | /api/v1/users/{userId} |
|
||||
| Meta | Delete | orgUsers | delete | /api/v1/users/{userId} |
|
||||
| Meta | Get | orgTokens | list | /api/v1/tokens |
|
||||
| Meta | Post | orgTokens | create | /api/v1/tokens |
|
||||
| Meta | Delete | orgTokens | delete | /api/v1/tokens/{token} |
|
||||
| Meta | Get | orgAppSettings | get | /api/v1/app-settings |
|
||||
| Meta | Post | orgAppSettings | set | /api/v1/app-settings |
|
||||
|
||||
## Query params
|
||||
|
||||
| **Name** | **Alias** | **Use case** | **Default value** |**Example value** |
|
||||
|---|---|---|---|---|
|
||||
| [where](#comparison-operators) | [w](#comparison-operators) | Complicated where conditions | | `(colName,eq,colValue)~or(colName2,gt,colValue2)` <br />[Usage: Comparison operators](#comparison-operators) <br />[Usage: Logical operators](#logical-operators) |
|
||||
| limit | l | Number of rows to get (SQL limit value) | 10 | 20 |
|
||||
| offset | o | Offset for pagination (SQL offset value) | 0 | 20 |
|
||||
| sort | s | Sort by column name, Use `-` as prefix for descending sort | | column_name |
|
||||
| fields | f | Required column names in result | * | column_name1,column_name2 |
|
||||
| shuffle | r | Shuffle the result for pagination | 0 | 1 (Only allow 0 or 1. Other values would see it as 0) |
|
||||
|
||||
<!--
|
||||
| fields1 | f1 | Required column names in child result | * | column_name1,column_name2 |
|
||||
| bt | | Comma-separated belongs to tables | `All belongs to tables` | [click here for example](#nested-parentbelongs-to) |
|
||||
| bfields`<p>` | bf`<p>` | Required belongs to table column names in result. Where `<p>` refers to position of table name in `bt` parameter(starts from `1`) | primary key and primary value | [click here for example](#nested-parentbelongs-to) |
|
||||
| hm | | Comma-separated has many tables | `All hasmany tables` | [click here for example](#nested-childrenhas-many) |
|
||||
| hfields`<p>` | hf`<p>` | Required has many table column names in result. Where `<p>` refers to position of table name in `hm` parameter(starts from `1`) | primary key and primary value | [click here for example](#nested-childrenhas-many) |
|
||||
| mm | | Comma-separated many to many tables | `All many to many tables` | [click here for example](#nested-childrenmany-to-many) |
|
||||
| mfields`<p>` | mf`<p>` | Required many to many table column names in result. Where `<p>` refers to position of table name in `mm` parameter(starts from `1`) | primary key and primary value | [click here for example](#nested-childrenmany-to-many) |
|
||||
-->
|
||||
|
||||
## Comparison Operators
|
||||
|
||||
| Operation | Meaning | Example |
|
||||
|---|---|---|
|
||||
| eq | equal | (colName,eq,colValue) |
|
||||
| neq | not equal | (colName,neq,colValue) |
|
||||
| not | not equal (alias of neq) | (colName,not,colValue) |
|
||||
| gt | greater than | (colName,gt,colValue) |
|
||||
| ge | greater or equal | (colName,ge,colValue) |
|
||||
| lt | less than | (colName,lt,colValue) |
|
||||
| le | less or equal | (colName,le,colValue) |
|
||||
| is | is | (colName,is,true/false/null) |
|
||||
| isnot | is not | (colName,isnot,true/false/null) |
|
||||
| in | in | (colName,in,val1,val2,val3,val4) |
|
||||
| btw | between | (colName,btw,val1,val2) |
|
||||
| nbtw | not between | (colName,nbtw,val1,val2) |
|
||||
| like | like | (colName,like,%name) |
|
||||
| isWithin | is Within (Available in `Date` and `DateTime` only) | (colName,isWithin,sub_op) |
|
||||
| allof | includes all of | (colName,allof,val1,val2,...) |
|
||||
| anyof | includes any of | (colName,anyof,val1,val2,...) |
|
||||
| nallof | does not include all of (includes none or some, but not all of) | (colName,nallof,val1,val2,...) |
|
||||
| nanyof | does not include any of (includes none of) | (colName,nanyof,val1,val2,...) |
|
||||
|
||||
## Comparison Sub-Operators
|
||||
|
||||
The following sub-operators are available in `Date` and `DateTime` columns.
|
||||
|
||||
| Operation | Meaning | Example |
|
||||
|-----------------|-------------------------|-----------------------------------|
|
||||
| today | today | (colName,eq,today) |
|
||||
| tomorrow | tomorrow | (colName,eq,tomorrow) |
|
||||
| yesterday | yesterday | (colName,eq,yesterday) |
|
||||
| oneWeekAgo | one week ago | (colName,eq,oneWeekAgo) |
|
||||
| oneWeekFromNow | one week from now | (colName,eq,oneWeekFromNow) |
|
||||
| oneMonthAgo | one month ago | (colName,eq,oneMonthAgo) |
|
||||
| oneMonthFromNow | one month from now | (colName,eq,oneMonthFromNow) |
|
||||
| daysAgo | number of days ago | (colName,eq,daysAgo,10) |
|
||||
| daysFromNow | number of days from now | (colName,eq,daysFromNow,10) |
|
||||
| exactDate | exact date | (colName,eq,exactDate,2022-02-02) |
|
||||
|
||||
For `isWithin` in `Date` and `DateTime` columns, the different set of sub-operators are used.
|
||||
|
||||
| Operation | Meaning | Example |
|
||||
|------------------|-------------------------|-----------------------------------------|
|
||||
| pastWeek | the past week | (colName,isWithin,pastWeek) |
|
||||
| pastMonth | the past month | (colName,isWithin,pastMonth) |
|
||||
| pastYear | the past year | (colName,isWithin,pastYear) |
|
||||
| nextWeek | the next week | (colName,isWithin,nextWeek) |
|
||||
| nextMonth | the next month | (colName,isWithin,nextMonth) |
|
||||
| nextYear | the next year | (colName,isWithin,nextYear) |
|
||||
| nextNumberOfDays | the next number of days | (colName,isWithin,nextNumberOfDays,10) |
|
||||
| pastNumberOfDays | the past number of days | (colName,isWithin,pastNumberOfDays,10) |
|
||||
|
||||
## Logical Operators
|
||||
|
||||
| Operation | Example |
|
||||
|---|---|
|
||||
| ~or | (checkNumber,eq,JM555205)~or((amount, gt, 200)~and(amount, lt, 2000)) |
|
||||
| ~and | (checkNumber,eq,JM555205)~and((amount, gt, 200)~and(amount, lt, 2000)) |
|
||||
| ~not | ~not(checkNumber,eq,JM555205) |
|
||||
68
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/030.sdk.md
vendored
Normal file
68
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/030.sdk.md
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
---
|
||||
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="/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="/developer-resources/rest-apis" target="_blank">here</a>.
|
||||
|
||||
:::
|
||||
|
||||
#### Example: Calling API - /api/v1/db/meta/projects/{projectId}/tables
|
||||
|
||||
```js
|
||||
await api.dbTable.create(params)
|
||||
```
|
||||
225
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/040.webhooks.md
vendored
Normal file
225
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/040.webhooks.md
vendored
Normal file
@@ -0,0 +1,225 @@
|
||||
---
|
||||
title: "Webhooks"
|
||||
description: "Webhooks allows user to trigger on certain operations on following database operations"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Some types of notifications can be triggered by a webhook after a particular event.
|
||||
|
||||
### Open `View menu`, click on `Webhooks`
|
||||
|
||||
<img width="442" alt="image" src="https://user-images.githubusercontent.com/35857179/194849113-910ddafa-4b05-4492-a7a6-d9259d892eb9.png" />
|
||||
|
||||
### Click `Add New Webhook`
|
||||
|
||||
<img width="686" alt="image" src="https://user-images.githubusercontent.com/35857179/194849248-1d0b80c6-f65b-4075-8ebd-af7dc735c2c3.png" />
|
||||
|
||||
### Configure Webhook
|
||||
|
||||
- General configurations
|
||||
- Webhook Name
|
||||
- Webhook Trigger
|
||||
- Webhook Type
|
||||
- Webhook Type specific configuration : additional configuration details depending on webhook type selected
|
||||
- Webhook Conditional Trigger
|
||||
- Only records meeting the criteria will trigger webhook
|
||||
|
||||
<!--  -->
|
||||

|
||||
|
||||
|
||||
<!--  -->
|
||||
|
||||
## Call Log
|
||||
|
||||
Call Log allows user to check the call history of the hook. By default, it has been disabled. However, it can be configured by using environment variable `NC_AUTOMATION_LOG_LEVEL`.
|
||||
|
||||
- `NC_AUTOMATION_LOG_LEVEL=OFF`: No logs will be displayed and no history will be inserted to meta database.
|
||||
- `NC_AUTOMATION_LOG_LEVEL=ERROR`: only error logs will be displayed and history of error logs will be inserted to meta database.
|
||||
- `NC_AUTOMATION_LOG_LEVEL=ALL`: Both error and success logs will be displayed and history of both types of logs will be inserted to meta database. **This option is only available for Enterprise Edition.**
|
||||
|
||||

|
||||
|
||||
|
||||
## Triggers
|
||||
|
||||
Webhooks allows user to trigger on certain operations on following database operations
|
||||
|
||||
- AFTER INSERT
|
||||
- AFTER UPDATE
|
||||
- AFTER DELETE
|
||||
|
||||
The triggers will trigger asynchronously without blocking the actual operation.
|
||||
|
||||
### Applications/services
|
||||
|
||||
| Trigger | Details |
|
||||
| --------------- | ---------------------------------------------- |
|
||||
| Email | Send email to certain email addresses |
|
||||
| Slack | Notify via Slack channel |
|
||||
| Microsoft Teams | Notify via Microsoft Teams channel |
|
||||
| Discord | Notify via Discord channel |
|
||||
| Mattermost | Notify via Mattermost channel |
|
||||
| Twilio | Send SMS to certain mobile numbers |
|
||||
| Whatsapp Twilio | Send Whatsapp messages to numbers using Twilio |
|
||||
| URL | Invoke an HTTP API |
|
||||
|
||||
|
||||
## Accessing Data: Handlebars
|
||||
|
||||
|
||||
:::caution
|
||||
|
||||
You can access data using handlebars for v1 webhooks only.
|
||||
|
||||
:::
|
||||
|
||||
The current row data and other details will be available in the hooks payload so the user can use [handlebar syntax](https://handlebarsjs.com/guide/#simple-expressions) to use data.
|
||||
|
||||
> We are using [Handlebars](https://handlebarsjs.com/) library to parse the payload internally.
|
||||
|
||||
### Example
|
||||
|
||||
For a table with column names (id, title, created_at, updated_at).
|
||||
For INSERT/ UPDATE based triggers, use following handlebars to access corresponding **data** fields.
|
||||
|
||||
- {{ **data**.id }}
|
||||
- {{ **data**.title }}
|
||||
- {{ **data**.created_at }}
|
||||
- {{ **data**.updated_at }}
|
||||
|
||||
Note that, for Update trigger - all the fields in the ROW will be accessible, not just the field updated.
|
||||
For DELETE based triggers, **only** {{ data.id }} is accessible representing ID of the column deleted.
|
||||
|
||||
### JSON format
|
||||
|
||||
Use {{ json data }} to dump complete data & user information available in JSON format
|
||||
|
||||
### Additional references:
|
||||
|
||||
[Handlebar Guide](https://handlebarsjs.com/guide/).
|
||||
|
||||
# Application Guide
|
||||
|
||||
## Discord
|
||||
|
||||
### 1. Create WebHook
|
||||
|
||||
- On Discord, open your Server Settings and head into the Integrations tab:
|
||||
- Click the "Create Webhook" button to create a new webhook!
|
||||
|
||||

|
||||
|
||||
- Choose channel to which this webhook will post to.
|
||||
- Copy webhook URL
|
||||
|
||||

|
||||
|
||||
(Sample webhook URL: https://discord.com/api/webhooks/945558283756908644/GNUtiGuzfOky6wZ4ce30XuXc1sbPK3Od7EC-4t6hihh5Fovv6oU9OsdT6mGuoL1QlTzj).
|
||||
Detailed procedure for discord webhook described [here](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks).
|
||||
|
||||
### 2. Install Plugin
|
||||
|
||||
- Open 'App Store' (under Settings), hover over Discord tile. Click 'Install'.
|
||||
|
||||

|
||||
<!--  -->
|
||||
|
||||
- Provide a name of your choice (not to be confused with Discord Channel name).
|
||||
- Paste Discord Webhook URL copied from Step (1.) above.
|
||||
|
||||

|
||||
<!--  -->
|
||||
|
||||
### 3. Configure
|
||||
|
||||
- Open project and choose a table.
|
||||
- Click 'More' > 'Webhooks'.
|
||||
- Click 'Create webhook'
|
||||
- Configure webhook
|
||||
- **Title**: Name of your choice to identify this Webhook.
|
||||
- **Event**: Trigger event. Choose between.
|
||||
- After Insert: Trigger event for new ROW insertion.
|
||||
- After Update: Trigger event for existing ROW updation.
|
||||
- After Delete: Trigger event for ROW deletion
|
||||
- **On Condition**: [Optional] Enable if you wish to associate additional condition/constraint with the trigger configured above.
|
||||
- **Notification**: Select 'Discord'.
|
||||
- **Select Discord Channels**: Select from the drop down list, channel name configured in Step (2). Please click on 'Reload' if drop down list is empty.
|
||||
- **Body**: Message to be posted over Discord channel, via webhooks on trigger of configured event.
|
||||
- Body can contain plain text &
|
||||
- Handlebars {{ }}
|
||||
|
||||
|
||||
## Slack
|
||||
|
||||
### 1. Create WebHook
|
||||
- Details to create slack webhook are captured [here](https://api.slack.com/messaging/webhooks)
|
||||
|
||||
### 2. Install Plugin
|
||||
- Procedure remain same as listed for DISCORD channel configuration above
|
||||
|
||||
### 3. Configure Webhook
|
||||
- Procedure remain same as listed for DISCORD channel configuration above
|
||||
|
||||
|
||||
## Microsoft Teams
|
||||
### 1. Create WebHook
|
||||
|
||||
- On Teams, open your channel, click on three-dots menu (far right) and select 'Connectors'
|
||||
|
||||
<img width="319" alt="154971352-6912d53b-cf71-4edd-a319-1c85be85f0c5" src="https://user-images.githubusercontent.com/86527202/155095745-91abd708-834f-4f0e-a33c-ac362e60af0f.png" />
|
||||
|
||||
|
||||
- Select incoming webhook & click 'Configure'
|
||||
|
||||
<img width="442" alt="154971434-0ced97f7-205a-4e2e-8f88-17092cb7771a" src="https://user-images.githubusercontent.com/86527202/155095741-b23ad6b2-1276-46e3-8ada-0d0a871115bb.png" />
|
||||
|
||||
- Create webhook, Copy webhook URL
|
||||
|
||||

|
||||
|
||||
|
||||
### 2. Install Plugin
|
||||
|
||||
- Open 'App Store' (under Settings), hover over 'Microsoft Teams' tile. Click 'Install'.
|
||||
|
||||

|
||||
|
||||
<!--  -->
|
||||
|
||||
|
||||
- Provide a name of your choice (not to be confused with Teams Channel name).
|
||||
- Paste MS Teams Webhook URL copied from Step (1.) above.
|
||||
|
||||

|
||||
|
||||
<!-- <img width="414" alt="154971222-7fe2c25a-d8c6-46b0-ba1e-a05ff1cf6537" src="https://user-images.githubusercontent.com/86527202/155095720-ff1c052c-a4a7-4c10-8f30-d779dac336f3.png" /> -->
|
||||
|
||||
### 3. Configure
|
||||
|
||||
- Open project and choose a table.
|
||||
- Click 'More' > 'Webhooks'.
|
||||
- Click 'Create webhook'
|
||||
- Configure webhook
|
||||
- **Title**: Name of your choice to identify this Webhook.
|
||||
- **Event**: Trigger event. Choose between.
|
||||
- After Insert: Trigger event for new ROW insertion.
|
||||
- After Update: Trigger event for existing ROW updation.
|
||||
- After Delete: Trigger event for ROW deletion
|
||||
- **On Condition**: [Optional] Enable if you wish to associate additional condition/constraint with the trigger configured above.
|
||||
- **Notification**: Select 'Microsoft Teams'.
|
||||
- **Select Teams Channels**: Select from the drop down list, channel name configured in Step (2). Please click on 'Reload' if drop down list is empty.
|
||||
- **Body**: Message to be posted over Teams channel, via webhooks on trigger of configured event.
|
||||
- Body can contain plain text &
|
||||
- Handlebars {{ }}
|
||||
|
||||
## Webhook V2
|
||||
|
||||
Webhook v2 is available after v0.106.0. Here's the differences.
|
||||
|
||||
- Response Payload has been predefined and cannot configure in Body using Handlebars. The payload can be referenced under `Sample Payload` in Hook detail page.
|
||||
- Support the following bulk operations:
|
||||
- AFTER BULK INSERT
|
||||
- AFTER BULK UPDATE
|
||||
- AFTER BULK DELETE
|
||||
138
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/050.upload-via-api.md
vendored
Normal file
138
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/050.upload-via-api.md
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
---
|
||||
title: 'Upload via API'
|
||||
description: 'Upload files locally present or from public remote URL via API'
|
||||
hide_table_of_contents: true
|
||||
---
|
||||
|
||||
Sample code to upload files via API is listed below.
|
||||
Assumes `http://localhost:8080/` as the base URL for the API calls.
|
||||
|
||||
# Upload local file
|
||||
|
||||
```
|
||||
let axios = require("axios").default;
|
||||
let FormData = require('form-data');
|
||||
let fs = require('fs');
|
||||
|
||||
// Configurations
|
||||
//
|
||||
const project_id = '<Project Identifier>';
|
||||
const table_id = '<Table Identifier>';
|
||||
const xc_token = '<Auth Token>';
|
||||
const file_path = '<Local File Path>';
|
||||
|
||||
|
||||
// Insert Image
|
||||
// @param image_path : local file path
|
||||
// @return : JSON object to be used in insert record API for attachment field
|
||||
//
|
||||
async function insertImage (path) {
|
||||
const formData = new FormData();
|
||||
formData.append("file", fs.createReadStream(path));
|
||||
const data = await axios({
|
||||
url: 'http://localhost:8080/api/v1/db/storage/upload',
|
||||
data: formData,
|
||||
headers:{
|
||||
'Content-Type':`multipart/form-data;`,
|
||||
'xc-auth': xc_token
|
||||
},
|
||||
method: 'post',
|
||||
|
||||
// Optional : storage file path
|
||||
params: {"path": "somePath"}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
// Insert record with attachment
|
||||
// Assumes a table with two columns :
|
||||
// 'Title' of type SingleLineText and
|
||||
// 'Attachment' of type Attachment
|
||||
//
|
||||
async function uploadFileExample() {
|
||||
let response = await insertImage(file_path);
|
||||
|
||||
let row = {
|
||||
"Title": "2",
|
||||
"Attachment": response.data
|
||||
};
|
||||
|
||||
await axios({
|
||||
method: 'POST',
|
||||
url: `http://localhost:8080/api/v1/db/data/noco/${project_id}/${table_id}`,
|
||||
data: row,
|
||||
headers: {
|
||||
'xc-auth': xc_token
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await uploadFileExample();
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
# Upload via URL
|
||||
|
||||
```
|
||||
let axios = require("axios").default;
|
||||
let FormData = require('form-data');
|
||||
let fs = require('fs');
|
||||
|
||||
// Configurations
|
||||
//
|
||||
const project_id = '<Project Identifier>';
|
||||
const table_id = '<Table Identifier>';
|
||||
const xc_token = '<Auth Token>';
|
||||
|
||||
// URL array : URLs of files to be uploaded
|
||||
const URLs = [{ url: '<URL1>' }, { url: '<URL2>' }];
|
||||
|
||||
// Insert Image
|
||||
// @param URLs : [] containing public URL for files to be uploaded
|
||||
// @return : JSON object to be used in insert record API for attachment field
|
||||
//
|
||||
async function insertImageByURL (URL_array) {
|
||||
const data = await axios({
|
||||
url: 'http://localhost:8080/api/v1/db/storage/upload-by-url',
|
||||
data: URL_array,
|
||||
headers: {
|
||||
'xc-auth': xc_token
|
||||
},
|
||||
method: 'post',
|
||||
|
||||
// Optional : storage file path
|
||||
params: {"path": "somePath"}
|
||||
});
|
||||
return data;
|
||||
}
|
||||
|
||||
// Insert record with attachment
|
||||
// Assumes a table with two columns :
|
||||
// 'Title' of type SingleLineText and
|
||||
// 'Attachment' of type Attachment
|
||||
//
|
||||
async function uploadByUrlExample() {
|
||||
let response = await insertImageByURL(URLs);
|
||||
|
||||
// Update two columns : Title and Attachment
|
||||
let row = {
|
||||
"Title": "3",
|
||||
"Attachment": response.data
|
||||
};
|
||||
|
||||
await axios({
|
||||
method: 'POST',
|
||||
url: `http://localhost:8080/api/v1/db/data/noco/${project_id}/${table_id}`,
|
||||
data: row,
|
||||
headers: {
|
||||
'xc-auth': xc_auth
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
await uploadByUrlExample();
|
||||
})();
|
||||
```
|
||||
5
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/_category_.json
vendored
Normal file
5
packages/noco-docs/versioned_docs/version-0.109.7/040.developer-resources/_category_.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"label": "Developer Resources",
|
||||
"collapsible": true,
|
||||
"collapsed": true
|
||||
}
|
||||
Reference in New Issue
Block a user