setApiUrlPath(string $urlPath)

Grocery CRUD by default use the same URL that was initially called. As Grocery CRUD is actually an API at the backend, it is very common to want to change the URL path. For this the usage of setApiUrlPath is required. This functionality also give the opportunity to have the basic page as static and to have the Grocery CRUD Api to a completely different place.

As people may still be confused of what the setApiUrlPath is doing let's have an example.

The current page is loaded on the URL:, however this page is cached and the routes are a bit more complicated than you may think!

In fact our api is served to a different server so the function setApiUrlPath is crucial to see all the examples that we have on our website 😃

So for this page specifically we are using the below line:


You can see the full code below:

$crud->setSubject('Customer', 'Customers');


$output = $crud->render();

So all the ajax API requests are going to: instead of that would be the default one.

You can see the results of the above code here: