Authentication

All methods can be invoked with a mandatory Notardec API key and an optional user token First of all, you need to get your Notardec Key. Then you can use Notardec.
About Notardec keys

Step 1: Install dependencies
  npm install typescript --save-dev
  npm install axios
Step 2: Create function to request Notardec

We would recommend to put the key in the environment variables. This will make it easier to work with all the functions of Notardec in the future.

All authentication parameters are contained in the headers.

 'X-API-KEY': apiKey,
  Authorization: `Bearer token,

You need to pass your Notardec key in the X-API-KEY header. You need to pass your user token to the Authorization header (optional)

The following is a general example of a request. In this example, you can make any request. All information about requests can be found in swagger

import axios from 'axios';
async function createAsset(apiKey: string, token: string | null, payload: any): Promise<IResponse<any>> {
  const result = await axios.post<IResponse<any>>(`LINK`, payload, {
    headers: {
      'X-API-KEY': apiKey,
      Authorization: `Bearer ${token}`,
    },
  });
  return result.data;
}

Here, the first parameter we pass is the Notardec Key, the second is the token (optional parameter, the record can be created using the TEOS key), the third is the asset body. Each request to Notardec returns a response of the same type:

interface MetaResponse {
  size?: number;
  page?: number;
}

interface ErrorResponse {
  code: string;
  message: string;
}

interface IResponse<T> {
  value: T | null;
  meta?: MetaResponse;
  error?: ErrorResponse;
}

If the request was successful, the value field will contain the necessary information. If an error occurs, the value field will be null and the error field will contain an error (status and message)

Step 3: Confirm transaction

Then you need to confirm the transaction.
Learn more about transaction confirmation