Keyurp
Thank you for your reply. I am not sure I understand ‘first try on postman’. I am not sure what that means.
Were you able to create a customer using my sample code and json?
If so, then I must have something structured wrong somewhere else.
This is my complete code to create the json and call the Post api method
public void AddAmazonCustomer(string FirstName, string LastName, string Email, string Phone,
string Address1, string City, string State, string Zip, string Country)
{
var address = new Dictionary<string, object>();
address[“address1”] = Address1;
address[“city”] = City;
address[“province”] = State;
address[“phone”] = Phone;
address[“zip”] = Zip;
address[“last_name”] = LastName;
address[“first_name”] = FirstName;
address[“country”] = Country;
var customer = new Dictionary<string, object>();
customer[“first_name”] = FirstName;
customer[“last_name”] = LastName;
customer[“email”] = Email;
customer[“phone”] = Phone;
customer[“verified_email”] = true;
customer[“addresses”] = address;
var request = new Dictionary<string, object>();
request[“customer”] = customer;
string json = _serializer.Serialize(request);
var response = _api.Post(string.Format(“customers.json”), json);}
public string Post(string resource, string json)
{
string url = BuildResourceUrl(resource);
return _wc.UploadString(url, “POST”, json); – this is where I am getting my error (‘Bad Request’)
}
private string BuildResourceUrl(string query)
{
const string urlFormat = [email removed]
return string.Format(urlFormat, _apiKey, _apiPassword, _hostName, query);
}
My Get works fine and I am able to PUT (Update) an order, I am just having trouble with Customer object and don’t see what I am missing.
Thanks for your help on this.