---
title: Update
slug: quickbooks/ihiU-update
description: Learn how to update a vendor in QuickBooks using an example code. This document covers creating a map, initializing JSON data, sending a request to Breadwinner Global API, and receiving the updated vendor information including SyncToken, SFRecordID, and m
docTags: 
createdAt: 2021-10-30T07:54:59.000Z
---

The following is an example of update Vendor. The QuickBooks customer Id (id) is required to update the Vendor (See [Vendor](docId\:z5FQtVGTHWYGqeejRq2mi) for the available fields).

:::hint{type="info"}
Note:  You can only update one record at a time.

- When you want to update specific fields of an entity without affecting others, use a sparse update operation by setting sparse= 'true' in your request. This approach is more efficient and less prone to unintended changes than a full update.
:::

:::CodeblockTabs
Request

```apex
//  Create a Map to store all the data of a Vendor
Map<String, Object> vendorMap = new Map<String, Object>(); 
    vendorMap.put('DisplayName','Lap Care Match');
	vendorMap.put('Id','101');
	vendorMap.put('SyncToken','0');
        
//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('vendors', new List<Object>{vendorMap});
    String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'updateVendor');
    reqObj.put('requestJSON', reqJSON);
    //Required, if QuickBooks Multi-Org is enabled in Breadwinner. 
    reqObj.put('qbOrgId', '4620816365285051610');

//  Placing a request to Breadwinner Global API
Map<String, Object> respMap = breadwinner_qbo.BreadwinnerQBAPI.call(reqObj);
System.debug(respMap);
```

Response

```json
{
    action=updateVendor,
    responseJSON={
      "vendors": [
        {
          "SyncToken": "1",
          "sparse": false,
          "SFRecordID": "a085j000002D1uTAAS",
          "PrintOnCheckName": "Lap Care Match",
          "Metadata": {
            "LastUpdatedTime": "2021-11-01T00:36:54-07:00",
            "CreateTime": "2021-11-01T00:31:59-07:00"
          },
          "Id": "101",
          "DisplayName": "Lap Care Match",
          "CurrencyRef": {
            "value": "USD",
            "name": "United States Dollar"
          },
          "Balance": "0",
          "Active": "true"
        }
      ],
      "statusCode": 200
    },
    timestamp=1635752214968,
    validRequest=true,
    version=1.0
}
```
:::

