usingSystem;usingSystem.Net;usingSystem.Runtime.Serialization.Json;usingMFiles.Mfws.Structs;publicclassCreationSample{publicstaticObjectVersionCreateObject(stringauthToken){// Create the object creation info.varcreationInfo=newObjectCreationInfo{PropertyValues=new[]{newPropertyValue{PropertyDef=0,TypedValue=newTypedValue{DataType=MFDataType.Text,Value="Invoice"}},newPropertyValue{PropertyDef=22,TypedValue=newTypedValue{DataType=MFDataType.Boolean,Value=false}},newPropertyValue{PropertyDef=100,TypedValue=newTypedValue{DataType=MFDataType.Lookup,Lookup=newLookup{Item=0}}}}};// Create the web request.varrequest=WebRequest.Create("http://example.org/REST/objects/0");request.Headers["X-Authentication"]=authToken;request.Method="POST";// Serialize the authentication details into the request.varserializer=newDataContractJsonSerializer(typeof(ObjectCreationInfo));serializer.WriteObject(request.GetRequestStream(),creationInfo);// Get the response.varresponse=request.GetResponse();// Deserialize the information on the created object.vardeserializer=newDataContractJsonSerializer(typeof(ObjectVersion));varcreatedObject=(ObjectVersion)deserializer.ReadObject(response.GetResponseStream());// Return the created object.Console.WriteLine(createdObject.Title);returncreatedObject;}}