Talk:Sample Code

From DevWiki

Jump to: navigation, search

Here is a simple example in Java:

import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;

public class Test {
	public static void main(String[] args) 
		throws Exception {
				
		URL url = new URL("http://YourUrl/net/WebService.aspx?Login=YourEmail@YourDomain.com&EncryptedPassword=YourPassword&API_Name=Generic\\Products&SELECT_Columns=p.ProductCode,p.ProductID,p.ProductName,p.StockStatus");
		InputStream stream = null;
		byte[] buffer = new byte[1024];
		int read;
		
		HttpURLConnection connection = (HttpURLConnection)url.openConnection();
		connection.setRequestMethod("POST");
		connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
		connection.setRequestProperty("Content-Action", "Volusion_API");
		connection.setRequestProperty("Content-Length", "0");
		connection.connect();
		stream = connection.getInputStream();
				
		while (-1 != (read = stream.read(buffer))) {
            		System.out.write(buffer, 0, read);
		}		
		
		stream.close();
	}
}

Query String Parameters

Is there a list of available query string parameters for this? I have seen "API_Name", "EDI_Name", etc and don't know the variations of each.

Navigation