0
votes

I am new to OctoberCMS, I am wondering if it is possible to use http request to fetch data from an external api?

I tried to google this but couldn’t find any results. Maybe I’m searching using the wrong terms.

Can anyone please give me ANY info or tutorials? I know how to do it in PHP but not exactly sure how to integrate it in octobercms and its template page

Thanks

1
can you check this docu: octobercms.com/docs/api/october/rain/network/readme it can help you as it has all get, post, put, delete requests for api.Hardik Satasiya
Thanks for your reply. How could this be integrated in the twig template? Is it the same procedure as Laravel? Meaning do whatever needs to be done in the controller and return it in the blade template file?shieldcy
you need to read the documentation first for that otherwise you will get a question which is already answered in the documentation, check this octobercms.com/docs/cms/pages -> in the code section you can use API callsHardik Satasiya

1 Answers

0
votes
  1. Create a routes.php file at the root of your plugin

  2. Add the following code example to the file (routing like in laravel): enter image description here

  3. Open your address and enter localhost/test-request in the address bar