Example to post data to netsuite url

Posted on 2012-09-05
Medium Priority
Last Modified: 2012-09-05
Hello Experts
I wanted to write a windows applicaion using vb.net 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

Accepted Solution

newbie27 earned 2000 total points
ID: 38367559
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("https://forms.netsuite.com/app/site/hosting/scriptlet.nl?script=97&deploy=1&compid=TSTDRV799164&h=fda074e46d984a31121e&internalid=162&phone=999-999-9999");

            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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

840 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