Trak Software Documentation logo

Inventory


GET /inventory

Query Parameters

Parameter Type Description
categories Integer Filter inventory by categories assigned to the task. Pass multiple ids seperated by | character.
collection Integer Filter inventory by collection assigned to task.
join String Values to join to task resource.
search String Filter inventory by matching the task name or description.
season Integer Filter inventory by season.

{primary} You can filter the inventory you're assocated with by passing me to the user parameter.

Joining Resources

Here is a list of available resources to join on inventory.

['author', 'categories', 'children', 'comments', 'files', 'season']

Example Requests

All Inventory assigned to collection with id 1

https://example.trak.io/api/v1/inventory?collection=1

Inventory with ID 1 and it's collection and status

https://example.trak.io/api/v1/inventory/1?join=collection|status

Example Response

{
    "success": true,
    "message": null,
    "data": {
        "current_page": 1,
        "data": [
            {
                "task_id": 1,
                "site_id": 1,
                "user_id": 1,
                "season_id": 1,
                "account_id": null,
                "collection_id": 1,
                "status_id": null,
                "inventory_id": null,
                "event_id": null,
                "assigned_id": null,
                "name": "Example Inventory",
                "description": "<p>An example description.</p>",
                "due_date": null,
                "quantity": 1,
                "created_at": "2020-01-01 00:00:00",
                "updated_at": "2020-01-01 00:00:00",
                "status_name": "Incomplete",
                "collection": {
                    "collection_id": 1,
                    "site_id": 1,
                    "user_id": 1,
                    "order": 1,
                    "name": "Assets",
                    "collaborative": 1,
                    "created_at": "2018-12-03 20:32:56",
                    "updated_at": "2018-12-03 21:51:13"
                },
                "season": {
                    "season_id": 1,
                    "site_id": 1,
                    "user_id": 1,
                    "name": "Default Season",
                    "active": 1,
                    "created_at": "2018-12-03 20:32:56",
                    "updated_at": "2018-12-07 20:24:52"
                }
            },
            ...
        ],
        "first_page_url": "https://example.trak.io/api/v1/inventory?page=1",
        "from": 1,
        "last_page": 67,
        "last_page_url": "https://example.trak.io/api/v1/inventory?page=67",
        "next_page_url": "https://example.trak.io/api/v1/inventory?page=2",
        "path": "https://sponsorship.trak.dev/api/v1/inventory",
        "per_page": "1",
        "prev_page_url": null,
        "to": 1,
        "total": 67
    }
}

POST /inventory

Query Parameters

Parameter Type Required Description
collection_id Integer true The collection of the inventory item.
description String false Description of the inventory item.
name String true Name of the inventory item.
quantity Integer false Quantity of inventory item. Defaults to 1.
season_id Integer true The season of the inventory item.

Example Requests

{
    "collection_id": 1,
    "description": null,
    "name": "Example Inventory",
    "season_id": 1
}

Example Response

{
    "success": true,
    "message": "API_INVENTORY_CREATED",
    "data": {
        "site_id": 1,
        "user_id": 1,
        "season_id": 1,
        "account_id": null,
        "collection_id": 1,
        "status_id": null,
        "inventory_id": null,
        "event_id": null,
        "assigned_id": null,
        "name": "Example Inventory",
        "description": null,
        "due_date": null,
        "quantity": 1,
        "task_id": 1
    }
}

PUT /inventory/{inventory_id}

Query Parameters

Parameter Type Required Description
collection_id Integer true The collection of the inventory item.
description String false Description of the inventory item.
name String true Name of the inventory item.
quantity Integer false Quantity of inventory item. Defaults to 1.
season_id Integer true The season of the inventory item.
status_id Integer true The status of the inventory item.

Example Requests

{
    "collection_id": 1,
    "description": null,
    "name": "Updated Task",
    "season_id": 1
}

Example Response

{
    "success": true,
    "message": "API_INVENTORY_UPDATED",
    "data": {
        "task_id": 1,
        "site_id": 1,
        "user_id": 1,
        "season_id": 1,
        "account_id": null,
        "collection_id": 1,
        "status_id": null,
        "inventory_id": null,
        "event_id": null,
        "assigned_id": null,
        "name": "Updated Inventory",
        "description": null,
        "due_date": null,
        "quantity": 1
    }
}

DELETE /inventorys/{inventory_id}

{danger} Deleting a inventory will also delete any comments or files attached to the inventory.

Example Response

{
    "success": true,
    "message": "API_INVENTORY_DELETED",
    "data": []
}