Customers

Saved Lists

Overview by Shivang


GET Customer Saved Lists

  • Route: GET ../customers/{customerId}/saved-lists
  • Controller: SavedListsController
  • Method: index
  • Request: Request
  • Description: Endpoint to retrieve saved lists for a specific customer.

The index method in the SavedListsController retrieves the saved lists for a customer identified by their ID. It begins by fetching the customer using the customerService, ensuring that the customer exists. The method checks for authorization to view the customer's saved lists. It then retrieves the quick trolleys associated with the customer's cookie from the quickTrolleyService. A debug log records the retrieval event, including the customer ID and cookie. Finally, the method returns a collection of saved lists formatted as SavedListResource.


Create Customer Saved List

  • Route: POST ../customers/{customerId}/saved-lists
  • Controller: SavedListsController
  • Method: store
  • Request: CreateSavedListRequest
  • Description: Endpoint to create a new saved list for a specific customer.

The store method in the SavedListsController handles the creation of a new saved list (quick trolley) for a customer identified by their ID. It first retrieves the customer using the customerService, ensuring that a 404 error is thrown if the customer is not found. The method checks for authorization to update the customer's saved lists. It then creates a new quick trolley using the quickTrolleyService, providing the customer ID, the name from the request, and the current date. A debug log records the creation of the new quick trolley, including the customer ID and trolley reference. Finally, the method returns the new saved list as a SavedListResource.


Ovierview by Atul

GET: customers/{customerId}/saved-lists

  • Controller: SavedListsController
  • Method: GET
  • Request: Request
  • Parameters:
    • customerId: Retrieval of their associated quick trolleys and ensuring that access is properly authorized.
  • Description: Endpoint for retrieve the list of quick trolleys.

The index function is a method that processes a request to obtain and present a list of quick trolleys associated with a particular customer, as identified by their customerId.

public function index(Request $request, $customerId)
{
    // Function implementation goes here
}

Request Parameters for customers/{customerId}/saved-lists:

  • Header :- Accept-Language:- en-UK,en,
  • x-toolstation-customer-id:- Token Id of the customer

Response

Response Code: 200 OK

Response:

{
    "data": []
}

Response Code: 403 Forbidden

Response:


{
    "error": {
        "code": "403.99",
        "message": "Forbidden",
        "info": "https://developers.example.com",
        "data": null
    }
}

POST: customers/{customerId}/saved-lists

  • Controller: SavedListsController
  • Method: POST
  • Request: CreateSavedListRequest
  • Parameters:
    • customerId: Identify and Update the list of quick trolleys.
  • Description: Endpoint to create or manage quick trolleys.

The store function handles the creation of a new quick trolley for a specific customer. It begins by retrieving the customer's details using the customerId to ensure the customer exists. The function then checks if the current user has the necessary permissions to create or update quick trolleys for this customer.

public function store(CreateSavedListRequest $request, $customerId)
{
    // Function implementation goes here
}

Request Parameters for customers/{customerId}/saved-lists:

  • Header :- Accept-Language:- en-UK,en,
  • x-toolstation-customer-id:- Token Id of the customer

Response

Response Code: 403 Forbidden

Response:


<!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden

Copyright © 2026