Creating a New API Instance

This post is referring to Vahana 2 (beta version). To check the document for production, please go to vDesigner-v1.0

After you access the API module, you can create a new instance of an API that you have configured and published on the vConnect portal.

To create an API:

  1. On the API’s dashboard, click Create New to displays the Create New page.
  1. On the Create New page, in the Name box, enter the API’s name (for example, gstAuthentication).
  2. In the Description box, enter a brief reason to create the API or function of the API.
  3. After you enter the name and description of the API, see the Services area.
  4. In the Services area, select a service (for example, GST_ADVANCED_AUTHENTICATION) to create its instance.
  1. After you select the service, the Info panel expands.
  2. In the Info panel, click Consume, and the Services panel displays the following sections:
    • Request Parameters
    • Response Parameters
  3. After you consume the service, you need to configure the request parameters. The next section describes how to configure the request parameters.

Setting Request Parameters

This activity allows you to define the request parameters of an API. When an app posts the API request, it picks the data from the element, attribute (entity), or function. You can configure the request parameters as follows:

  1. In the Services panel, under Request, click the Body tab.
  2. In the Body tab, click Add Object to display the Add: Json Object dialog box.
  3. In the Add: Json Object dialog box, enter the code of the JSON object.
  1. After you enter the JSON code, click Save, and the Services area displays two panels as follows:
    • JSON Object:- It displays the list of attributes in the JSON structure.
    • Key Name:- In this panel, you need to select a key. When the app invokes the API, the API picks the value from the related key and stores it in the related attribute.
  2. Under JSON Object, find the attribute (for example, Gstin) that you want to map to a key.
  1. After you find the attribute, click the right check box, and a key name (for example, gstin) comes into view with the Value check box.
  1. In the Key Name panel, click in the Value box to expand a smart selector.
  2. The smart selector displays the following:
    • Elements (Reference name of elements)
    • Attributes
    • Functions
  1. In the smart select, select the element, attribute, or function (for example, InputField_9340).

Note:- After you select an item (element, attribute, or function) in the smart selector, the API request picks the value from the selected item.

  1. If you have more than one attribute in the request, repeat steps from step 5 to step 9.
  2. After you configure all request parameters, click Next to configure response parameters.

After you click Next, the Services panel dislays the Response area. To configure the response parameter, see the next heading section:

Setting Response Parameters

In the Services panel, the Response area displays the Complete tab by default. In the Complete tab, you configure a complete response that the API will return to the app. You can configure the API response as follows:

Case1:- (If you want to return a complete API response)

  1. In the Complete tab, see the Output Location box.
  1. Click in the Output Location box to expand a smart selector.
  2. In the smart selector, you can select the following items:
    • Element:- In the smart selector, you can select an element when you want to display a single data response, such as a boolean value, unique identification number, status, etc.
    • Entity:- In the smart selector, you can select an entity if you want to store a set of data that the API returns as a response.
  1. After you select an entity or element, click Review and Save to configure the API.

Case2:- (If you want to return a partial API response)

If you want to return a partial API response, you need to define a customized JSON structure. To define a customized JSON structure:

  1. In the Services panel, in the Response area, click the Define Object tab.
  2. In the Define Object tab, click Add Object to display the Add: Json Object dialog box.
  3. In the Add: Json Object dialog box, write or enter the response in the JSON code.
  1. After you enter the JSON code, click Save to configure the API response.
  2. Click Review and Save to configure API, the <<API Instance Name>> (for example, GST_ADVANCED_AUTHENTICATION) dialog box opens.
  3. The dialog box displays the configuration details of the API’s instance that you have defined in the request and response.
  1. After you review the configuration details of the API instance and make sure that they are correct, click Save.
  2. On the Create New page, click Create to create a new instance of the API.
  3. After the new instance of the API is successfully created, the APIs page displays the new API’s instance in a list.
Was this article helpful?
YesNo