API Post
You can use this function to enable the API integration with the application.
Purpose
This function is used to add a new data by sending a request to the server.
Syntax
FsSrvAppResponse response = APIPost(string symbol, string ObjectKey, string inputJSON)
Arguments
Part | Type | Description |
---|---|---|
symbol |
String |
The type of object. Use empty quotation marks to indicate the symbol of the current object for the workflow, or the new object for the copy method. |
objectkey | String |
The object key for which context attributes can be added. Use empty quotation marks to indicate the current object for the workflow or the new object for the copy method. |
inputJSON | String |
The JSON payload to access with Optiva to process API |
Example
When a workflow is started in an action set, this scripting function is executed.
Steps
- Create a new Action “APIGET_ITEMCREATE” and specify this script:
Option Strict Off Imports System Imports System.Diagnostics Imports Formation.Shared.Defs Class ActionScript Inherits FcProcFuncSetEventWF Function wf_start() As Long Dim jsonString As String = "{""FSITEM"": [{""ITEM_CODE"": ""MKPTEST2"", ""DESCRIPTION"": ""Mkp2 Desc""}]}" Dim createresponse As FsSrvAppResponse = APIPost(_OBJECTSYMBOL, "MKPTEST2", jsonString) If createresponse.hasError Then MessageList("Error Occured while creating") Dim responseError As APIResponseErrors = createresponse.ProcessErrors() For Each errorMessage As String In responseError.Errors MessageList(errorMessage) Next else MessageList("Item created") End If End Function End Class
- Navigate to
- Create a new Action Set
- Assign the Action “APIGET_ITEMCREATE” in the Steps grid
- Assign a User Code and the description in the row
- Navigate to Security tab and assign the desired User/Role/Group
- Assign “ITEM” as the Target Data symbol and save the Action Set
- Navigate to , open any object
- Click on and launch the “APIGET_ITEMDESCR” workflow