DeveloperBreeze

Api Integration Development Tutorials, Guides & Insights

Unlock 6+ expert-curated api integration tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your api integration skills on DeveloperBreeze.

Tutorial
php

Handling HTTP Requests and Raw Responses in Laravel

  • $response->successful(): Returns true if the response has a status code of 200-299.
  • $response->failed(): Returns true if the request failed (status code of 400 or greater).

Other useful methods include:

Oct 24, 2024
Read More
Tutorial
javascript

AJAX with JavaScript: A Practical Guide

Before the Fetch API, the traditional way to make AJAX requests was using XMLHttpRequest.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AJAX with XMLHttpRequest</title>
</head>
<body>
    <button id="fetchDataBtn">Fetch Data</button>
    <div id="dataOutput"></div>

    <script>
        document.getElementById('fetchDataBtn').addEventListener('click', function() {
            var xhr = new XMLHttpRequest();
            xhr.open('GET', 'https://jsonplaceholder.typicode.com/posts/1', true);

            xhr.onload = function() {
                if (this.status === 200) {
                    var data = JSON.parse(this.responseText);
                    document.getElementById('dataOutput').innerHTML = `
                        <h3>${data.title}</h3>
                        <p>${data.body}</p>
                    `;
                }
            };

            xhr.onerror = function() {
                console.error('Request failed.');
            };

            xhr.send();
        });
    </script>
</body>
</html>

Sep 18, 2024
Read More
Tutorial
javascript php

Building a Custom E-commerce Platform with Laravel and Vue.js

public function up()
{
    Schema::create('products', function (Blueprint $table) {
        $table->id();
        $table->string('name');
        $table->text('description');
        $table->decimal('price', 8, 2);
        $table->unsignedBigInteger('category_id');
        $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
        $table->timestamps();
    });
}

Categories Table:

Aug 27, 2024
Read More
Tutorial
php

Integrating and Using NMI Payment Gateway in Laravel

In a controller, you can use the NMI service as follows:

   use App\Services\NMI;

   class PaymentController extends Controller
   {
       protected $nmi;

       public function __construct(NMI $nmi)
       {
           $this->nmi = $nmi;
       }

       public function storeCustomer(Request $request)
       {
           $creditCard = $request->only(['cc_number', 'exp_date', 'cvv']);
           $customerVaultId = $this->nmi->addCustomerVault($creditCard);

           return response()->json(['customer_vault_id' => $customerVaultId]);
       }

       public function processPayment(Request $request)
       {
           $customerVaultId = $request->input('customer_vault_id');
           $amount = $request->input('amount');
           $paymentResponse = $this->nmi->processPaymentUsingVault($customerVaultId, $amount);

           return response()->json($paymentResponse);
       }
   }

Aug 14, 2024
Read More
Tutorial
dart

Building an Advanced Weather App with Flutter and Dart

cd weather_app

Open the project in your preferred IDE.

Aug 12, 2024
Read More