Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Mobile Operator

Get

  • Last UpdatedOct 02, 2018
  • 1 minute read

This method make calls to the Get request of Web API services

Method 1:

IExtensionsWebAPI.Get(EndPoint, Handler)

Parameters

  • EndPoint: Web Api End point of Get request

  • Handler: Handler Method of Lua script to handle the response JSON data.

Method 2:

IExtensionsWebAPI.Get(EndPoint, Handler, HeaderCollection)

Parameters

  • EndPoint: Web Api End point of Get request

  • Handler: Handler Method of Lua script to handle the response JSON data.

  • HeaderCollection: Header collection in form of Table

Example

This example will update the text field with first name from the response assuming response is

{

"data": {

"id": 2,

"first_name": "Janet",

"last_name": "Weaver",

"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg"

}

}

Lua Script

local returnvalue = "something"

function Calculate(params)

local headerCollection = {}

headerCollection["ZUMO-API-VERSION"] = "2.0.0"

local response = IExtensionsWebAPI.Get("https://reqres.in/api/users", "Handle", headerCollection)

return returnvalue

end

function Handle(result)

returnvalue = result["data"]["first_name"]

end

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in