Does the simple-rest provider support passing query parameters through meta property?
the following code
const { data, isLoading } = useList<EquipmentResDto>({
filters: [
{
field: "serialNumber",
operator: "contains",
value: targetEquipment || "",
}
],
meta: {
populate: ["location", "category"]
}
});
doesnt send my populate query when fetching list items
2 Replies
Hi @NIHR. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
The simple-rest data provider in refine does not natively support passing arbitrary query parameters (such as Strapi's populate) through the meta property. The meta property is available and can be used to pass additional information to your data provider methods, but its effect depends entirely on how the data provider is implemented.
In the default simple-rest provider, meta is typically used for things like custom headers, not for generating custom query parameters like populate. The code examples in the documentation show meta being used for headers, and the filter, sort, and pagination parameters are handled separately and mapped to query parameters, but there is no mention of meta being used to generate arbitrary query parameters for the request URL in the simple-rest provider. This is in contrast to the Strapi v4 provider, which does support using meta for populate and similar parameters.
If you want to send custom query parameters like populate with the simple-rest provider, you would need to customize your data provider's getList method to handle meta and append those parameters to the request URL yourself. Out of the box, the simple-rest provider does not do this for you Data Fetching: dataProvider interface, useList meta property.
So, in your example, the meta: { populate: ["location", "category"] } will not result in a populate query parameter being sent unless you have specifically modified your data provider to handle it.
Summary:
No, the simple-rest provider does not support passing query parameters like populate through the meta property by default. You would need to extend or customize the provider to achieve this behavior. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
No, the simple-rest provider does not support passing query parameters like populate through the meta property by default. You would need to extend or customize the provider to achieve this behavior. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@310660428135006208> Kapa.ai is still learning and improving, please let me know how I did by reacting below.