Anel Hodzic

Anel Hodzic

  • NA
  • 66
  • 31.7k

REST API - EXAMPLE

Nov 18 2017 2:11 PM
Need an example how to make this API call from .NET
 Prefered VB/C#
 

  1.   

    <form method="POST" action="https://creator.zoho.eu/api/sampleapps/json/sample/form/Employee/record/update">
    <input type="hidden" name ="authtoken" value="**********">
    <input type="hidden" name ="scope" id="scope" value="creatorapi">
    <input type="text" name="criteria" value="Name=Gary">

    <input type="text" name="Basic" value="20000">
    <input type="text" name="Address" value="UK">

    <input type="submit" value="Update Record">
    </form>

 I tried like this
 
 
  1. Public Function getResponseFromUrl(ByVal url As StringByVal params As String)  
  2.         Dim str As String = ""  
  3.         Try  
  4.             Dim webreq As HttpWebRequest = WebRequest.Create(url)  
  5.             webreq.Method = "POST"  
  6.             webreq.ContentType = "application/x-www-form-urlencoded"  
  7.             Dim byteArray As Byte() = Encoding.UTF8.GetBytes(params)  
  8.             Dim dataStream As Stream = webreq.GetRequestStream()  
  9.             dataStream.Write(byteArray, 0, byteArray.Length)  
  10.             dataStream.Close()  
  11.   
  12.             Dim res As WebResponse = webreq.GetResponse()  
  13.             Dim stream As Stream = res.GetResponseStream()  
  14.             Dim streamReader As New StreamReader(stream)  
  15.             str = streamReader.ReadToEnd  
  16.         Catch ex As Exception  
  17.             MsgBox(ex.ToString)  
  18.         End Try  
  19.         Return str.ToString  
  20.     End Function  
 But dont know how to finish it
 
Original link of this  https://www.zoho.eu/creator/help/api/rest-api/rest-api-edit-records.html
 

Answers (2)