cancel
Showing results for 
Search instead for 
Did you mean: 

How can i call external REST API from Magento 2.2.5

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

How can i call external REST API from Magento 2.2.5

How can i call external REST API from Magento 2.2.5

Please tell me. https://hardwoodfloorrefinishingin.com/canada/calgary/ 

Thanks

Re: How can i call external REST API from Magento 2.2.5

@liamjames72e29 

You can call any external API using a curl request.

Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.

Re: How can i call external REST API from Magento 2.2.5

$ch = curl_init('YOUR_EXTERNAL_API_URL'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_API_KEY']); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true);
Replace YOUR_EXTERNAL_API_URL with the API URL and YOUR_API_KEY with the actual API key.