Forum

REST API broken?

Yayınlanan kategoriDevelopment
  • Lennart Behr    ( User ) 1 month ago
    Hello there,

    Whenever I try to retrieve data from the API I get empty data sets. I created two customers for testing and when I GET @ index.php/api/customers with valid authorization the response contains an empty data array. Also, I can't create customers using the API @ index.php/api/customers with the request body looking like this:

    {
    "email": "[email protected]",
    "name": "test test",
    "currency_code": "EUR"
    }

    What am I missing?

    Regards,
    L. Behr
  • Lennart Behr    ( User ) 1 month ago
    Note:
    When I try to create a customer the response contains this:

    […] "message": "The given data failed to pass validation.",
    "status_code": 500, […]
  • Gert-Jaap Glasbergen    ( User ) 1 month ago
    I am currently seeing the exact same thing.
  • Gert-Jaap Glasbergen    ( User ) 1 month ago
    When I try to fetch a customer directly from an ID (like '/api/customers/59') I get this:

    "message": "get_class() expects parameter 1 to be object, null given",
    "status_code": 500,
    "debug": {
    "line": 126,
    "file": "/var/www/html/vendor/dingo/api/src/Http/Response/Factory.php",
    "class": "ErrorException",
    "trace": [
    "#0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'get_class() exp...', '/var/www/html/v...', 126, Array)",
    "#1 /var/www/html/vendor/dingo/api/src/Http/Response/Factory.php(126): get_class(NULL)",
    "#2 /var/www/html/app/Http/Controllers/Api/Incomes/Customers.php(42): Dingo\\Api\\Http\\Response\\Factory->item(NULL, Object(App\\Transformers\\Income\\Customer))",

    [...]
  • Gert-Jaap Glasbergen    ( User ) 1 month ago
    Ah, hold up. You need to pass the company_id (the ID of the company in Akaunting). Which, if you only have one, would be 1. So try /api/customers?company_id=1

Lütfen, cevap vermek için giriş yapın veya kayıt olun.