# estimateTax refactor to CreateTransaction

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

# estimateTax refactor to CreateTransaction

Learn how to migrate from `estimateTax` in RESTv1 to `CreateTransaction` in RESTv2.

This example describes how to migrate from [estimateTax](https://developer.avalara.com/api-reference/avatax/rest/v1/methods/estimateTax/) in RESTv1 to [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) in RESTv2.

Notice in the RESTv1 example that the request uses GET. In this request, provide the latitude, longitude, and sale amount to estimate the taxes. The RESTv2 example uses POST. In this request, create a transaction using a document `type` of `SalesOrder`.

## **Examples**

**RESTv1 example**

```
curl
  -X GET
  -H 'Accept: application/json'
  -H' Authorization: Basic ${btoa(`:`)}'
  'https://development.avalara.net/1.0/tax/123456789,987654321/get?saleamount=100'
```

**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' 
```