.NET invoke NetSuite Restlet

本文介绍了一种使用Restlet和.NET代替SuiteTalk的方法,提供了.NET和Restlet的示例代码,有助于.NET开发者更高效地进行集成开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Please indicate the source if you need to repost.

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

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,nlauth_email=xxx@netsuite.com,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.

转载于:https://www.cnblogs.com/caidaniel/p/5543350.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值