put https://secure.fusebill.com/v1/Addresses
This function is used to update an address resource. The address is linked to a specific customer when it is created.
Our shipping and billing address calls accept a variety of values for the Country ID and State ID key-value pairs. The Country ID and State ID fields allow you to use standard ISO 3166-2 Numeric and Subdivision ISO codes. ISO standards are defined and maintained by ISO 3166/MA. For your convenience, we have included downloads of these codes here:
Request Parameters
Field | Data Type | Description |
---|---|---|
companyName | String | The company name if applicable. [Max Length: 255] |
line1 | String | standard line 1 of an address. [Max Length: 60] |
line2 | String | standard line 2 of an address. [Max Length: 60] |
countryId | Integer | The ID of the country. Retrievable with the Read Country ID call. |
stateId | Integer | The ID of the state, province, or territory. Retrievable with the Read Country ID call. |
city | String | The city of the Customer. |
postalZip | String | The postal code or zip code. [Max Length: 10] |
id | Integer | The Fusebill generated ID of the address |
Examples
curl -X PUT "https://secure.fusebill.com/v1/Addresses" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{customerAddressPreferenceId:{customerId},id:{addressId},companyName:'Fusebill',line1:'232 Herzberg Road',line2:'Suite 203',countryId:124,country:'Canada',stateId:9,state:'Ontario',city:'Kanata',postalZip:'K2K 2A1',addressType:'Billing'}"
//Json data, Fusebill Id which corresponds to the customerId Field
string jsonData ="{customerAddressPreferenceId:{customerId},id:{addressId},companyName:'Fusebill',line1:'232 Herzberg Road',line2:'Suite 203',countryId:124,country:'Canada',stateId:9,state:'Ontario',city:'Kanata',postalZip:'K2K 2A1',addressType:'Billing'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/Addresses");
//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 ={"customerAddressPreferenceId":{id},"companyName":None,"line1":"","line2":None,"countryId":None,"country":None,"stateId":None,"state":None,"city":"","post
alZip":"","addressType":"Billing","id":{id},"uri":"https://stg-secure.fusebill.com/v1/addresses/{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)
{
"customerAddressPreferenceId": 650594,
"companyName": "EchoFoxtrot",
"line1": "10 Jupiter Ave.",
"line2": "suite 98",
"countryId": 124,
"country": "Canada",
"stateId": 2,
"state": "British Columbia",
"city": "Vancouver",
"postalZip": "V9C4V2",
"addressType": "Billing",
"valid": true,
"id": 260543,
"uri": "https://stg-secure.fusebill.com/v1/addresses/260543"
}
Response
{
"customerAddressPreferenceId": 84421,
"companyName": "DarkSide Inc.",
"line1": "768 Farside",
"line2": null,
"countryId": "124",
"country": "Canada",
"stateId": 9,
"state": "Ontario",
"city": "Ottawa",
"postalZip": "K3Y9Y7",
"addressType": "Billing",
"id": 63406
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "Address with id 12 not found."
}
]
}