---
# System prepended metadata

title: Admin Purchases

---

Group Buying API

# Admin Purchases

## get `/api/v1/admin/purchases`

### Params
|key|type|default|
|---|-----|-------|
|page| number|0|
|limit| number|24|


## post `/api/v1/admin/purchases`
### Payload
```json
"purchase": {
    "status": "paid",
        "purchase_items_attributes": [{
          "quantity": 200,
          "unit_cost": 50,
          "specific_item_id": 1
        }, {
          ...
        }]
}
```
|key|type|descriptions|
|---|-----|------------|
|status|string| received, paid, closed, canceled|
|purchase_items_attributes[]["quantity"]|number|quantity|
|purchase_items_attributes[]["unit_cost"]|number|cost|
|purchase_items_attributes[]["specific_item_id"]|id|specific_item's id|

## get `/api/v1/admin/purchases/[id]`

## put/patch `/api/v1/admin/purchases/[id]`
### Payload
```json
"purchase": {
    "status": "paid",
        "purchase_items_attributes": [{
            "id": 1,
            "quantity": 200,
            "unit_cost": 50,
            "specific_item_id": 1
        }, {
            ...
        }]
}
```
|key|type|descriptions|
|---|-----|------------|
|status|string| received, paid, closed, canceled|
|purchase_items_attributes[]["id"]|id|purchase_item's id||
|purchase_items_attributes[]["quantity"]|number|quantity|
|purchase_items_attributes[]["unit_cost"]|number|cost|
|purchase_items_attributes[]["specific_item_id"]|id|specific_item's id|

## delete `/api/v1/admin/purchases/[id]`


# Admin Orders

## get `/api/v1/admin/orders`

### Params
|key|type|default|
|---|-----|-------|
|page| number|0|
|limit| number|24|


## post `/api/v1/admin/orders`
### Payload
```json
"order": {
    "status": "new_order",
    "user_id": 1,
    "order_name": "Foo",
    "order_address": "Bar",
    "order_phone": "0912345678",
    "order_email": "foo@bar.test",
    "order_items_attributes": [{
        "quantity": 200,
        "specific_item_id": 1
    }, {
        ...
    }]
}
```
|key|type|descriptions|
|---|-----|------------|
|status|string| new_order, payment_received, payment_failed, in_progress, completed, closed, canceled|
|user_id|id|user's id|
|order_name|string|
|order_address|string|
|order_phone|string|
|order_email|string|
|company_name|string|optional|
|company_id|string|optional|
|invoice_address|string|optional|
|order_items_attributes[]["quantity"]|number|quantity|
|order_items_attributes[]["specific_item_id"]|id|specific_item's id|

## get `/api/v1/admin/orders/[id]`

## put/patch `/api/v1/admin/orders/[id]`
### Payload
```json
"order": {
    "status": "new_order",
    "user_id": 1,
    "order_name": "Foo",
    "order_address": "Bar",
    "order_phone": "0912345678",
    "order_email": "foo@bar.test",
    "order_items_attributes": [{
        "id": 1,
        "quantity": 200,
        "specific_item_id": 1
    }, {
        ...
    }]
}
```
|key|type|descriptions|
|---|-----|------------|
|status|string| new_order, payment_received, payment_failed, in_progress, completed, closed, canceled|
|user_id|id|user's id|
|order_name|string|
|order_address|string|
|order_phone|string|
|order_email|string|
|company_name|string|optional|
|company_id|string|optional|
|invoice_address|string|optional|
|order_items_attributes[]["id"]|id|order_item's id||
|order_items_attributes[]["quantity"]|number|quantity|
|order_items_attributes[]["specific_item_id"]|id|specific_item's id|

## delete `/api/v1/admin/orders/[id]`

# Admin Products

## get `/api/v1/admin/products`

### Params
|key|type|default|
|---|-----|-------|
|page| number|0|
|limit| number|24|


## post `/api/v1/admin/products`
### Payload
```json
"product": {
    "name": "Cake",
    "status": "in_stock",
    "description": "DESCRIPTION",
    "add_feature_image_blob": {...},
    "add_images_blob": [{...}],
    "specifications_attributes": [{
        "name": "Color",
        "specific_items_attributes": [{
            "name": "Red",
            "price_ranges_attributes": [{
                "max_quantity": 10,
                "min_quantity": 0,
                "price_value": 200
            }, {
                ...
            }]
        }, {
            ...
        }]
    }, {
        ...
    }]
}
```
|key|type|descriptions|
|---|-----|------------|
|name|string|
|status|string| out_of_stock, in_stock, running_low, archived|
|description|string|
|specifications_attributes[]["name"]|string|
|specifications_attributes[]["specific_items_attributes"]["name"]|string|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["max_quantity"]|number|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["min_quantity"]|number|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["price_value"]|number|

## get `/api/v1/admin/products/[id]`

## put/patch `/api/v1/admin/products/[id]`
### Payload
```json
"product": {
    "name": "Cake",
    "status": "in_stock",
    "description": "DESCRIPTION",
    "add_feature_image_blob": {...},
    "add_images_blob": [{...}],
    "feature_image_blob": {...},
    "images_blobs_id": [],
    "specifications_attributes": [{
        "id": 1,
        "name": "Color",
        "specific_items_attributes": [{
            "id": 1,
            "name": "Red",
            "price_ranges_attributes": [{
                "id": 1,
                "max_quantity": 10,
                "min_quantity": 0,
                "price_value": 200
            }, {
                ...
            }]
        }, {
            ...
        }]
    }, {
        ...
    }]
}
```
|key|type|descriptions|
|---|-----|------------|
|name|string|
|status|string| out_of_stock, in_stock, running_low, archived|
|description|string|
|specifications_attributes[]["id"]|id|speicification's id|
|specifications_attributes[]["name"]|string|
|specifications_attributes[]["specific_items_attributes"]["id"]|id|specific_item's id|
|specifications_attributes[]["specific_items_attributes"]["name"]|string|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["id"]|id|price_range's id|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["max_quantity"]|number|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["min_quantity"]|number|
|specifications_attributes[]["specific_items_attributes"]["price_ranges_attributes"]["price_value"]|number|

## delete `/api/v1/admin/products/[id]`



# Admin SaleDates

## get `/api/v1/admin/sale_dates`

### Params
|key|type|default|
|---|-----|-------|
|page| number|0|
|limit| number|24|


## post `/api/v1/admin/sale_dates`
### Payload
```json
"sale_date": {
    "product_id": 1,
    "start_date": "",
    "end_date": ""
}
```
|key|type|descriptions|
|---|-----|------------|
|product_id|id|product's id|
|start_date|||
|end_date|||

## get `/api/v1/admin/sale_dates/[id]`

## put/patch `/api/v1/admin/sale_dates/[id]`
### Payload
```json
"sale_date": {
    "product_id": 1,
    "start_date": "",
    "end_date": ""
}
```
|key|type|descriptions|
|---|-----|------------|
|product_id|id|product's id|
|start_date|||
|end_date|||

## delete `/api/v1/admin/sale_dates/[id]`




# Admin Users

## get `/api/v1/admin/users`

### Params
|key|type|default|
|---|-----|-------|
|page| number|0|
|limit| number|24|


## put/patch `/api/v1/admin/users/[id]`
### Payload
```json
"user": {
    "role": []
}
```
|key|type|descriptions|
|---|-----|------------|
|role|

## delete `/api/v1/admin/users/[id]`
