REST API with nested filters on 'attribute'

Hi,

I am trying to list all the “Items” using variant filter, Pls check the JSON below (Removed other fields to keep it short"

{
“data”: {
“is_service_item”: 1,
“item_name”: “Wash-MS”,
“item_code”: “E-01-MS”,
“attributes”: [
{
“attribute”: “Vehicle Type”,
“doctype”: “Variant Attribute”,
“parenttype”: “Item”,
“attribute_value”: “Medium Sedan”,
“parentfield”: “attributes”
}
]
}
}

I wanted to know how to create the REST url with “filters” for Item, where the attributes/attribute == "Vehicle Type and ‘attribute_value’ == “Medium Sedan”

Thanks
Gireesh

@Gireesh_Kumar

/api/resource/Variant Attribute/&filters=[["Variant Attribute", "attribute", "=", "Vehicle"],["Variant Attribute", "atribute_value", "=", "Medium Sedan"]]

This is to filter “Variants” records, but I wanted to get all “Items” filtered by variant value, “Medium Sedan”, like a Join.

You can’t do joins, you will have write a method in your app and call that method via the API

1 Like

Can you expand on how to do that at all? Is there a way to pass parameters to our own methods?

You might be able to solve with referring to this document.
https://frappeframework.com/docs/user/en/guides/app-development/overriding-link-query-by-custom-script#custom-method