Put
- Last UpdatedSep 07, 2018
- 1 minute read
This method will be used for calling PUT api. The data should be in JSON fromat.
Method 1:
IExtensionsWebAPI.Put(EndPoint, Data, Handler)
Parameters
-
EndPoint: Web Api End point of Get request
-
Data: Data to be be updated as string in JSON fromat
-
Handler: Handler Method of Lua script to handle the response JSON data.
Method 2:
IExtensionsWebAPI.Put(EndPoint, Data, Handler, HeaderCollection)
Parameters
-
EndPoint: Web Api End point of Get request
-
Data: Data to be updated as string in JSON fromat
-
Handler: Handler Method of Lua script to handle the response JSON data.
-
HeaderCollection: Header collection in form of Table
Example
local data = '{"name": "paul rudd"}'
local returnvalue = "something"
function Calculate(params)
local headerCollection = {}
headerCollection["ZUMO-API-VERSION"] = "2.0.0"
local response = IExtensionsWebAPI.Put("https://www.example.com/api/users/2", data, "Handle", headerCollection)
return returnvalue
end
function Handle(result)
returnvalue = result["data"]["name"]
end