Modifying an Existing Customer
To modify an existing customer’s primary contact information, fetch the customer data from Fusebill, apply your desired changes, and resubmit a full customer edit to the Fusebill system.
This is achieved by doing a GET Customer followed by a PUT Customer against the customer object.
Use this tutorial to edit:
- Customer Contact information (Company name / First Name / Last Name)
- Customer Reference information
- Customer Sales Tracking Code information
Follow these steps when modifying an existing customer:
Step 1 - Find the Customer
If you have stored the Fusebill ID of the customer in your system then call:
Get Customer - Fusebill ID
If you need to find the customer using your own customer code that you have stored on the customer then call:
Get Customer - Your ID
GET https://secure.fusebill.com/v1/customers/?query=reference:YourCode
Sample Request
curl -X GET "https://secure.fusebill.com/v1/customers/1234" \
-H "Content-Type: application/json" \
-H "Authorization: Basic YourAPIKeyHere"
//path parameter
int customerID = 1234;
//Setup API key
string apiKey = "Your Api Key Here";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/customers/"+customerID);
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "GET";
//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();
}
Sample Response
{
"firstName": "Samantha",
"middleName": "Payne",
"lastName": "Gillespie",
"companyName": "Cuizine",
"suffix": "Jr.",
"primaryEmail": "[email protected]",
"primaryPhone": 8784473067,
"secondaryEmail": "[email protected]",
"secondaryPhone": 8955793436,
"title": "Dr",
"reference": 100986,
"status": "Draft",
"customerAccountStatus": "Good",
"currency": "USD",
"customerReference": {
"reference1": null,
"reference2": "customValue",
"reference3": null,
"salesTrackingCodes": [],
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
},
"customerAcquisition": {
"adContent": null,
"campaign": null,
"keyword": null,
"landingPage": null,
"medium": null,
"source": null,
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
},
"monthlyRecurringRevenue": 250,
"netMonthlyRecurringRevenue": 220,
"salesforceId": 12345678,
"salesforceAccountType": null,
"salesforceSynchStatus": "Enabled",
"netsuiteId": 12345678,
"netsuiteSynchStatus": "Enabled",
"netsuiteCustomerType": "Individual",
"portalUserName": "Shields1974",
"parentId": 12000749,
"quickBooksLatchType": null,
"quickBooksId": null,
"quickBooksSyncToken": null,
"hubSpotId": null,
"modifiedTimestamp": "2019-11-07T15:51:11.1915461Z",
"id": 12000750,
"uri": "https://secure.fusebill.com/v1/customers/12000750"
}
Step 2 - Update the Customer
Modify the desired field in the customer JSON object and then do a full update customer call:
Update Customer
**Sample Request
curl -X PUT "https://secure.fusebill.com/v1/customers" \
-H "Content-Type: application/json" \
-H "Authorization: Basic YourAPIKeyHere" \
-d "{ firstName: 'James', middleName: 'Gilliam', lastName: 'Campbell', companyName: 'Nitracyr', suffix: 'Jr.', primaryEmail: '[email protected]', primaryPhone: '8545163066', secondaryEmail: '[email protected]', secondaryPhone: '9135892729', title: 'Ms', reference: '100986', status: 'Active', currency: 'NZD', customerReference: { reference1: 'some string 1', reference2: 'some string 2', reference3: 'some string 3', salesTrackingCodes: [ { type: 'Sales Tracking Code 1', code: 'Alpha' } ] }, customerAcquisition: { adContent: null, campaign: null, keyword: null, landingPage: null, medium: null, source: null }, parentId: 12000749, quickBooksLatchType: 'Enabled', quickBooksId: 12345, hubSpotId: 12345, id: 1524982}
//Json Payload
string jsonData = "{{ 'firstName': 'James', 'middleName': 'Gilliam', 'lastName': 'Campbell', 'companyName': 'Nitracyr', 'suffix': 'Jr.', 'primaryEmail': '[email protected]', 'primaryPhone': 8545163066, 'secondaryEmail': '[email protected]', 'secondaryPhone': 9135892729, 'title': 'Ms', 'reference': 100986, 'status': 'Active', 'currency': 'NZD', 'customerReference': { 'reference1': 'some string 1', 'reference2': 'some string 2', 'reference3': 'some string 3', 'salesTrackingCodes': [ { 'type': 'Sales Tracking Code 1', 'code': 'Alpha' } ] }, 'customerAcquisition': { 'adContent': null, 'campaign': null, 'keyword': null, 'landingPage': null, 'medium': null, 'source': null }, 'parentId': 12000749, 'quickBooksLatchType': 'Enabled', 'quickBooksId': 12345, 'hubSpotId': 12345, 'id': 1524982}}";
//Setup API key
string apiKey = "Your Api Key Here";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://stg-secure.fusebill.com/v1/customers");
//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();
}
Sample Response
{
"firstName": "Alex",
"middleName": "A",
"lastName": "Dokes",
"companyName": null,
"suffix": null,
"primaryEmail": "[email protected]",
"primaryPhone": "613.729.2698",
"secondaryEmail": null,
"secondaryPhone": null,
"title": "Mr",
"reference": null,
"status": "Active",
"customerAccountStatus": "Good",
"currency": "USD",
"customerReference": {
"reference1": null,
"reference2": null,
"reference3": null,
"salesTrackingCodes": [
{
"type": "Sales Tracking Code 1",
"code": "testdata",
"name": "Test Data",
"id": 3982,
"uri": "https://secure.fusebill.com/v1/SalesTrackingCodes/3982"
}
],
"id": 144085,
"uri": "https://secure.fusebill.com/v1/customers/144085"
},
"customerAcquisition": {
"adContent": null,
"campaign": null,
"keyword": null,
"landingPage": null,
"medium": null,
"source": null,
"id": 144085,
"uri": "https://secure.fusebill.com/v1/customers/144085"
},
"monthlyRecurringRevenue": 1500,
"netMonthlyRecurringRevenue": 1500,
"salesforceId": null,
"salesforceAccountType": null,
"salesforceSynchStatus": "Enabled",
"netsuiteId": null,
"netsuiteCustomerType": "",
"portalUserName": null,
"parentId": null,
"id": 144085,
"uri": "https://secure.fusebill.com/v1/customers/144085"
}
GET/PUT pattern
For most PUT endpoints in the API the best practice is to use a GET first and modify the results. Any editable field that is not provided in a PUT request will be interpreted as a null value. This means that if customer
lastName
were being edited butfirstName
was not provided, thefirstName
will be removed in the PUT
Updated about 3 years ago
Next, you can try modifying a customer's billing settings.