Lesson 4 of 8
In Progress

Create project, API Snippet, fetch and token

icarus November 17, 2022
LanguageARCHDADEENESFIFRGRHEHIINITJAMSNENLNOPTSVSWATHTR

How to set up a new project to host.

  1. Create a new Project and create a new Table
  2. To grab the API access code for our Next.js project, click on [Get API Snippet] on the bottom right hand corner of your UI.
  3. As we are working with a Next.js project and the fetch API already comes with the package — we will be using fetch as a method of retrieving our table information.
  4.  Copy and save this into a javascript file inside your Next.js project.
    • Disclaimer: there might be modifications needed depending on the framework you use! 
  5. Navigate to `Team and Settings` in the bottom left hand corner, create your own token. 
  6. Back to the code. For fetch methods, replace `xc-auth` to `xc-token` and replace the string with the token obtained from `API Tokens Management`
    • Note: using `xc-auth` is not recommended for security reasons.
  7. Back to the Next.js project:
    1. Create a new javascript file and copy and paste the code obtained from NocoDB.
    2. Don’t forget to export the Javascript function so it can be called through pages in the project!