Created
September 9, 2011 18:00
-
-
Save mimeoconnect/1206890 to your computer and use it in GitHub Desktop.
Doc APIs - Poster - Place Order (POST)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Web.UI; | |
using System.Web.UI.WebControls; | |
using System.Web.UI.HtmlControls; | |
using System.Data; | |
using System.IO; | |
using System.Net; | |
using System.Text; | |
using System.Xml; | |
namespace Mimeo | |
{ | |
public class Poster | |
{ | |
public void PlaceOrder() | |
{ | |
string userid = "[user id]"; | |
string userkey = "[user key]"; | |
string size = "11x17"; | |
string paperstock = "Premium Photo"; | |
string lamination = "None"; | |
string mounting = "None"; | |
string pdfurl = "[url of PDF]"; | |
string companyname = "Mimeo"; | |
string fullname = "Kin Lane"; | |
string firstname = "Kin"; | |
string lastname = "Lane"; | |
string careof = ""; | |
string streetaddress = "588 Sutter Street"; | |
string apartmentorsuite = "Suite 203"; | |
string city = "San Francisco"; | |
string state = "CA"; | |
string postalcode = "94102"; | |
string phone = "555-555-5555"; | |
string email = "[email protected]"; | |
string isresidential = "true"; | |
string quantity = "1"; | |
string shippingchoice = "Ground"; | |
string paymentmethod = "CreditCard"; | |
string ccnumber = "[credit card number]"; | |
string ccname = "[name on credit card]"; | |
string ccpostalcode = "[billing postal code]"; | |
string cctype = "[credit card type]"; | |
string ccexpirationmonth = "[credit card expiration month]"; | |
string ccexpirationyear = "[credit card expiration year]"; | |
string format = "json"; | |
string environment = "Sandbox"; | |
System.Text.StringBuilder build_url = new System.Text.StringBuilder(); | |
build_url("https://developer.mimeo.com/api/poster/placeorder/"); | |
string post_url = build_url(); | |
System.Text.StringBuilder build_post = new System.Text.StringBuilder(); | |
build_post("?userid="+userid); | |
build_post("&userkey="+userkey); | |
build_post("&size="+size); | |
build_post("&paperstock="+paperstock); | |
build_post("&lamination="+lamination); | |
build_post("&mounting="+mounting); | |
build_post("&pdfurl="+pdfurl); | |
build_post("&companyname="+companyname); | |
build_post("&fullname="+fullname); | |
build_post("&firstname="+firstname); | |
build_post("&lastname="+lastname); | |
build_post("&careof="+careof); | |
build_post("&streetaddress="+streetaddress); | |
build_post("&apartmentorsuite="+apartmentorsuite); | |
build_post("&city="+city); | |
build_post("&state="+state); | |
build_post("&postalcode="+postalcode); | |
build_post("&phone="+phone); | |
build_post("&email="+email); | |
build_post("&isresidential="+isresidential); | |
build_post("&quantity="+quantity); | |
build_post("&shippingchoice="+shippingchoice); | |
build_post("&paymentmethod="+paymentmethod); | |
build_post("&ccnumber="+ccnumber); | |
build_post("&ccname="+ccname); | |
build_post("&ccpostalcode="+ccpostalcode); | |
build_post("&cctype="+cctype); | |
build_post("&ccexpirationmonth="+ccexpirationmonth); | |
build_post("&ccexpirationyear="+ccexpirationyear); | |
build_post("&format="+format); | |
build_post("&environment="+environment); | |
string post_fields = build_post(); | |
HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create (post_url); | |
request.Method = "POST"; | |
StreamWriter postwriter = new StreamWriter(myHttpWebRequest dsds.GetRequestStream()); | |
postwriter.Write(post_fields); | |
postwriter.Close(); | |
string new_product_template = ""; | |
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) | |
{ | |
// Get the response stream | |
StreamReader reader = new StreamReader(response.GetResponseStream()); | |
// Console application output | |
response = reader.ReadToEnd(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment