usingSystem;usingSystem.Net;// Requires reference to Systme.Runtime.Serialization assembly.usingSystem.Runtime.Serialization.Json;// See the 'Sample code' for a package containing the struct definitions.usingMFiles.Mfws.Structs;publicclassAuthenticationSample{publicstaticstringAuthenticate(stringusername,stringpassword,stringvaultGuid){// Create the authentication details.varauth=newAuthentication{Username=username,Password=password,VaultGuid=vaultGuid// Use GUID format with {braces}.};// Create the web request.varrequest=WebRequest.Create("http://example.org/REST/server/authenticationtokens");request.Method="POST";// Serialize the authentication details into the request.varserializer=newDataContractJsonSerializer(typeof(Authentication));serializer.WriteObject(request.GetRequestStream(),auth);// Get the response.varresponse=request.GetResponse();// Deserialize the authentication token.vardeserializer=newDataContractJsonSerializer(typeof(PrimitiveType<string>));vartoken=(PrimitiveType<string>)deserializer.ReadObject(response.GetResponseStream());// Return the token to the caller for future requests.Console.WriteLine(token.Value);returntoken.Value;}}