Skip to content

/admin/invoices/:id/packing_lines

Path: /admin/invoices/:id/packing_lines

Namespace: admin

Parent Resource: invoices

Overview

Packing lines represent packing list items for an invoice. Each packing line item contains product information, quantities packed, and shipping details.

Available Operations

List Packing Lines (GET)

Endpoint: GET /admin/invoices/:id/packing_lines.json

Description: Retrieve all packing lines for a specific invoice.

Request Example:

bash
GET /admin/invoices/123/packing_lines.json

Response (200 OK):

json
{
  "packing_lines": [
    {
      "id": 1,
      "invoice_id": 123,
      "item_id": 45,
      "quantity": 2,
      "packed_quantity": 2,
      "description": "Product description"
    }
  ]
}

Show Packing Line (GET /:id)

Endpoint: GET /admin/invoices/:id/packing_lines/:id.json

Description: Retrieve a specific packing line.

Request Example:

bash
GET /admin/invoices/123/packing_lines/1.json

Response (200 OK):

json
{
  "packing_line": {
    "id": 1,
    "invoice_id": 123,
    "item_id": 45,
    "quantity": 2,
    "packed_quantity": 2
  }
}

Create Packing Line (POST)

Endpoint: POST /admin/invoices/:id/packing_lines.json

Description: Create a new packing line for an invoice.

Request Example:

bash
POST /admin/invoices/123/packing_lines.json
Content-Type: application/json

{
  "packing_line": {
    "item_id": 45,
    "quantity": 2,
    "packed_quantity": 2,
    "description": "Product description"
  }
}

Response (201 Created):

json
{
  "packing_line": {
    "id": 1,
    "invoice_id": 123,
    "item_id": 45,
    "quantity": 2
  }
}

Update Packing Line (PATCH /:id)

Endpoint: PATCH /admin/invoices/:id/packing_lines/:id.json

Description: Update an existing packing line.

Request Example:

bash
PATCH /admin/invoices/123/packing_lines/1.json
Content-Type: application/json

{
  "packing_line": {
    "packed_quantity": 3
  }
}

Response (200 OK):

json
{
  "packing_line": {
    "id": 1,
    "packed_quantity": 3
  }
}

Delete Packing Line (DELETE /:id)

Endpoint: DELETE /admin/invoices/:id/packing_lines/:id.json

Description: Delete a packing line.

Request Example:

bash
DELETE /admin/invoices/123/packing_lines/1.json

Response (204 No Content)

Batch Actions (POST /batch_action)

Endpoint: POST /admin/invoices/:id/packing_lines/batch_action.json

Description: Perform batch operations on selected packing lines.

Request Example:

bash
POST /admin/invoices/123/packing_lines/batch_action.json
Content-Type: application/json

{
  "batch_action": "update",
  "collection_selection": [1, 2, 3],
  "batch_action_inputs": {
    "packed_quantity": 0
  }
}

Response (200 OK):

json
{
  "message": "Batch action completed",
  "affected_count": 3
}

Released under an open source license.