Using Lumen for reading a REST API Hi,
perhaps I am just blind, but I cannot find any example how to use Lumen for reading out data from a REST API.
There are tons of examples how to make an API with Lumen, but not the other way around?!
Can someone give me an example how to read in data from an API and use this content or just show me a tutorial which I have not found?
Thanks and best wishes
kay
Yup.. Guzzle is straightforward and easy to use.. read the docs, it's all there -- aside from maybe what the api endpoints are you want to hit on the API you're trying to consume. But hopefully it's at least somewhat documented. :)
http://guzzle3.readthedocs.org/
Thanks for your answers.
I try to use Guzzle like this, but I get a 500 error:
http://laravel.io/bin/PXaL8
When I ask for that URL via Browser or a RESTClient I'll get my JSON structure back.
Any ideas?
Thanks!
your api.local server is the one with the issue, not the client you pasted code for. The api server is throwing the 500 error.
Check error logs for that and see what's up.
@willvincent
thanks for the fast answer.
error log says:
lumen.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)'
But I don't use homestead. I use Windows XAMPP and SQLITE as database, which is defined in .ENV
it would seem your .env file isn't being evaluated properly then..
Please sign in or create an account to participate in this conversation.