--- title: "Use case: Import orders" slug: "datenaustausch-connect-api-uc-auftrag-anlegen" updated: 2026-12-02T08:12:43Z published: 2026-12-02T08:12:43Z canonical: "docs.homag.cloud/datenaustausch-connect-api-uc-auftrag-anlegen" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.homag.cloud/llms.txt > Use this file to discover all available pages before exploring further. # Use case: Import orders **For:** Customers · Partners · Integrators Orders are created in a CAD/CAM or ERP system and must reach production without manual export and import. ## Challenge When orders are exported and imported manually, production starts late, files are lost or imported twice, and production works with outdated data. The import needs to happen automatically, and the source system needs to know whether it succeeded. ## Solution The source system transfers each order to productionManager as soon as it is ready. Two file formats are supported: | Format | Content | Use when | | --- | --- | --- | | **Project archive** (ZIP) | A `project.xml` file in the root folder and the files it references, for example images and CNC programs (`.mpr`). The `project.xml` describes the complete order: header data such as customer and delivery date, and the hierarchy of articles, assemblies, and parts. | Your system can create a `project.xml` according to the [HOMAG import specification](https://github.com/HomagGroup/HOMAG-Connect/blob/main/DataExchange/ImportSpecification.md). | | **Flat part list** with import template | One row per part, for example in `.xlsx`, `.xls`, `.csv`, `.txt`, or `.pnx` format. An import template defines once how the columns are mapped. Apart from the order name, the list contains no order header data. | Your system can only export a part list. | Both options create the order with status `New`. The order is then reviewed and released. ## Workflow 1. Create a project archive in the source system. 2. Import the project archive. The response contains a `correlationId`. 3. Query the import status until it is `Succeeded` or `Error`. If successful, save the `orderId` in the source system. 4. Read and review the created order using the `orderId`. 5. Release the order. **C#** ```csharp var productionManager = new ProductionManagerClient(subscriptionId, authorizationKey); // 2. Import the project archive var response = await productionManager.ImportOrderRequest(    new ImportOrderRequest { Action = ImportOrderRequestAction.ImportOnly },    new FileInfo(@"C:\Exports\Project.zip")); // 3. Wait for the import to complete and store the order ID var order = await productionManager.WaitForImportOrderCompletion(response.CorrelationId, TimeSpan.FromMinutes(5)); sourceSystem.StoreProductionManagerOrderId(order.Id); // 4. Read the created order var orderDetails = await productionManager.GetOrder(order.Id); // 5. Release the order await productionManager.ReleaseOrder(order.Id); ``` **REST** ```http # 2. Import the project archive POST /api/productionManager/orders/import Content-Type: multipart/form-data; boundary=boundary --boundary Content-Disposition: form-data; name="importOrderRequest" { "action": "ImportOnly" } --boundary Content-Disposition: form-data; name="Project.zip"; filename="Project.zip" Content-Type: application/zip --boundary-- 200 OK { "correlationId": "0e4ea3b8-d1ce-4d16-a18f-9ea8f2e7d55c" } # 3. Query the import status (Queued, InProgress, Succeeded, Error) GET /api/productionManager/orders/import/0e4ea3b8-d1ce-4d16-a18f-9ea8f2e7d55c 200 OK {  "orderId": "1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228",  "state": "Succeeded",  "link": "https://productionmanager.homag.cloud#/..." } # 4. Read the created order GET /api/productionManager/orders/1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228 # 5. Release the order PATCH /api/productionManager/orders/1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228/release ``` ## Update an order by importing it again If an order changes in the source system before production starts, for example because parts were added or changed, import the complete project archive again. Set the order's `ExternalSystemId` property in `project.xml` to its identifier in your source system, such as the ERP order number. Use the same value every time you import this order. - If no order with this `ExternalSystemId` exists yet, the import creates a new order. - If an order with the same `ExternalSystemId` exists with status `New`, the import overwrites the complete order, including its parts. The `orderId` and order number remain the same, but the parts receive new IDs. - After release, the order cannot be overwritten. The import ends with status `Error`, and `errorDetails` explains that the order has already been released. To import it again, first reset the release. By contrast, `PATCH /api/productionManager/orders/{identifier}` updates only individual header fields and leaves the parts unchanged. See [Use case: Synchronize orders with the ERP system](/docs/en/datenaustausch-connect-api-uc-auftrag-status). > **Warning:** Use a unique `ExternalSystemId` for each order. If two different orders are imported with the same value, the second import overwrites the first order. Since parts receive new IDs, do not store part IDs from an earlier import. ## Option: Import a flat part list using an import template Use this option if your source system can only export a flat part list, for example an Excel or CSV file with one row per part. Create the import template once in productionManager: during the first manual import of such a list, map the file's columns to the part list fields. The API then uses this template for every subsequent file with the same structure. Only the import request changes: importing through a template returns the import status directly, so steps 4 and 5 can follow without polling. Since a flat list contains no header data, pass the order name using `orderName`. If needed, add other header data such as customer or delivery date with `PATCH /api/productionManager/orders/{identifier}` before release. 1. Read the available import templates and select the one that matches your file. 2. Import the file using the template's `id` and the order name. 3. Check that `state` is `Succeeded`, save the `orderId`, and continue with step 4 above. **C#** ```csharp // 1. Find an import template var templates = await productionManager.GetImportTemplates(); var template = templates?.FirstOrDefault(t => t.Name == "ERP parts list")    ?? throw new InvalidOperationException("The import template could not be found."); // 2. Import the file var importState = await productionManager.ImportViaTemplateAsync(    template.Id.ToString(),    new FileInfo(@"C:\Exports\Order-10002306.xlsx"),    "Kitchen Block A"); // 3. Check the result if (importState.State != ImportState.Succeeded) {    throw new InvalidOperationException($"Import failed: {importState.ErrorDetails}"); } ``` **REST** ```http # 1. Find an import template GET /api/productionManager/orders/import/templates 200 OK [  {    "id": "9f0f7af6-60ae-4d1c-8d1b-2aaeb4ef74e1",    "name": "ERP parts list",    "fileExtension": "xlsx"  } ] # 2. Import the file POST /api/productionManager/orders/import/templates/9f0f7af6-60ae-4d1c-8d1b-2aaeb4ef74e1?orderName=Kitchen%20Block%20A Content-Type: multipart/form-data; boundary=boundary 200 OK {  "orderId": "1f5d1f4d-2ab9-487a-8a17-2d6fd84fe228",  "errorDetails": null,  "state": "Succeeded" } ``` ## Integration architecture Trigger the import from an event in the source system, for example when a design is complete or an order is released for production in the ERP system. Store the `orderId` from the import status with the order in the source system. You need it to read, update, release, or delete the order later. Check the import status, not just the HTTP status of the import request: the request can be accepted while the import itself fails. Display `errorDetails` in the source system so the data can be corrected and imported again. ## Benefits - Orders reach production immediately and without manual steps. - A project archive gives production the complete order, including drawings and CNC programs. - Changes before production starts are transferred by importing again, without creating duplicates. - The source system knows whether the import succeeded and why it failed. > **API reference:** See Endpoints → HOMAG Connect productionManager → Managing Orders and Imports ([API reference](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports)): [Import order using a project file](https://docs.homag.cloud/apidocs/importproductionmanagerorderusingprojectfile) ([`POST /api/productionManager/orders/import`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/POST/api/productionManager/orders/import)), [Get import status](https://docs.homag.cloud/apidocs/getproductionmanagerorderimportstate) ([`GET /api/productionManager/orders/import/{correlationId}`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/GET/api/productionManager/orders/import/{correlationId})), [Get import templates](https://docs.homag.cloud/apidocs/getproductionmanagerimporttemplates) ([`GET /api/productionManager/orders/import/templates`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/GET/api/productionManager/orders/import/templates)), and [Import order using a template](https://docs.homag.cloud/apidocs/importproductionmanagerorderviatemplate) ([`POST /api/productionManager/orders/import/templates/{templateId}`](https://connect.homag.cloud/productionmanager/#v1/tag/b01-managing-orders-and-imports/POST/api/productionManager/orders/import/templates/{templateId})). The structure of `project.xml` is described in the [HOMAG import specification](https://github.com/HomagGroup/HOMAG-Connect/blob/main/DataExchange/ImportSpecification.md).