API Put

You can use this function to enable the API integration with the application.

Purpose

This function is used to update the existing data by sending a request to the server.

Syntax


FsSrvAppResponse response =  APIPut(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_ITEMUPDATE” 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 updString As String = "{""FSITEM"": [{""DESCRIPTION"": ""MKPTEST2 - EN Desc""}]}"
        Dim updresponse As FsSrvAppResponse = APIPut(_OBJECTSYMBOL,"MKPTEST2", updString)
        If updresponse.hasError Then
            MessageList("Error Occured while updating")
            Dim responseError As APIResponseErrors = updresponse.ProcessErrors()
            For Each errorMessage As String In responseError.Errors
                MessageList(errorMessage)
            Next
        else
            MessageList("Item Updated")
        End If
    End Function
    End Class
    
  • Navigate to Configure > Action Set
  • Create a new Action Set
  • Assign the Action “APIGET_ITEMUPDATE” 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 Develop > Item, open any object
  • Click on Launch Workflow and launch the “APIGET_ITEMDESCR” workflow