# Onix API - Transfer orders (part 3/4) - Migrate from Web API to Onix API

**URL:** <https://community.onix.com/t/onix-api-transfer-orders-part-3-4-migrate-from-web-api-to-onix-api/626>\
**Category:** Knowledge base\
**Tags:** official, onix-api\
**Created:** [February 5, 2024, 2:30pm UTC](https://community.onix.com/t/onix-api-transfer-orders-part-3-4-migrate-from-web-api-to-onix-api/626 "2024-02-05T14:30:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![khoa.nguyen](https://dub1.discourse-cdn.com/flex013/user_avatar/community.onix.com/khoa.nguyen/32/1004_2.png) [@khoa.nguyen](https://community.onix.com/u/khoa.nguyen)\
**Post date:** [February 5, 2024, 2:30pm UTC](https://community.onix.com/t/onix-api-transfer-orders-part-3-4-migrate-from-web-api-to-onix-api/626/1 "2024-02-05T14:30:18Z")

</div>

This article is part of a series - click to read [part 1](https://community.onix.com/t/onix-api-transfer-orders-part-1-4-create-an-order-or-order-line/624), [part 2](https://community.onix.com/t/onix-api-transfer-orders-part-2-4-update-order-lines-properties-and-form-properties/627) and [part 4](https://community.onix.com/t/onix-api-transfer-orders-part-4-4-create-and-update-a-grouped-order-line/1213).

# Overview

The Web API ( **deprecated** ) is soon to be retired. We strongly recommend organizations to migrate their usage to our Onix API today.

Onix API provides flexible APIs for interacting with the Onix Work system. This results in simpler requests, faster response times, improved security, and better support.

Here’s the guide for developers on migrating from the Web API for transfering or creating orders.

Reference links for Web API documentation on transfering orders:

- Production: [https://onixwork.com/api/Doc/#/order/transferOrder](https://onixwork.com/api/Doc/#/order/transferOrder)
- Sandbox: [https://onixwork.com/api-sandbox/Doc/#/order/transferOrder](https://onixwork.com/api/Doc/#/order/transferOrder)

# Model mapping

The Web API’s `ERPOrder` contains all the information to create an order, order lines, number order lines and update all their properties.

Model mapping notes:

- `ERPOrder` (Web API) model is similar to `OrderInfo` (Onix API) model, except `OrderInfo` (Onix API) does not contain order lines information: `Orderlines` field (`ERPOrderline` type).
- `ERPOrderline` (Web API) model is similar to `OrderLineInfo` (Onix API) model, except `OrderInfo` (Onix API) has `type` field and does not contain:
  - `SerialNumber`: default serial number for the current order line.
  - `BatchNo`: default batch number for the current order line.
  - `ERPSerials`: information to number the current order line.
  - `ERPFields`: information for the Web API system can update respective fields, usually properties and form properties, but those fields must be predefined and very limited.

- `ERPSerials` (Web API) is similar to `OrderLineItemSerialInfo` (Onix API) used in `items` field in `OrderLineItemsInfo` model. This is used for numbering the current order line.
- `ERPFields` (Web API) is used for predefined fields. Onix API does not support this field. Use endpoint update properties and form properties in [part 2](https://community.onix.com/t/onix-api-transfer-orders-part-2-4-update-order-lines-properties-and-form-properties/627) instead.  
If you have trouble migrating this field, please [Contact Support](https://community.onix.com/pub/contact-support).

Mapping table for `ERPOrder` (Web API) into `OrderInfo` (Onix API) model:

| **Web API Field** | **Onix API Field** | **Comment** |
| --- | --- | --- |
| `ERPOrderID` | `erpOrderId` | _Identical values._ |
| `ERPOrderDate` | `erpOrderDate` | A significant difference in date format:  
Web API date format: `yyyy.MM.dd`, e.g.: 2024.01.31  
Onix API date format: `yyyy-MM-dd`, e.g.: 2024-01-31 |
| `ERPCustomerOrderNo` | `erpCustomerOrderNo` | _Identical values._ |
| `WorkflowStatusId` | `workflowStatusId` | _Identical values._ |
| `ERPCustomerId` | `erpCustomerId` | _Identical values._ |
| `ERPCustomerDescription` | `erpCustomerDescription` | _Identical values._ |
| `ERPCustomerAddress` | `erpCustomerAddress` | _Identical values._ |
| `ERPCustomerPostalCode` | `erpCustomerPostalCode` | _Identical values._ |
| `ERPCustomerWeb` | `erpCustomerWeb` | _Identical values._ |
| `ERPCustomerOrgNumber` | `erpCustomerOrgNumber` | _Identical values._ |
| `ERPCustomerCountryCode` | `erpCustomerCountryCode` | _Identical values._ |
| `ERPCustomerContactId` | `erpCustomerContactId` | _Identical values._ |
| `ERPCustomerContactName` | `erpCustomerContactName` | _Identical values._ |
| `ERPSupplierId` | `erpSupplierId` | _Identical values._ |
| `ERPSupplierDescription` | `erpSupplierDescription` | _Identical values._ |
| `ERPSupplierContactId` | `erpSupplierContactId` | _Identical values._ |
| `ERPSupplierContactName` | `erpSupplierContactName` | _Identical values._ |
| `Source` | `source` | _Identical values._  
Onix API supports additional value: _3_ — Manually. |
| `Orderlines` | `-` | See the mapping table for `ERPOrderline` below. |

Mapping table for `ERPOrderline` (Web API) model into `OrderLineInfo` (Onix API).  
**Note** : Onix API supports additional field `type` when creating/updating order lines.  
Continuing from the field `Orderlines` in above table:

| **Web API Field** | **Onix API Field** | **Comment** |
| --- | --- | --- |
| `ERPArticleNo` | `erpArticleNo` | _Identical values._ |
| `Quantity` | `quantity` | _Identical values._ |
| `ExternalLineNo` | `externalLineNo` | _Identical values._ |
| `WorkflowStatusId` | `workflowStatusId` | _Identical values._ |
| `ERPParent` | `parentOrderLineImportId` | _Identical values._ |
| `ERPInternalId` | `orderLineImportId` | _Identical values._ |
| `BatchNo` | `*N/A*` | Onix API **does not support** this field when creating/updating an order line\*\*.\*\*  
This field in Web API is used as the default value in numbering items in an order line.  
Use numbering requests instead. |
| `SerialNumber` | `*N/A*` | Onix API **does not support** this field when creating/updating an order line\*\*.\*\*  
This field in Web API is used as the default value in numbering items in an order line.  
Use numbering requests instead. |
| `CertificateString` | `certificateString` | _Identical values._ |
| `TypeInfo` | `model` | _Identical values._ |
| `ERPTypeInfo` | `erpModel` | _Identical values._ |
| `WLL` | `wll` | _Identical values._ |
| `Comment` | `comment` | _Identical values._ |
| `JobComment` | `jobComment` | _Identical values._ |
| `ERPSerials` | `-` | See the mapping table for `ERPSerials` below. |
| `ERPFields` | `-` | Onix API **does not support** this field.  
See the information for `ERPFields` below. |

The `ERPFields` (Web API) is used to update order line form properties with a fixed set of keys, but its support is limited and **and there is no equivalent model in Onix API**.

Onix API provides `PropertyInfo` and `FormPropertyKeyValueInfo[]` for updating respective properties and form properties in place of `ERPFields` (Web API) in a more intuitive way.

We strongly suggest switching to Onix API for a more flexible and powerful way to update properties and form properties using two endpoints:

- `POST /v1/order-lines/properties` to update the order line’s properties.
- `POST /v1/order-lines/form-properties` to update the order line’s form properties.

# Examples

Here’s an example that shows how to create an order using the Web API, combining information from different sections:

```js
{
  "ERPOrderID": "ERP_Order/0001",
  "ERPCustomerOrderNo": "ERP_CustomerOrder/0001",
  "ERPCustomerId": "ERP_Customer/0382",
  "Orderlines": [
    {
      "ERPArticleNo": "ERP_Product/0001",
      "Quantity": 5,
      "ERPInternalId": "ERP_OrderLine/0001",
      "TypeInfo": "OL1: ERP model",
      "ERPTypeInfo": "OL1: ERP erpModel",
      "WLL": "OL1: WLL",
      "Comment": "OL1: My Comment",
      "JobComment": "OL1: My job comment",
      "ERPSerials": [
        {
          "SerialNumber": "EQ.ERP.01",
          "BatchNo": "B2024.01",
          "ProdYear": "2024"
        },
        {
          "SerialNumber": "EQ.ERP.02",
          "BatchNo": "B2024.01",
          "ProdYear": "2024"
        },
        {
          "SerialNumber": "EQ.ERP.03",
          "BatchNo": "B2024.01",
          "ProdYear": "2024"
        },
        {
          "SerialNumber": "EQ.ERP.04",
          "BatchNo": "B2024.01",
          "ProdYear": "2024"
        },
        {
          "SerialNumber": "EQ.ERP.05",
          "BatchNo": "B2024.01",
          "ProdYear": "2024"
        }
      ],
      "ERPFields": [
        {
          "Field": "FE_AntallProvetS",
          "Value": "field value"
        }
      ]
    }
  ]
}

```

Note that Onix API does not support`ERPFields` field.  
The above request is combined from all examples in all other sections. It can split into 5 requests (steps) in Onix API:

1. Create the order using the endpoint `POST /v1/orders`. Notice that the `importId` field is required in.

```js
{
  "importId": "ERP_Import/0001",
  "erpOrderId": "ERP_Order/0001",
  "erpCustomerOrderNo": "ERP_CustomerOrder/0001",
  "erpCustomerId": "ERP_Customer/0382"
}

```

1. Create order lines by making a request for each order line using the endpoint:  
`POST /v1/order-lines`

```js
{
  "orderImportId": "ERP_Import/0001",
  "orderLineImportId": "ERP_OrderLine/0001",
  "erpArticleNo": "ERP_Product/0001",
  "quantity": 5,
  "model": "OL1: ERP model",
  "erpModel": "OL1: ERP erpModel",
  "wll": "OL1: WLL",
  "comment": "OL1: My Comment",
  "jobComment": "OL1: My job comment"
}

```

1. Numbering order lines by making a request for each order line using the endpoint:  
`POST /v1/order-lines/items`

```js
{
  "orderImportId": "ERP_Import/0001",
  "orderLineImportId": "ERP_OrderLine/0001",
  "items": [
    {
      "serialNumber": "EQ.ERP.01",
      "batchNo": "B2024.01",
      "prodYear": "2024"
    },
    {
      "serialNumber": "EQ.ERP.02",
      "batchNo": "B2024.01",
      "prodYear": "2024"
    },
    {
      "serialNumber": "EQ.ERP.03",
      "batchNo": "B2024.01",
      "prodYear": "2024"
    },
    {
      "serialNumber": "EQ.ERP.04",
      "batchNo": "B2024.01",
      "prodYear": "2024"
    },
    {
      "serialNumber": "EQ.ERP.05",
      "batchNo": "B2024.01",
      "prodYear": "2024"
    }
  ]
}

```

1. Update properties for order lines by making a request for each order line using the endpoint:  
`POST /v1/order-lines/properties`

```js
{
  "orderImportId": "ERP_Import/0001",
  "orderLineImportId": "ERP_OrderLine/0001",
  "properties": [
    {
      "key": "ApiKey_Proofload",
      "value": "Test value"
    },
    {
      "key": "ApiKey_DateOfTest",
      "value": "2024.31.01"
    }
  ]
}

```

1. Update form properties for order lines by making a request for each order line using the endpoint:  
`POST /v1/order-lines/form-properties`

```js
{
  "orderImportId": "ERP_Import/0001",
  "orderLineImportId": "ERP_OrderLine/0001",
  "properties": [
    {
      "key": "ApiKey_Proofload",
      "value": "Test value"
    },
    {
      "key": "ApiKey_DateOfTest",
      "value": "2024.31.01"
    }
  ]
}

```

And that concludes the process – you’ve successfully created an entire order.

# Related articles

- [Onix API - Get started](https://community.onix.com/t/onix-api-get-started/602)
- [Part 1](https://community.onix.com/t/onix-api-transfer-orders-part-1-4-create-an-order-or-order-line/624): create and update an order, an order line and numbering an order line.
- [Part 2](https://community.onix.com/t/onix-api-transfer-orders-part-2-4-update-order-lines-properties-and-form-properties/627): update an order line’s properties and form properties.
- [Part 3](https://community.onix.com/t/onix-api-transfer-orders-part-3-4-migrate-from-web-api-to-onix-api/626): how to migrate from Web API to Onix API.
- [Part 4](https://community.onix.com/t/onix-api-transfer-orders-part-4-4-create-and-update-a-grouped-order-line/1213): create and update grouped order lines.

> If you encounter any issues or have questions, kindly describe your concern and:
> 
> - Send an email to [support@onix.com](mailto:support@onix.com); OR
> - Create a topic in #Q&A to receive assistance from all Community members.
