Customer and Invoice endpoints

The following endpoints use laravel resource controllers to and collections to return data. The data is mutated using the controllers and returned as a collection in a json format.

All api controllers and resources are versioned allowing for updates and changes to be made without breaking existing api calls.

Customer endpoints

Get all customers
Customers with invoices
    
    {
        "id": 1,
        "accountType": "i",
        "name": "Maeve Boyle",
        "dateOfBirth": "1997-06-25",
        "email": "john@example.net",
        "phoneNumber": "8018018011",
        "state": "TX",
        "city": "East Carlosburgh",
        "street": "Lakin Cape",
        "postalCode": "97174"
        "invoicesCount": 36,
        "invoices": [
            {
            "id": 1,
            "customerId": 1,
            "status": "void",
            "amount": 837,
            "billedDate": "2001-12-20 19:19:46"",
            "paidDate": "1971-08-17 11:46:09"
            "created_at": 
            "2024-03-13T15:47:48.000000Z",
            "updated_at": 
            "2024-03-13T15:47:48.000000Z"
            }
        ],
    }
    
Get customer
Customer with invoice(s)
    
    {
        "accountType": "b",
        "name": "Fidel Barrows",
        "dateOfBirth": "2010-02-03",
        "email": "kub.jett@example.org",
        "phoneNumber": "+1 (262) 808-2460",
        "state": "MT",
        "city": "South Jakobburgh",
        "street": "Kutch Creek",
        "postalCode": "58586"
        "invoices": [
            {
            "id": 1,
            "customerId": 33,
            "status": "paid",
            "amount": 421,
            "billedDate": "2002-09-14 03:23:44",
            "paidDate": "1994-07-27 14:35:27"
            "created_at": 
            "2024-03-13T15:47:49.000000Z",
            "updated_at": 
            "2024-03-13T15:47:49.000000Z"
            }
        ],
    }
    

POST: /api/v1/customers

{ "accountType": "i", "name": "John Doe", "dateOfBirth": "1990-01-01", "email": "john@example.net", "phoneNumber": "8018018011", "state": "UT", "city": "EM", "street": "1234 s State", "postalCode": "12345" }

PUT: /api/v1/customers/4

{ "accountType": "i", "name": "John Doe", "dateOfBirth": "1990-01-01", "email": "john@example.net", "phoneNumber": "8018018011", "state": "UT", "city": "EM", "street": "1234 s State", "postalCode": "12345" }

PATCH: /api/v1/customers/4

{ "email": "john@example.net", "phoneNumber": "8018018011", "street": "1234 s State", "postalCode": "12345" }

DELETE: /api/v1/customers/4

API

Invoice endpoints

Get all invoices
    
    {
        "data": [
            {
            "InvoiceId": 994,
            "status": "paid",
            "billedDate": "1998-12-13 05:41:52",
            "total": 110,
            "balance": null,
            notes: null, 
            items: null,
            "customerId": 1,
            }
        ],
    }
    
Get an invoice
    
   {
    "data": {
      "invoiceId": 591,
      "status": "void",
      "billedDate": "1983-10-25 19:52:27",
      "paidDate": "2007-10-23 05:47:41",
      "total": 556,
      "balance": null,
      "notes": null,
      "items": null,
      "customerId": 20
    }
  }
    

GET: /api/v1/invoices/4

POST: /api/v1/invoices/bulk

{ "customerId": 2, "status": "paid", "amount": 55555, "billedDate": "2023-01-01 19:19:46", "paidDate": "2023-01-02 11:46:09" }, { "customerId": 1, "status": "void", "amount": 88888, "billedDate": "2010-80-18 19:19:46", "paidDate": "2010-08-17 11:46:09" }