Getting empty data values while accessing jsonapi resource
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Getting empty data values while accessing jsonapi resource
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
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
Re: Getting empty data values while accessing jsonapi resour
Did you add at least one category to your products?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Getting empty data values while accessing jsonapi resour
Yes I did, and this is not only related to product but also for all the resources like order, stock etc
Re: Getting empty data values while accessing jsonapi resour
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, give us a star
If you like Aimeos, give us a star