REST API Configuration
REST API acts as a communication link between two platforms, enabling interaction through methods like GET (retrieve), POST (create), PUT (update), and DELETE (remove).
Ways to Configure REST API in noKodr: Rest API can be executed using Model and Workflows
noKodr platform > Login > Layout > Open a layout > Workflow > Rest API Action
noKodr platform > Login > Layout > Open a layout > Model
Prerequisite: Create a Named Credentials, Auth Provider and establish a connection. Refer to Named Credentials and Auth Provider.
Steps to Create Named Credentials:
In Salesforce Setup, navigate to ”Named Credentials” under ”Security.”
Click ”New Named Credential.”
Enter the details, including the name, URL, and identity type.
Configure the authentication settings based on the requirements (e.g., password, OAuth, or JWT).
Save the Named Credential.
Steps to Create Auth Provider:
In Salesforce Setup, go to ”Auth. Providers” under ”Security Controls.”
Click ”New” to create a new Auth. Provider.
Select the type of provider (e.g., OpenID Connect, SAML, etc.).
Fill in the necessary details such as the name, callback URL, and other provider-specific settings.
Configure the authentication settings and set the appropriate scopes or permissions.
Save the Auth. Provider configuration.
By following these steps, you can create named credentials and an auth provider in Salesforce to establish secure external connections and authenticate users for various integration and external services
Steps to create a connection with external source in noKodr:
Create an Account to the respective web application you want to integrate with noKodr
Get the ’Client ID’ and ’Client secret key’ of that web application.
Create the auth Provider in salesforce.
Create the Named Credential in Salesforce using Legacy
Open noKodr and Create a Model using Connection as API
Request for the operation you want to perform by clicking the ‘Request’ tab of the ‘Update Model’
Click on the ‘Response’ tab of the ‘Update Model’ to generate schema as per the response you want to get.
Click on Merge.
API Type Model: The API type model acts as a communication link between two platforms, enabling interaction through methods like GET (retrieve), POST (create), PUT (update), and DELETE (remove).
How to configure API type model:
Prerequisite: Create a Connected App, Named Credentials, Auth Provider and establish a connection as mentioned above
Create of Model with the following field values:
Type: API
Connection: Choose the desired connection to fetch records from
Label: Auto-populates, mirroring the connection Label
Name: Auto-populates, mirroring the connection name
Execute on load: If checked, records will be fetched automatically upon loading the component
Create Model
Click on the Request tab and choose the values respectively.
Method: Choose from HTTP methods like Get, Post, Put, Delete, Head, or Patch based on the operation you want to perform
URL: Add the relevant URL that corresponds to the connection from which you wish to get, create, update, or delete records
Record Count: Set the record count to either Multirecord or Single, depending on whether you are dealing with multiple records or a single record in the data operation
Body>Schema Designer:
Schema DesignerThere are two ways to provide the request body.
Generate Schema: Users can define fields using JSON format. For example ”Date”: ”05/12/2023”, ”Date and Time”:”05/12/2023 11:40 AM”, ”Double”: 51.21, ”Integer”: 399, ”Object”: ””, ”Text”: ”Smith”
Create New Fields: Users can create fields using the create field Model
Click on the Response tab and choose the values respectively.
Response: The user can create a new response with the help of the status code
Schema Designer:
Generate Schema: Users can define fields using JSON format. For example ”Date”: ”05/12/2023”, ”Date and Time”:”05/12/2023 11:40 AM”, ”Double”: 51.21, ”Integer”: 399, ”Object”: ””,”Text”: ”Smith”, ”Array”: []
Create New Fields: Users can create fields using the create field Model
CRUD using Rest API with Model in Workflow:
To Fetch Records: Use Get Method >
Create a new layout
Table Setup:
Drag and drop a Table component onto the layout Designer
Add Table action as New and Refresh
Add row action on Table as Edit and Delete
Assign Model to Table Component
Assign a model to the Table with the following details:
Type: API
Connection: Choose a connection e.g. Sales Connect
Label gets Auto-populates e.g. Sales Connect
Name gets Auto-populates e.g. Sales Connect
Request
Request with the following details:
Method: GET
URL: /services/data/v56.0/query?q=select id, name, site from account
Record Count: Multirecord
Response: Define or create a schema to fetch the response. This schema will structure the data received from the API call ”data”: ”records”: ”Name”: ” ”, ”Id”: ” ”, ”Site”: ”
In Component Attributes:
Model: Select the model e.g. Sales Connect
Schema Source: Select ”Response” as the source
Response Code: Set the response code to 200
In Fields:
Select data > record
Click on the Table component, and the Model fields will be displayed on the left side
Drag-drop the fields on the Table component
Create a new workflow (defining Label and Name)
Show Spinner Action:
Drag and drop the ”Show Spinner Action”
Define layout item (e.g., Table), variant, and size
Rest API Action:
Drag and drop the ”Rest API Action”
Set the Source API Type to Model
Choose the Model (e.g., Sales Connect) assigned to the Table
Hide Spinner Action:
Drag and drop the ”Hide Spinner Action”
Define the layout item
Connect Actions:
Connect the actions in the workflow
Call the workflow on component events
Refresh: table Action
Select Action as Workflow
Select Config and define Workflow: (Select the workflow created for Get e.g. Get and Save)
Save & Run the Layout
Preview
On preview, click on the Refresh Button.
The Get workflow will be executed, fetching the records
To Create Records: To POST >
Create a new layout
Form Setup:
Drag and drop a Form component onto layout Designer
Add Form Action as Cancel and Save
Assign Model to Form Component
Assign a model to the Form with the following details:
Type: API
Connection: Choose a connection e.g. Sales Connect
Label gets Auto-populates e.g. Sales Connect
Name gets Auto-populates e.g. Sales Connect
Request
Request with the following details:
Method: Post
URL: /services/data/v56.0/sobjects/Account
Record Count: Single
Body > Schema Designer Define or create a schema to fetch the response. This schema will structure the data received from the API call ”Name”: ” ”, ”Site”: ” ”
Response
Response with the following details
No need to define response for POST
In Component Attributes:
Basic:
Model: Select the model e.g. Sales Connect
Schema Source: Select ”Request” as the source
Now Fields will be displayed at the left corner drag and drop the fields on the form
Create a new workflow (defining Label and Name)
Rest API Action
Drag and drop the ”Rest API Action”
Set the Source API Type to Model
Choose the Model (e.g., Sales Connect) assigned to the Form
Toaster Action:
Drag and drop the ”Toaster Action.”
Fill Type with ”Success” and Message with ”Record created successfully!”
Save the Toaster Action
Emit Action:
Drag and drop the ”Emit Action”
Add the event you have created
Save the Emit Action
Connect Actions:
Connect the actions in the workflow
Call the workflow on component events
Click on the form and navigate to Events > Save : Action.
Select Action as Workflow
Select Config and define Workflow: (Select the workflow created for Post e.g. Post and Save)
Save & Run the Layout
Preview: On preview, check if the record is getting saved by clicking on the Save Button
Note: To execute CRUD for the Rest API go to the layout where you have drag dropped the table. Follow these steps on the layout where you have drag-dropped the table
Create a Pop and refresh workflow
Drag and drop POP action and add a label and Save
Drag and drop Workflow action and select the workflow created for the Refresh Button
Connect the actions and Save the workflow
Click on the table and navigate to Events > New : tableAction
Select Action as Push Modal
Select Config and define Push Modal model
Layout: Choose the layout created for the POST method e.g Connection Post
Event: Select the event created on the POST Method layout
Workflow: Select the Pop and Refresh workflow and Save
Save & Run the Layout
Preview:
On preview, click on the New Button.
And Fill the data in the fields and save
Check the same on the Connected app i.e. Salesforce Account >navigate to Accounts from app launcher > view the change
To Update Records: Patch>
Create a new layout
Form Setup:
Drag and drop a Form component onto the layout Designer
Add Form Action as Cancel and Update
Create a variable:
Add Label & Name
Type: Object
Add Schema:
Add Label and Name
Field Type: Object
Schema: Add Schema Id, Name, and Site
Click Save
Assign Model to Form Component
Assign a model to the Form with the following details:
Type: API
Connection: Choose a connection e.g. Sales Connect
Label gets Auto-populates e.g. Sales Connect
Name gets Auto-populates e.g. Sales Connect
Request
Request with the following details
Method: Patch
URL:/services/data/v56.0/sobjects/Account/variable:object.Id (Note: Use merge text for Id)
Record Count: Single
Body > Schema Designer Define or create a schema to fetch the response. This schema will structure the data received from the API call ”Name”: ” ”, ”Site”: ” ”
Response: No need to define response for Patch
In Component Attributes:
Basic
Model: Select the model e.g. Sales Connect
Schema Source: Select ”Request” as the source
Now Fields will be displayed at the left corner drag and drop the fields on the form
Create a new workflow (defining Label and Name)
Workflow 1: For e.g. name it as Put Data
Log Action:
Drag and drop the Log Action
In the Config section, add Log Source: Variable and choose the Variable: Select the variable you created
Add Action details and save the log action
Assignment Action:
Drag and drop the Assignment Action
Add conditions: Condition 1:
Destination Type: Model
Model: Select the model assigned to the Form
Schema Source: Request
Fields: Keep it blank, but ensure that fields are visible
Operator: Set
Source Type: Variable
Variable: Select the variable you created at the start
Condition 2:
Destination Type: Model
Model: Select the model assigned to the Form
Schema Source: Request
Fields: Id
Operator: Set
Source Type: Null
Connect Actions
Connect the actions in the workflow
Save the workflow
Assign Workflow 1 on the on-load event of the form Workflow 2. For e.g. name it as Patch Records
Rest API Action:
Drag and drop the ”Rest API Action”
Set the Source API Type to Model
Choose the Model (e.g., Sales Connect) assigned to the Form
Toaster Action:
Drag and drop the ”Toaster Action.”
Fill Type with ”Success” and Message with ”Record updated successfully!”
Save the Toaster Action
Emit Action:
Drag and drop the ”Emit Action”
Add the event you have created
Save the Emit Action
Connect Actions: Connect the actions in the workflow
Save the workflow
Assign Workflow 2 on the Update button
Save & Run the Layout
Preview: On preview, check if the record is getting saved by clicking on the Update Button.
Note: To execute CRUD for the Rest API, go to the layout where you have drag-dropped the table. Follow these steps on the layout where you have drag-dropped the table:
Create a Pop and refresh workflow
Drag and drop POP action and add a label and Save
Drag and drop the Workflow action and select the workflow created for Refresh Button
Connect the actions and Save the workflow
Click on the table and navigate to Events > Edit: tableAction
Select Action as Push Modal
Select Config and define the Push Modal model
Layout: Choose the layout created for the Patch method e.g Patch Records
Event: Select the event created on the Patch Method layout
Workflow: Select the Pop and Refresh workflow
Click Save
On Events > Add mapping on Edits workflow
Input Variable: Select the variable created on the patch layout
Operator: Set
Source Type: Output Variable
Output Variable: Record
Save & Run the Layout
Preview:
On preview, click on the Edit Button i.e. row action
Fill the data in the fields and update
Check the same on the Connected app i.e. Salesforce Account >navigate to Accounts from app launcher > view the change
To Delete Records: Delete
Create a workflow in Rest API Presentation where you have dragged and dropped the table details
Request:
For URL merge text follow
Note: No need to define Schema for delete
Response: No need to define a response for Delete
Workflow: Delete Records
Prompt Action: Drag and drop the prompt action
Rest API Action: Drag and drop the Rest API action
Toaster Action: Drag and drop the Toaster action
Connect Actions: Connect the actions in the workflow
Save the workflow
Assign the workflow on table action Delete
Click on the table > Events > Delete :rowAction
Add mapping on the workflow
Save and Run the layout 10. Preview: On preview, check if the record is getting deleted by clicking on the delete button Button.
Check the same on the Connected app eg. Salesforce Account >navigate to Accounts from the app launcher > view the change.