Skip to content

/admin/addresses/:id/items

Path: /admin/addresses/:id/items

Namespace: admin

Parent Resource: addresses

Overview

Items represent products or services associated with an address. This nested resource provides access to items linked to a specific address.

Available Operations

List Items (GET)

Endpoint: GET /admin/addresses/:id/items.json

Description: Retrieve all items for a specific address.

Request Example:

bash
GET /admin/addresses/123/items.json

Response (200 OK):

json
{
  "items": [
    {
      "id": 1,
      "address_id": 123,
      "name": "Product Name",
      "sku": "SKU-001",
      "price_cents": 10000
    }
  ]
}

Show Item (GET /:id)

Endpoint: GET /admin/addresses/:id/items/:id.json

Description: Retrieve a specific item.

Request Example:

bash
GET /admin/addresses/123/items/1.json

Response (200 OK):

json
{
  "item": {
    "id": 1,
    "address_id": 123,
    "name": "Product Name",
    "sku": "SKU-001",
    "price_cents": 10000
  }
}

Create Item (POST)

Endpoint: POST /admin/addresses/:id/items.json

Description: Create a new item for an address.

Request Example:

bash
POST /admin/addresses/123/items.json
Content-Type: application/json

{
  "item": {
    "name": "New Product",
    "sku": "SKU-002",
    "price_cents": 15000
  }
}

Response (201 Created):

json
{
  "item": {
    "id": 2,
    "address_id": 123,
    "name": "New Product"
  }
}

Update Item (PATCH /:id)

Endpoint: PATCH /admin/addresses/:id/items/:id.json

Description: Update an existing item.

Request Example:

bash
PATCH /admin/addresses/123/items/1.json
Content-Type: application/json

{
  "item": {
    "price_cents": 12000
  }
}

Response (200 OK):

json
{
  "item": {
    "id": 1,
    "price_cents": 12000
  }
}

Delete Item (DELETE /:id)

Endpoint: DELETE /admin/addresses/:id/items/:id.json

Description: Delete an item.

Request Example:

bash
DELETE /admin/addresses/123/items/1.json

Response (204 No Content)

Batch Actions (POST /batch_action)

Endpoint: POST /admin/addresses/:id/items/batch_action.json

Description: Perform batch operations on selected items.

Request Example:

bash
POST /admin/addresses/123/items/batch_action.json
Content-Type: application/json

{
  "batch_action": "update",
  "collection_selection": [1, 2, 3],
  "batch_action_inputs": {
    "price_cents": 10000
  }
}

Response (200 OK):

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

Released under an open source license.