Skip to main content

Remove Hardware Requests from Order

Removes one or more hardware requests from an existing order. This endpoint allows you to partially or completely remove hardware items from an order that is in PENDING or QUOTED status.

Prerequisites

Before removing hardware requests, you should first:

  1. Query the order using Get Order By Id to:
    • Get the list of hardware requests (hardwares array)
    • Get the id of each hardware request you want to remove
    • Verify the order status (must be PENDING or QUOTED)

Important Restrictions

  • Order Status: Hardware requests can only be removed from orders with status PENDING or QUOTED
  • Minimum Hardware: You cannot remove all hardware requests from an order. At least one hardware request must remain
  • Partial Removal: You can remove a specific quantity of items by providing the amount parameter. If amount is not provided, the entire hardware request will be removed

Authentication

This endpoint requires authentication. See Authentication for details.

Request

Production URL: https://orchestrator.tecspal.com/
Sandbox URL: https://tecspal-orchestrator.sandbox.lexartlabs.uy/
Endpoint: PATCH /orders/{orderId}/hardware-requests/remove

Parameters

ParameterTypeRequiredDescription
orderIdstringYesThe unique identifier of the order

Request Body

PropertyTypeRequiredDescription
companyCodestringYesCompany code for one of your managed companies
hardwareRequestsarrayYesArray of hardware requests to remove (see Hardware Request Properties below)

Hardware Request Properties

PropertyTypeRequiredDescription
hardwareRequestIdstringYesThe unique identifier of the hardware request to remove (from the hardwares array)
amountnumberNoNumber of items to remove. If not provided, removes the entire hardware request

Notes on amount Parameter

  • If amount is not provided or is null: The entire hardware request will be removed
  • If amount is provided: Only that many items will be removed from the hardware request
  • amount must be a positive integer (greater than 0)
  • amount cannot exceed the current quantity of the hardware request
  • If amount equals or exceeds the current quantity, the entire hardware request will be removed

Example Request

Remove Entire Hardware Request

{
"data": {
"companyCode": "DM1",
"hardwareRequests": [
{
"hardwareRequestId": "3b194ea5-5d09-49f2-8d30-4b0e77dbc229"
}
]
},
"request": "orders/632a303b-e65c-4a48-9ed0-39bb832df5bc/hardware-requests/remove",
"vendor": "tecspal",
"verb": "PATCH"
}

Remove Partial Quantity

{
"data": {
"companyCode": "DM1",
"hardwareRequests": [
{
"hardwareRequestId": "3b194ea5-5d09-49f2-8d30-4b0e77dbc229",
"amount": 2
}
]
},
"request": "orders/632a303b-e65c-4a48-9ed0-39bb832df5bc/hardware-requests/remove",
"vendor": "tecspal",
"verb": "PATCH"
}

Remove Multiple Hardware Requests

{
"data": {
"companyCode": "DM1",
"hardwareRequests": [
{
"hardwareRequestId": "3b194ea5-5d09-49f2-8d30-4b0e77dbc229",
"amount": 1
},
{
"hardwareRequestId": "4ee86352-fe28-42e2-b6e9-d95e63c87a83"
}
]
},
"request": "orders/632a303b-e65c-4a48-9ed0-39bb832df5bc/hardware-requests/remove",
"vendor": "tecspal",
"verb": "PATCH"
}

Response Schema

PropertyTypeDescription
statusCodenumberHTTP status code of the response
messagestringDescription of the response status
enveloparrayArray containing the updated order

Order Properties

The response follows the same schema as Get Order By Id, containing the updated order with the hardware requests removed.

Example Response

{
"envelop": [
{
"id": "632a303b-e65c-4a48-9ed0-39bb832df5bc",
"orderNumber": 10001006,
"createdAt": "2025-04-10T15:01:33.644Z",
"updatedAt": "2025-04-10T15:02:36.845Z",
"status": "QUOTED",
"date": "2025-05-03",
"eta": "2025-04-19",
"trackingLink": null,
"countryCode": "UY",
"sendTo": "EMPLOYEE",
"currency": "USD",
"dateCompleted": null,
"description": "",
"requesterEmail": "superadmin@tecspal.com",
"companyName": "Larian Studios",
"apiClientRequesterName": null,
"poNumber": null,
"employeeProfile": {
"id": "04fb50a9-60fb-414a-ab2b-fa3f8ea8689e",
"firstName": "Juan",
"lastName": "Iruleguy",
"countryCode": "UY",
"email": "jiruleguy@tecspal.com",
"address": "Pedro Domingo Murillo 999, Montevideo, Departamento de Montevideo",
"addressExtraInfo": null,
"postCode": "11500"
},
"hardwares": [
{
"id": "4ee86352-fe28-42e2-b6e9-d95e63c87a83",
"amount": 1,
"notes": "",
"quotedUnitPrice": "200",
"createdAt": "2025-04-10T15:01:33.649Z",
"catalogModelId": null,
"brand": null,
"name": "HEADPHONES",
"image": "https://a-us.storyblok.com/f/1001855/800x800/eacb7e6f4f/headphones.png"
}
],
"createdHardwares": []
}
],
"message": "Request successful",
"statusCode": 200
}

Error Responses

Bad Request (400)

Invalid Order Status

{
"error": "Bad Request",
"message": "Cannot remove hardware requests from an order. Only orders with status PENDING or QUOTED can have hardware requests removed",
"statusCode": 400
}

Missing Hardware Requests

{
"error": "Bad Request",
"message": "At least one hardware request is required",
"statusCode": 400
}

Invalid Amount

{
"error": "Bad Request",
"message": "Amount must be a positive integer for hardware request 3b194ea5-5d09-49f2-8d30-4b0e77dbc229",
"statusCode": 400
}

Cannot Remove All Hardware

{
"error": "Bad Request",
"message": "Cannot remove all hardware requests from an order. Please cancel the order instead.",
"statusCode": 400
}

Note: If you need to remove all hardware requests from an order, you should cancel the order instead.

Hardware Request Not Found

{
"error": "Bad Request",
"message": "Hardware request(s) not found in this order: 3b194ea5-5d09-49f2-8d30-4b0e77dbc229",
"statusCode": 400
}

Duplicate Hardware Request IDs

{
"error": "Bad Request",
"message": "Duplicate hardware request IDs are not allowed",
"statusCode": 400
}

Not Found (404)

{
"error": "Not Found",
"message": "Order request not found",
"statusCode": 404
}

Forbidden (403)

{
"error": "Forbidden",
"message": "Order request does not belong to this company",
"statusCode": 403
}

Unauthorized (401)

{
"error": "Unauthorized",
"message": "Unauthorized access",
"statusCode": 401
}

Notes

  • Transaction Safety: All removals are performed within a database transaction, ensuring data consistency
  • Status Validation: Only orders in PENDING or QUOTED status can have hardware requests removed
  • Partial Removal: When removing a partial quantity, the hardware request will be updated with the remaining amount. If the remaining amount would be 0 or less, the hardware request is completely removed
  • Multiple Removals: You can remove multiple hardware requests in a single request by including them in the hardwareRequests array