# getTax refactor to CreateTransaction

Source: https://developer.avalara.com/restv1-to-restv2-refactor-guide/new4574242764126/

# getTax refactor to CreateTransaction

Compare field differences between `getTax` (RESTv1) and `CreateTransaction` (RESTv2) and learn how to migrate.

The table below shows the differences in the fields between [getTax](https://developer.avalara.com/api-reference/avatax/rest/v1/methods/getTax/) (RESTv1) and [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) (RESTv2). In addition to these differences, the RESTv2 endpoint provides more fields that you can specify in a transaction. You can learn more about each of these fields in the [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) endpoint documentation.

The example below the table shows how to migrate from RESTv1 to RESTv2.

RESTv1

RESTv2

`Commit`

`commit`

`CompanyCode`

`companyCode`

`CustomerCode`

`customerCode`

`DocCode`

`docCode`

`DocType`

`type`

`DocDate`

`date`

`Lines`

`lines`

`Addresses`

`addresses`

`LineNo`

`number`

`DestinationCode`

N/A. This comes from the `addresses` object.

`OriginCode`

N/A. This comes from the `addresses` object.

`ItemCode`

`itemCode`

`TaxCode`

`taxCode`

`Description`

`description`

`Qty`

`quantity`

`Amount`

`amount`

`HashCode`

N/A

`ReferenceCode`

`referenceCode`

`CurrencyCode`

`currencyCode`

`ServiceMode`

`serviceMode`

`DetailLevel`

`debugLevel`

`ParameterBagItems`

`parameters`

`UserDefinedFields`

`userDefinedFields`

`MerchantSellerId`

`merchantSellerIdentifier`

`MarketplaceLiabilityType`

`marketplaceLiabilityType`

`TaxAmountByTaxTypes`

`taxAmountByTaxTypes`

`DeemedSellerType`

N/A

## **Examples**

**RESTv1 example**

```
curl 
  -X POST
  -H 'Accept: application/json' 
  -H' Authorization: Basic aHR0cHdhdGNoOmY='
  'https://development.avalara.net/1.0/tax/get'
  --data '{
    "Commit": "false",
    "Client": "AvaTaxSample",
    "CompanyCode": "CINC",
    "CustomerCode": "ABC4335",
    "DocCode": "INV001",
    "DocType": "SalesOrder",
    "DocDate": "2014-01-01",
    "Addresses": [
      {
        "AddressCode": "01",
        "Line1": "45 Fremont Street",
        "Line2": "Suite 100",
        "Line3": "ATTN Accounts Payable",
        "City": "Chicago",
        "Region": "IL",
        "Country": "US",
        "PostalCode": "60602"
      }
    ],
    "Lines": [
      {
        "LineNo": "1",
        "DestinationCode": "01",
        "OriginCode": "02",
        "ItemCode": "N543",
        "TaxCode": "NT",
        "Description": "Red Size 7 Widget",
        "Qty": "1",
        "Amount": "10"
      }
    ]
  }'
```

**RESTv2 example**

```
curl
  -X POST
  -H 'Accept: application/json'
  -H 'Authorization: Basic aHR0cHdhdGNoOmY='
  -H 'Content-Type: application/json'
  --data '{
    "companyCode": "",
    "code": "",
    "type": "SalesOrder",
    "customerCode": "TestCustomer",
    "addresses": {
      "SingleLocation": {
        "line1": "201 E North St",
        "city": "Magnolia",
        "region": "AR",
        "country": "US",
        "postalCode": "71753"
      }
    },
    "lines": [{
      "number": "Line 1",
      "quantity": 1,
      "amount": 100,
      "taxCode": "P0000000",
      "itemCode": "P12345",
      "description": "Item Description"
    }],
    "date": "2024-10-29T17:29:10.503Z"
  }
  'https://sandbox-rest.avatax.com/api/v2/transactions/create' 
```