How to consume an external API with Filament Tables
I've been trying to use this method to consume an external API with the filament tables but it's giving me an error, can anyone tell me if there is another way?
49 Replies
What is the code you have and what error are you getting?
Have you looked into https://docs.saloon.dev ?
I am not sure how you are envisioning using the API but with Saloon you can create your connectors and requests to process data, and then have that data displayed on your tables and forms.
Saloon
Build beautiful API integrations and SDKs with Saloon
Oh i was trying to use that one:
https://filamentphp.com/blog/how-to-consume-an-external-api-with-filament-tables
Filament
How to consume an external API with Filament Tables by Leandro C. F...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
@pea_gah Can you share your Sushi model?
The same as here, but here a screenshot
I see.
Can you run this command and share the output?
Maybe i need to active sqlite extension on php.ini ?
Oh is this windows/powershell?
But yeah, I'm thinking the sqlite extension is not installed or active... you need it with Sushi
Let me try
Was active...
Yes
if you run
php -i
(without the rest), can you see this text?
Very weird...
Can you try
php artisan tinker
Then type Product::all()
I'm thiking that too π
\App\Models\Product::all()
lol, we'll get there
Can you replace the call to the fake API with some static data?
Very weird...
Check in
storage/framework/cache
, do you see any .sqlite files?Delete it and try again
Same as before
Maybe i ill just try this package
Sounds good
The problem was that I use Laragon for hosting, and the sqlite extension there was disabled.
@pboivin Ty for help!
Ah, totally makes sense. You're welcome π
Hi, did Saloon work for you? Could you show an example of how you used it?
@_urufu Hello, I did not use Saloon, but this method here
But apparently the author deleted the post, I can show you my code of how it turned out
i think the new link is this https://filamentphp.com/community/how-to-consume-an-external-api-with-filament-tables , but can u show me your code please
Filament
How to consume an external API with Filament Tables by Leandro Ferr...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
I was using a Currencies API
thanks so much
If you still need help, just call me π
@pea_gah Bro i just create an api which get some record (15000+) with pagination and that api i call in a model as you write but it shows me could not find driver error and create that table in which I want to show the records, and one more thing the resource and model is already created and also table
@noobita1012 Sorry for the delay, I had a problem with a similar driver, check your php.ini if ββyour database extension is active.
In case you use XAMPP, Laragon or something like that, make sure to enable the database extensions as well, this should fix the driver issues.
Bro i am use postgresql
Can you check in your php.ini if ββthe extension is enabled?
Ok let me check once, but thanku for reply
See if extension=pgsql and extension=pdo_pgsql are enabled
@noobita1012 It worked?
my php.ini
You are using postgres, right?
yes
Uncomment these two extensions
After uncommenting try running the code again, it should be working now
no the same issue is still there
Do you use xampp, laragon or something similar?
In my case, this same error that is happening to you was solved in the way I commented above, but I had to do the same in the php.ini of laragon
bro i am really sry i don't have the sqllite extension
so the error of could not find the driver arises from there
That's make sense, I'm glad you managed to solve it
yeah !
one more thing i wnt to show the data of my api in resource table but while create the form of that resource i wnt it should store in my migration table?
is it possible
like resource data should show in the table but create data should store in the local database table
Hello, I was a little confused by your description of how you want to do it, but I'll give you an example of how I did it.
I had a project to list currencies from an API and make their conversion and the operation be stored in the database, the following prints show how the code turned out, I hope it helps you.
You can open it in the browser to get a better view.