title: MAXIMO API 7.6.1 POST to create service requests programmatically creates null records, but the same work in POSTMAN
body: <p>I am trying to use MAXIMO 7.6.1 API to create requests in MAXIMO through POST requests programmatically.</p>
  
  <p><strong>Problem 1:</strong> </p>
  
  <p>The problem is, though the POST is successful .i.e I am getting a 201.</p>
  
  <p>Only null records are being created.</p>
  
  <p>However the same request when done using POSTMAN works perfectly.</p>
  
  <p><strong>Here is my programmatic implementation:</strong></p>
  
  <pre><code>    var jsonData = JsonConvert.SerializeObject(somemodel);
      string MaximoUrl = @"someurl/maxrest/oslc/os/mxapisr";
      WebRequest request = (HttpWebRequest)WebRequest.Create(MaximoUrl);
      request.Headers["authheaderkey"] = "authheadervalue";
      request.Headers["properties"] = "*";
      request.Method = "POST";
      request.ContentType = "application/json";
  
      using (var RequestStream = new StreamWriter(request.GetRequestStream()))
              {
                  RequestStream.Write(jsonData);
              }
  
              string ResponseResult;
  
              HttpWebResponse RequestResponse = (HttpWebResponse)request.GetResponse();
              using (var ResponseReader = new StreamReader(RequestResponse.GetResponseStream()))
              {
                  ResponseResult = ResponseReader.ReadToEnd();
              }
  </code></pre>
  
  <p><em>The above creates a record but creates null records.</em></p>
  
  <p><strong>Same in POSTMAN:</strong>
  <a href="https://i.stack.imgur.com/s4Ky1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s4Ky1.png" alt="request Headers"></a></p>
  
  <p><a href="https://i.stack.imgur.com/G0fEv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G0fEv.png" alt="Request body"></a></p>
  
  <p><strong>Problem 2:</strong></p>
  
  <p>When I include query string parameters in the request url I get a 400 Bad Request. 
  Again, the same works in POSTMAN.</p>
  
  <p>This works: </p>
  
  <blockquote>
    <p>string MaximoUrl = @"someurl/maxrest/oslc/os/mxapisr";</p>
  </blockquote>
  
  <p>This doesn't:</p>
  
  <blockquote>
    <p>string MaximoUrl = @"someurl/maxrest/oslc/os/mxapisr?lean=1";</p>
  </blockquote>
  
  <p>I believe this is a problem with how MAXIMO understands requests.</p>
  
  <p>model being sent:</p>
  
  <pre><code>public class obj
      {
          public Int64 ticketuid { get; set; }
  
          public string ticketid { get; set; }
  
          public string description { get; set; }
  
          public string reportedby { get; set; }
  
          public int rc { get; set; }
  
          public string workt { get; set; }
  
          public string ownergroup { get; set; }
  
          public string siteid { get; set; }
  
          public string reportedemail { get; set; }
  
          public string affectedemail { get; set; }
  
          public DateTime? changedate { get; set; }
  
          public DateTime? affecteddate { get; set; }
  
          public DateTime? reportdate { get; set; }
  
          public DateTime? statusdate { get; set; }
  
          public DateTime? desireddate { get; set; }
  
          public string description_longdescription { get; set; }
  
          public string assetnum { get; set; }
  
          public string location { get; set; }
  
          public string status { get; set; }
  
      }
  </code></pre>