How to define a custom api endpoint for a resource?
I have a resource
Which trying to GET data from
How to change this path to
3 Replies
Hi @mflash.. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
In refine, the
resource
prop is usually used as an API endpoint path. This is passed to the dataProvider
as a parameter. However, the way it is handled depends on your dataProvider
implementation.
If you want to change the API endpoint path for a specific resource, you would need to modify your dataProvider
to handle this. Unfortunately, the extracts provided do not contain specific information on how to modify the dataProvider
for this purpose.
However, there is a discussion in the extracts about using different data providers for different resources. This might be a possible solution for your case. You can create a custom data provider for the "suppliers" resource that uses the desired endpoint path. Here is the link to the documentation mentioned in the extract: Multiple Data Providers (https://refine.dev/docs/api-reference/core/providers/data-provider/#multiple-data-providers)
Please note that this is a general direction based on the information available in the extracts. For a more specific solution, you might need to refer to the complete documentation or seek help from the refine community.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@204169884727246849> kapa.ai is still learning and improving, please let us know how it did by reacting below
graceful-blue•11mo ago
Hey @mflash. , you can change the name to
dictionaries/suppliers
and then add identifier property as suppliers
The endpoint will change but you will still be able to reference it as suppliers