I am trying to write figure out how can we call API method from and using asp.net c#
with following parameters and form-data, its working in Postman:
You can see it has four parameters named: action,user-id,type,format Whereas it has a form-data parameter named: data (needs to be a file)
I am able to do all using WebClient but unable to figure out POSTING file in data parameter of form-data. Here is what i tried
Public Function SetFingerData(UserId As Integer, FingerData1 As String) As Byte()
Dim Request = "http://" + IP + ":" + Port + "/device.cgi/credential?" + "action=set&type=1&user-id=" + UserId.ToString
Using client As New WebClient
Dim data = New NameValueCollection()
data.Add("data", FingerData1)
Dim result1 = client.UploadValues(Request, data)
Return result1
End Using
End Function
Any help!!!