程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> .NET invoke NetSuite Restlet,netsuiterestlet

.NET invoke NetSuite Restlet,netsuiterestlet

編輯:C#入門知識

.NET invoke NetSuite Restlet,netsuiterestlet


Please indicate the source if you need to repost.

Restlet allows programmers to use the http request instead of SuietTalk.

Below is the sample code for .NET coder to begin with:

private void button1_Click(object sender, EventArgs e) { string myUrl = your_restlet_url; HttpWebRequest request = HttpWebRequest.Create(myUrl) as HttpWebRequest; request.ContentType = "application/json"; // Account: setup>integration>Web Services Preferences: Account ID // Email: your NetSuite login email // Signature: NetSuite login password // Role: admin = 3 request.Headers.Add("Authorization:NLAuth nlauth_account=1005259,[email protected],nlauth_signature=,nlauth_role=3"); request.Method = "POST"; string myParam = "{\"mydata1\":1234,\"mydata2\":2345}"; using (var streamWriter = new StreamWriter(request.GetRequestStream())) { streamWriter.Write(myParam); } HttpWebResponse response = request.GetResponse() as HttpWebResponse; } .NET Sample Code

 

Below is the sample code of Restlet:

function restlets_post(datain) { try { nlapiLogExecution('debug', 'restlets_get', datain.mydata2); var mystring='{"data1":123,"data2":234}'; var myJson=parseJSON(mystring); return myJson; } catch (ex) { nlapiLogExecution('debug', 'restlets_post', ex); } } Restlet Code

 

Hope it helps the life of SuiteTalk developer.

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved