Getting empty data values while accessing jsonapi resource

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
mmm
Posts: 19
Joined: 07 Aug 2018, 07:01

Getting empty data values while accessing jsonapi resource

Post by mmm » 08 Feb 2019, 18:27

HI,
I am getting empty array in data key while accessing JSON API.
Can you provide some help.


URL: http://mysite/jsonapi/product

Result:
{
meta: {
total: 0,
prefix: null,
content-baseurl: "http://mysite",
csrf: {
name: "_token",
value: "cg4TJlZw7Bm3MUOebTItFgjajOjrcjfjMwd7u4Mg"
}
},
links: {
self: "http://mysite/jsonapi/product?page%5Boffset%5D=0"
},
data: [ ],
included: [ ]


Windows 8.1 XAMPP PHP 7.2.7 Laravel Framework 5.6.29 aimeos 2018.10

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Getting empty data values while accessing jsonapi resour

Post by aimeos » 09 Feb 2019, 14:06

Did you add at least one category to your products?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mmm
Posts: 19
Joined: 07 Aug 2018, 07:01

Re: Getting empty data values while accessing jsonapi resour

Post by mmm » 09 Feb 2019, 16:08

Yes I did, and this is not only related to product but also for all the resources like order, stock etc

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Getting empty data values while accessing jsonapi resour

Post by aimeos » 11 Feb 2019, 08:56

That's strange. The default output for a new instance with the demo data is:

Code: Select all

{
"meta": {
"total": 4,
"prefix": null,
"content-baseurl": "http://localhost:8000/"

, "csrf": {
"name": "_token",
"value": "gf8LRpm6tgSyJMQCbl6USUwNolZcoNtWmfC0u8gb"
}

},

"links": {
"self": "http://127.0.0.1:8000/jsonapi/product?page%5Boffset%5D=0"
},



"data": [
    {
        "id": "1010048",
        "type": "product",
        "links": {
            "self": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/product?id=1010048",
                "allow": [
                    "GET"
                ]
            },
            "basket\/product": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/basket?id=default&related=product",
                "allow": [
                    "POST"
                ]
            }
        },
        "attributes": {
            "product.id": "1010048",
            "product.typename": "Article",
            "product.type": "default",
            "product.code": "demo-article",
            "product.label": "Demo article",
            "product.status": 1,
            "product.datestart": null,
            "product.dateend": null,
            "product.config": []
        }
    },
    {
        "id": "1010051",
        "type": "product",
        "links": {
            "self": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/product?id=1010051",
                "allow": [
                    "GET"
                ]
            },
            "basket\/product": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/basket?id=default&related=product",
                "allow": [
                    "POST"
                ]
            }
        },
        "attributes": {
            "product.id": "1010051",
            "product.typename": "Selection",
            "product.type": "select",
            "product.code": "demo-selection-article",
            "product.label": "Demo selection article",
            "product.status": 1,
            "product.datestart": null,
            "product.dateend": null,
            "product.config": []
        }
    },
    {
        "id": "1010052",
        "type": "product",
        "links": {
            "self": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/product?id=1010052",
                "allow": [
                    "GET"
                ]
            },
            "basket\/product": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/basket?id=default&related=product",
                "allow": [
                    "POST"
                ]
            }
        },
        "attributes": {
            "product.id": "1010052",
            "product.typename": "Bundle",
            "product.type": "bundle",
            "product.code": "demo-bundle-article",
            "product.label": "Demo bundle article",
            "product.status": 1,
            "product.datestart": null,
            "product.dateend": null,
            "product.config": []
        }
    },
    {
        "id": "1010053",
        "type": "product",
        "links": {
            "self": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/product?id=1010053",
                "allow": [
                    "GET"
                ]
            },
            "basket\/product": {
                "href": "http:\/\/127.0.0.1:8000\/jsonapi\/basket?id=default&related=product",
                "allow": [
                    "POST"
                ]
            }
        },
        "attributes": {
            "product.id": "1010053",
            "product.typename": "Voucher",
            "product.type": "voucher",
            "product.code": "demo-voucher",
            "product.label": "Demo voucher",
            "product.status": 1,
            "product.datestart": null,
            "product.dateend": null,
            "product.config": []
        }
    }
],

"included": []

}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply