Example to post data to netsuite url

Posted on 2012-09-05
Last Modified: 2012-09-05
Hello Experts
I wanted to write a windows applicaion using to post data to the netsuite url. I am trying to some example code which I can use to post data to URL.
Can someone advise?
Question by:faisalkh
    1 Comment
    LVL 8

    Accepted Solution

    I have some example code in C#, I am sure you can easily convert into VB
    using System;
    using System.Net;
    using System.IO;
    namespace ConsoleApplication1
        class Program
            static void Main(string[] args)
                //URL includes the query string for the internal id for the record to be updated and the phone that will be used for the record update
                Uri url = new Uri("");
                HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
                myHttpWebRequest.Method = "POST"; // Set method POST or GET
                myHttpWebRequest.UserAgent = "Mozilla/5.0"; // Set the user agent which is the type of browser
                myHttpWebRequest.ContentType = "application/x-www-form-urlencoded;charset=UTF-8"; // Set the Content type
                // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable.
                // Calls the Suitelet which will process and process the response
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                // Retrieves the response from the Suitelet 
                Stream streamResponse = myHttpWebResponse.GetResponseStream();
                StreamReader streamRead = new StreamReader(streamResponse);
                Char[] readBuff = new Char[256];
                int count = streamRead.Read(readBuff, 0, 256);
                //Write the response on the console
                Console.WriteLine("Suitelet Response :\n");            
                while (count > 0)
                    String outputData = new String(readBuff, 0, count);
                    count = streamRead.Read(readBuff, 0, 256);
                // Release the response object resources.

    Open in new window


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Better way of writing the code 4 22
    How to list some OU in AD with visual basic .net 1 16
    Xamarin 10 19
    varchar (max) 5 22
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now