Skip to content
Zach Harbort edited this page Aug 26, 2013 · 21 revisions

Here you will find notes and musings recorded during the development phase of postmaster-csharp.


Development

When making a web request, Postmaster does not return an initial 401 Unauthorized response. Because NetworkCredential expects this, we must explicitly set the Authorization header.

string credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(Config.ApiKey + ":" + Config.Password)); wc.Headers[HttpRequestHeader.Authorization] = "Basic " + credentials;


Validation

  • A property must contain a value of its expected type, even if unused (e.g. "name": "" GOOD, "name": null BAD)
  • U.S. States must be abbreviated
  • Explicitly setting the Country property forces a Customs object requirement

Clone this wiki locally