PostFormEncoded
- Last UpdatedSep 07, 2018
- 1 minute read
This method calls the POST api which supports the x-www-form-urlencoded post.
Method 1:
IExtensionsWebAPI.PostFormEncoded(EndPoint, PostData, Handler)
Parameters
-
EndPoint: Web Api End point of Get request
-
PostData: Data to be posted as Lua table
-
Handler: Handler Method of Lua script to handle the response JSON data.
Method 2:
IExtensionsWebAPI.PostFormEncoded(EndPoint, PostData, Handler, HeaderCollection)
Parameters
-
EndPoint: Web Api End point of Get request
-
PostData: Data to be posted as Lua table
-
Handler: Handler Method of Lua script to handle the response JSON data.
-
HeaderCollection: Header collection in form of Table
Example
local loginDetail = {}
loginDetail["username"] = "abhinav.kumar"
loginDetail["password"] = "Password"
local returnvalue = "something"
function Calculate(params)
local headerCollection = {}
headerCollection["ZUMO-API-VERSION"] = "2.0.0"
local response = IExtensionsWebAPI.PostFormEncoded("https://www.example.com/api/login", loginDetail, "Handle", headerCollection)
return returnvalue
end
function Handle(result)
returnvalue = result["data"]["first_name"]
end