put https://secure.fusebill.com/v1/CustomerAddressPreferences
This function allows you to edit a customer address preferences resource. The id
field in the body is the ID of the customer you wish to update the preferences for.
Customer Address Preferences Fields
Field | Data Type | Description |
---|---|---|
id | Integer | This is the Customer ID (Fusebill ID) of the custom to whom these preferences apply. |
shippingInstructions | String | This free field allows you to specify instructions for shipping. [Max Length: 50 characters] |
useBillingAsShipping | Boolean | This determins if this resource will have both a shipping and billing address or if it will use the billing address for both. |
contactName | String | This field can be used to store the contact name of the recipient, if different from the name stored in the address. [Max Length: 50 characters] |
Examples
curl -X PUT "https://secure.fusebill.com/v1/CustomerAddressPreferences" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerId:{customerId},contactname:'John',shippingInstructions:'Signature required.',useBillingAddressAsShippingAddress:true,billingAddress:null,shippingAddres:null}"
//Json data, Fusebill Id which corresponds to the customerId Field
string jsonData = "{id:{customerId},contactname:'John',shippingInstructions:'Signature required.',useBillingAddressAsShippingAddress:true,billingAddress:null,shippingAddres:null}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/CustomerAddressPreferences");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "PUT";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(jsonData);
streamWriter.Flush();
streamWriter.Close();
}
//Perform the request
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dictionary to the Payload parameter
payload = {"contactName":"John
Doe","shippingInstructions":None,"useBillingAddressAsShippingAddress":"true","billingAddress":None,"shippingAddress":None,"id":{id},"uri":"https://stg-
secure.fusebill.com/v1/CustomerAddressPreferences/{id}"}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/customerAddressPreferences', data=json.dumps(payload), headers=headers)
print(r.content)
{
"contactName": "Alex Goldstien",
"shippingInstructions": "Leave package by the side door",
"useBillingAddressAsShippingAddress": true,
"billingAddress": {
"customerAddressPreferenceId": 654144,
"companyName": "Electricity Inc",
"line1": "10 April Rd",
"line2": "Unit A",
"countryId": null,
"country": null,
"stateId": null,
"state": "New York",
"city": "New York",
"postalZip": "12345",
"addressType": "Billing",
"valid": true,
"id": 262515,
"uri": "https://secure.fusebill.com/v1/addresses/262515"
},
"shippingAddress": null,
"id": 654144,
"uri": "https://secure.fusebill.com/v1/customeraddresspreferences/654144"
}
Response
{
"contactName": "Frank",
"shippingInstructions": "signature required",
"useBillingAddressAsShippingAddress": true,
"billingAddress": null,
"shippingAddress": null,
"id": 84072,
"uri": "https://secure.fusebill.com/v1/customerAddressPreferences/84072"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "customerAccountPreference.useBillingAddressAsShippingAddress",
"Value": "Error converting value {null} to type 'System.Boolean'. Path 'useBillingAddressAsShippingAddress', line 4, position 46."
}
]
}