Skip to content

API Details (settings)

  • In one API version user can create many APIs with different settings and codes.
  • Users can clone APIs and delete APIs that are not published.
  • Once the API version is published user can not add, or delete any new API.

API Details code

import { IApiSchemaUI, ERequestMethod, EAPICategoryRedis, EApiRequestBodyType } from 'store-types';
import * as ST from 'store-types';
import * as T from 'types';

let apiSchema: IApiSchemaUI = {
    path: '/hello-world',
    name: 'Hello World',
    requestMethod: ERequestMethod.POST,
    categoryRedis: EAPICategoryRedis.GET_DATA,
    reqBodySchema: {
        name: <T.ISchemaProperty>{
            __type: T.EType.string,
            validations: {
                required: true
            }
        }
    },
    reqQueryParametersSchema: {
        queryParam: <T.ISchemaProperty>{
            __type: T.EType.string,
            validations: {
                required: true
            }
        }
    },
    errorList: [ 
        'Unable to process this request',
    ],
};
module.exports = apiSchema;
  • The path is the string value. It should be unique with the combination of 'requestMethod'.
  • name is the API name. It should be unique. API Maker user should use the name while calling the installed third party API.
  • Save the method of the API in the requestMethod key. It supports the 'GET | POST | PUT | DELETE' methods.
  • categoryRedis has two values. If it has 'GET_DATA' it means nothing to do with the Redis cache but if the value is 'MODIFY_DATA' it will reset the Redis cache.
  • If the API requires some request data and the API owner wants to set validations they can use the reqBodySchema object.
  • Set the validations of the requested query params in the reqQueryParametersSchema object.
  • errorList is the array of strings. If API owners want to custom error response they can write here. When API Maker users install that third-party API they can set this error message to 'internationalization' as per their requirement.