How to filter product text by API (jsonadm and graphql) request
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!
- ИванМаксимов
- Posts: 8
- Joined: 06 Sep 2023, 17:16
How to filter product text by API (jsonadm and graphql) request
Please, help me write API request to get long english text for a given product. For graphql or jsonadm API.
I try graphql request (on default demo data):
But get error:
I try for just check filtering text attrs feature :
or product.text.type
But get error:
Env:
"aimeos/aimeos-laravel": 2023.07.01
"laravel/framework": v10.21.0
php 8.1
Docker
Mac
I try graphql request (on default demo data):
Code: Select all
"query":"query { getProduct(id:\"15\", include: [\"product/text\"]){ id,type,label,lists{text(listtype: \"default\", type: \"long\") { id, item (languageid: \"en\") { type label languageid } } } }}"
Code: Select all
"message":"Unknown argument \"languageid\" on field \"item\" of type \"productliststextOutput\".
Code: Select all
"query":"query { searchProducts( include: [\"product/text\"], filter: \"{\\\"==\\\":{\\\"product/text.type\\\":\\\"long\\\"}}\" ){ id,type,label,lists{text(listtype: \"default\", type: \"long\") { id, item { type label languageid } } } }}"
But get error:
Code: Select all
{"errors":[{"message":"Internal server error","locations":[{"line":1,"column":9}],"path":["searchProducts"]}],"data":{"searchProducts":null}}
"aimeos/aimeos-laravel": 2023.07.01
"laravel/framework": v10.21.0
php 8.1
Docker
Mac
Re: How to filter product text by API (jsonadm and graphql) request
This should work:
Code: Select all
query {
searchProducts(filter: "{}", include: ["product/text"]) {
id
type
code
label
lists {
text(listtype: "default", type: "long") {
id
item {
type
domain
languageid
label
}
}
}
}
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- ИванМаксимов
- Posts: 8
- Joined: 06 Sep 2023, 17:16
Re: How to filter product text by API (jsonadm and graphql) request
This worked, but i ask about "english" text!
How to filter by languadeid field value?
How to filter by languadeid field value?
Re: How to filter product text by API (jsonadm and graphql) request
You can't. The GraphQL API is for administration purpose only and you can't limit the texts of the product by any property because you need to pass all texts when you save them again. Texts with are not sent in the request are deleted.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- ИванМаксимов
- Posts: 8
- Joined: 06 Sep 2023, 17:16
Re: How to filter product text by API (jsonadm and graphql) request
Ok. What about jsonadm ? By jsonadm API it's possible?
- ИванМаксимов
- Posts: 8
- Joined: 06 Sep 2023, 17:16
Re: How to filter product text by API (jsonadm and graphql) request
And the next question: how to update the content of one text for a product?
Pease, give example request of update one text of existing product
Pease, give example request of update one text of existing product
Re: How to filter product text by API (jsonadm and graphql) request
The JsonAdm API allows updating single items but it's deprecated and you shouldn't use it any more because it will be removed in the future.
With the GraphQL API, you can update all (text) items at once (pass those you didn't modify too, otherwise the will be deleted):
With the GraphQL API, you can update all (text) items at once (pass those you didn't modify too, otherwise the will be deleted):
Code: Select all
mutation {
saveProduct(input: {
id: "123",
code: "test"
label: "Test product"
lists: {
text: [{
type: "default",
item: {
content: "...",
label: "...",
languageid: "..."
}, {
// ...
}
]
}
}) {
id
}
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

- ИванМаксимов
- Posts: 8
- Joined: 06 Sep 2023, 17:16
Re: How to filter product text by API (jsonadm and graphql) request
Thank you so much!
type: "default" <--- is it a list entry type? where can I find out what types are available and what they are for?aimeos wrote: ↑07 Sep 2023, 08:24Code: Select all
mutation { saveProduct(input: { id: "123", code: "test" label: "Test product" lists: { text: [{ type: "default",
Re: How to filter product text by API (jsonadm and graphql) request
Have a look into the "Types > Product lists" panel in admin backend. There you can see the available types and can add your own. They can be used in the frontend for additional grouping of referenced items but for texts, their value is almost always "default" (which you can skip because it's also the default value).ИванМаксимов wrote: ↑07 Sep 2023, 09:35 type: "default" <--- is it a list entry type? where can I find out what types are available and what they are for?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,
