{"id":150,"date":"2025-06-18T01:10:17","date_gmt":"2025-06-18T01:10:17","guid":{"rendered":"https:\/\/devia.infokand23.my.id\/laprak1\/?p=150"},"modified":"2025-06-18T12:49:55","modified_gmt":"2025-06-18T12:49:55","slug":"laporan-11","status":"publish","type":"post","link":"https:\/\/devia.infokand23.my.id\/laprak1\/laporan-11\/","title":{"rendered":"LAPORAN PRAKTIKUM 11"},"content":{"rendered":"\n<div class=\"wp-block-group alignfull has-background-color has-white-color has-black-background-color has-text-color has-background has-link-color wp-elements-68de904d4e9313f2932c42acd7d1e5c1\" style=\"padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--30)\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-container-core-group-is-layout-97875daf wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group alignwide is-content-justification-space-between is-layout-flex wp-container-core-group-is-layout-256aec57 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-group is-layout-flex wp-block-group-is-layout-flex\"><\/div>\n\n\n\n<div class=\"wp-block-group is-layout-flex wp-block-group-is-layout-flex\"><nav class=\"is-responsive items-justified-right wp-block-navigation is-content-justification-right is-layout-flex wp-container-core-navigation-is-layout-3817c3ed wp-block-navigation-is-layout-flex\" aria-label=\"Navigation\" \n\t\t data-wp-interactive=\"core\/navigation\" data-wp-context='{\"overlayOpenedBy\":{\"click\":false,\"hover\":false,\"focus\":false},\"type\":\"overlay\",\"roleAttribute\":\"\",\"ariaLabel\":\"Menu\"}'><button aria-haspopup=\"dialog\" aria-label=\"Open menu\" class=\"wp-block-navigation__responsive-container-open\" \n\t\t\t\tdata-wp-on-async--click=\"actions.openMenuOnClick\"\n\t\t\t\tdata-wp-on--keydown=\"actions.handleMenuKeydown\"\n\t\t\t><svg width=\"24\" height=\"24\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><rect x=\"4\" y=\"7.5\" width=\"16\" height=\"1.5\" \/><rect x=\"4\" y=\"15\" width=\"16\" height=\"1.5\" \/><\/svg><\/button>\n\t\t\t\t<div class=\"wp-block-navigation__responsive-container\"  id=\"modal-1\" \n\t\t\t\tdata-wp-class--has-modal-open=\"state.isMenuOpen\"\n\t\t\t\tdata-wp-class--is-menu-open=\"state.isMenuOpen\"\n\t\t\t\tdata-wp-watch=\"callbacks.initMenu\"\n\t\t\t\tdata-wp-on--keydown=\"actions.handleMenuKeydown\"\n\t\t\t\tdata-wp-on-async--focusout=\"actions.handleMenuFocusout\"\n\t\t\t\ttabindex=\"-1\"\n\t\t\t>\n\t\t\t\t\t<div class=\"wp-block-navigation__responsive-close\" tabindex=\"-1\">\n\t\t\t\t\t\t<div class=\"wp-block-navigation__responsive-dialog\" \n\t\t\t\tdata-wp-bind--aria-modal=\"state.ariaModal\"\n\t\t\t\tdata-wp-bind--aria-label=\"state.ariaLabel\"\n\t\t\t\tdata-wp-bind--role=\"state.roleAttribute\"\n\t\t\t>\n\t\t\t\t\t\t\t<button aria-label=\"Close menu\" class=\"wp-block-navigation__responsive-container-close\" \n\t\t\t\tdata-wp-on-async--click=\"actions.closeMenuOnClick\"\n\t\t\t><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" aria-hidden=\"true\" focusable=\"false\"><path d=\"m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z\"><\/path><\/svg><\/button>\n\t\t\t\t\t\t\t<div class=\"wp-block-navigation__responsive-container-content\" \n\t\t\t\tdata-wp-watch=\"callbacks.focusFirstElement\"\n\t\t\t id=\"modal-1-content\">\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div><\/nav>\n\n\n<a href=\"https:\/\/devia.infokand23.my.id\/index.html\" target=\"_blank\">Home<\/a>\n\n\n\n<a href=\"https:\/\/devia.infokand23.my.id\/about.html\" target=\"_blank\">Document<\/a>\n<\/div>\n<\/div>\n<\/div><\/div>\n\n\n\n<p><a href=\"https:\/\/github.com\/deviapujiastuti\/pweb-api-projec.git\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a><\/p>\n\n\n\n<p>Tutorial RESTful API menggunakan POSTMAN pada project Laravel<\/p>\n\n\n\n<p class=\"has-small-font-size\">Komponen-komponen utama API adalah sebagai berikut:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li class=\"has-small-font-size\">Request (Permintaan)\n<ul class=\"wp-block-list\">\n<li>URL\/Endpoint<\/li>\n\n\n\n<li>HTTP Method<\/li>\n\n\n\n<li>Headers<\/li>\n\n\n\n<li>Body\/Payload<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li class=\"has-small-font-size\">Response (Respon)\n<ul class=\"wp-block-list\">\n<li>Status Code<\/li>\n\n\n\n<li>Headers<\/li>\n\n\n\n<li>Body\/Data<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-small-font-size\">RESTful API (Representational State Transfer) adalah arsitektur untuk merancang web services. REST bukan protokol atau standar, melainkan seperangkat prinsip desain. RESTful API adalah jenis antarmuka yang memungkinkan dua sistem komputer berkomunikasi secara aman dan efisien melalui internet dengan mengikuti prinsip arsitektur REST\u2014yakni client\u2011server, stateless, mampu cache, dan menggunakan interface yang seragam dimana setiap sumber daya diidentifikasi lewat URI dan dimanipulasi menggunakan metode HTTP seperti GET, POST, PUT, DELETE. Representasi data\u2014biasanya dalam JSON atau XML\u2014dipindahkan sebagai \u201cstate\u201d dari sumber daya, sementara server tidak menyimpan informasi terkait status klien antar permintaan, sehingga memudahkan skalabilitas dan integrasi. Desain ini menjadikan RESTful API ringan, mudah dipelajari, dan sangat ideal untuk aplikasi web maupun mobile modern<\/p>\n\n\n\n<p>Prinsip REST API:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-small-font-size\">Client-Server Architecture: Client dan server terpisah dan dapat berkembang secara independen.<\/li>\n\n\n\n<li class=\"has-small-font-size\">Stateless: Setiap request harus berisi semua informasi yang diperlukan server untuk memproses request tersebut.<\/li>\n\n\n\n<li class=\"has-small-font-size\">Cacheable: Response harus dapat di-cache untuk meningkatkan performa.<\/li>\n\n\n\n<li class=\"has-small-font-size\">Uniform Interface: Interface yang konsisten antara client dan server.<\/li>\n\n\n\n<li class=\"has-small-font-size\">Layered System: Arsitektur berlapis yang memungkinkan scalability.<\/li>\n\n\n\n<li class=\"has-small-font-size\">Code on Demand (Opsional): Server dapat mengirim kode executable ke client<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Langkah-Langkah<\/h2>\n\n\n\n<p class=\"has-small-font-size\">Berikut adalah langkah-langkah untuk menerpakan RESTful API pada project Laravel menggunakan POSTMAN<\/p>\n\n\n\n<p class=\"has-small-font-size\">Pada tutorial ini, kita akan membuat sebuah project CRUD sederhana menggunakan Laravel. Buat sebuah project laravel baru atau di project laravel yang sudah ada (pada tutorial ini kita akan membuat project laravel baru dan akan membuat project CRUD sederhana)<\/p>\n\n\n\n<p class=\"has-small-font-size\">Pertama, kita akan membuat migrasi databasenya. untuk membuat migrasi, gunakan kode berikut di terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:model Product<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Kemudian isi dengan kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>class Product extends Model \n{ \n    protected $fillable = &#91; \n        'name', 'description', 'price', 'stock' \n    ]; \n     \n    protected $casts = &#91; \n        'price' =&gt; 'decimal:2' \n    ]; \n}<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Kemudian, kita buat API Routes untuk website kita. ketik di terminal kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>php artisan install:api<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Lalu, buat di file routes\/api.php kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>Route::apiResource('products', ProductController::class); \n  \n\/\/ manual: \nRoute::get('products', &#91;ProductController::class, 'index']); \nRoute::post('products', &#91;ProductController::class, 'store']); \nRoute::get('products\/{product}', &#91;ProductController::class, 'show']); \nRoute::put('products\/{product}', &#91;ProductController::class, 'update']); \nRoute::delete('products\/{product}', &#91;ProductController::class, 'destroy']);<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Setelah itu, buat controller bernama ProductController dengan kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>php artisan make:controller ProductController --api<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Setelah itu, isi dengan kode berikut di controller:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>class ProductController extends Controller \n{ \n    public function index() \n    { \n        $products = Product::all(); \n        return response()-&gt;json(&#91; \n            'status' =&gt; 'success', \n            'data' =&gt; $products \n        ]); \n    } \n     \n    public function store(Request $request) \n    { \n        $validated = $request-&gt;validate(&#91; \n            'name' =&gt; 'required|string|max:255', \n            'description' =&gt; 'required|string', \n            'price' =&gt; 'required|numeric|min:0', \n            'stock' =&gt; 'required|integer|min:0' \n        ]); \n         \n        $product = Product::create($validated); \n         \n        return response()-&gt;json(&#91; \n            'status' =&gt; 'success', \n            'message' =&gt; 'Product created successfully', \n            'data' =&gt; $product \n        ], 201); \n    } \n     \n    public function show(Product $product) \n    { \n        return response()-&gt;json(&#91; \n            'status' =&gt; 'success', \n            'data' =&gt; $product \n        ]); \n    } \n     \n    public function update(Request $request, Product $product) \n    { \n        $validated = $request-&gt;validate(&#91; \n            'name' =&gt; 'sometimes|string|max:255', \n            'description' =&gt; 'sometimes|string', \n            'price' =&gt; 'sometimes|numeric|min:0', \n            'stock' =&gt; 'sometimes|integer|min:0' \n        ]); \n         \n        $product-&gt;update($validated); \n         \n        return response()-&gt;json(&#91; \n            'status' =&gt; 'success', \n            'message' =&gt; 'Product updated successfully', \n            'data' =&gt; $product \n        ]); \n    } \n     \n    public function destroy(Product $product) \n    { \n        $product-&gt;delete(); \n         \n        return response()-&gt;json(&#91; \n            'status' =&gt; 'success', \n            'message' =&gt; 'Product deleted successfully' \n        ]); \n    } \n}<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Kemudian, kita akan membuat API Resource. Fitur yang memungkinkan untuk mentransformasi model data atau collection menjadi format JSON yang konsisten dan mudah dikustomisasi untuk API response. API Resource berfungsi sebagai layer transformasi antara model Eloquent dan JSON response yang dikirim ke client sehingga dapat digunakan untuk Mengontrol format output JSON, Menyembunyikan field sensitive, Menambahkan field computed dan Membuat response yang konsisten.<\/p>\n\n\n\n<p class=\"has-small-font-size\">Ketik kode berikut di terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>php artisan make:resource ProductResource<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">kemudian, isi dengan kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>class ProductResource extends JsonResource \n{ \n    public function toArray($request) \n    { \n        return &#91; \n            'id' =&gt; $this-&gt;id, \n            'name' =&gt; $this-&gt;name, \n            'description' =&gt; $this-&gt;description, \n            'price' =&gt; $this-&gt;price, \n            'stock' =&gt; $this-&gt;stock, \n            'created_at' =&gt; $this-&gt;created_at-&gt;format('Y-m-d H:i:s'), \n            'updated_at' =&gt; $this-&gt;updated_at-&gt;format('Y-m-d H:i:s') \n        ]; \n    } \n}<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Untuk menggunakan resource yang telah dibuat di controller, ubah function index() dan show() di ProductController seperti berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>public function index() \n{ \n    $products = Product::all(); \n    return ProductResource::collection($products); \n} \n  \npublic function show(Product $product) \n{ \n    return new ProductResource($product); \n}<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Selanjutnya, kita akan membuat validasi dan error handling. Pertama, kita akan membuat Form Request Validation. Gunakan kode berikut di terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>php artisan make:request StoreProductRequest\n<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Kemudian, masukkan kode berikut di file app\/Http\/Requests\/StoreProductRequest.php<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>class StoreProductRequest extends FormRequest \n{ \n    public function authorize() \n    { \n        return true; \n    } \n     \n    public function rules() \n    { \n        return &#91; \n            'name' =&gt; 'required|string|max:255', \n            'description' =&gt; 'required|string', \n            'price' =&gt; 'required|numeric|min:0', \n            'stock' =&gt; 'required|integer|min:0' \n        ]; \n    } \n     \n    public function messages() \n    { \n        return &#91; \n            'name.required' =&gt; 'Nama produk wajib diisi', \n            'price.min' =&gt; 'Harga tidak boleh negatif' \n        ]; \n    } \n}<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Lalu, tambahkan kode berikut di app\/Exceptions\/Handler.php untuk menangani Exception:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>public function render($request, Throwable $exception) \n{ \nif ($request-&gt;wantsJson()) { \nif ($exception instanceof ValidationException) { \nreturn response()-&gt;json(&#91; \n'status' =&gt; 'error', \n'message' =&gt; 'Validation failed', \n'errors' =&gt; $exception-&gt;errors() \n], 422); \n} \nif ($exception instanceof ModelNotFoundException) { \nreturn response()-&gt;json(&#91; \n'status' =&gt; 'error', \n'message' =&gt; 'Resource not found' \n], 404); \n} \n} \nreturn parent::render($request, $exception); \n} <\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Untuk mengakses api yang telah kita buat, kita perlu menggunakan aplikasi POSTMAN. Install terlebih dahulu POSTMAN<\/p>\n\n\n\n<p class=\"has-small-font-size\">Pertama, install terlebih dahulu json-server menggunakan npm. Install menggunakan kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>npm install -g json-server<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Jika berhasil, cek dengan kode berikut:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>json-server ---version<\/code><\/pre>\n\n\n\n<p class=\"has-small-font-size\">Jika sudah, maka akan seperti berikut:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"114\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-18.png\" alt=\"\" class=\"wp-image-154\" style=\"width:363px;height:auto\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-18.png 767w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-18-300x45.png 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/figure><\/div>\n\n\n<p>Setelah itu, download Postman di link : <a href=\"https:\/\/www.postman.com\/downloads\/\">https:\/\/www.postman.com\/downloads\/<\/a><\/p>\n\n\n\n<p class=\"has-small-font-size\">Untuk mengakses API yang telah kita buat tadi, Pertama-tama hidupkan terlebih dahulu web servernya menggunakan kode berikut:<\/p>\n\n\n\n<p class=\"has-small-font-size\">php artisan serve<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<p class=\"has-small-font-size\">Setelah itu, di aplikasi Postman, untuk mengambil semua products, gunakan URL berikut<br>URL:&nbsp;<a href=\"http:\/\/127.0.0.1:8000\/api\/products\">http:\/\/127.0.0.1:8000\/api\/products<\/a><br>Method: GET<\/p>\n\n\n\n<p class=\"has-small-font-size\">Jika berhasil, maka tampilan Postman akan seperti berikut:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"608\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-19.png\" alt=\"\" class=\"wp-image-159\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-19.png 975w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-19-300x187.png 300w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-19-768x479.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n\n\n\n<p class=\"has-small-font-size\">lanjut ke tahap selanjutnya:<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>1. <\/strong><strong>POST &#8211; Membuat Product Baru<\/strong><\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Method:<\/strong>&nbsp; POST dengan <strong>URL:<\/strong> http:\/\/localhost:8000\/products<\/p>\n\n\n\n<p class=\"has-small-font-size\">digunakan untuk menambahkan atau membuat data baru dan tambahkan data seperti dibawah ini<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>{ \n    \"name\": \"Smartphone Android\", \n    \"description\": \"Smartphone dengan kamera 108MP dan RAM 8GB\", \n    \"price\": 4500000.00, \n    \"stock\": 25 \n} \n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"611\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-20.png\" alt=\"\" class=\"wp-image-162\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-20.png 975w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-20-300x188.png 300w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-20-768x481.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure><\/div>\n\n\n<p><strong>2. GET &#8211; Mengambil Product Berdasarkan ID<\/strong><\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Method:<\/strong>&nbsp; GET dengan <strong>Contoh:<\/strong> http:\/\/localhost:8000\/products\/1<\/p>\n\n\n\n<p class=\"has-small-font-size\">untuk mengambil data dan jika berhasil akan muncul<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"644\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-21.png\" alt=\"\" class=\"wp-image-163\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-21.png 975w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-21-300x198.png 300w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-21-768x507.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure><\/div>\n\n\n<p><strong>3. PUT &#8211; Update Product<\/strong><\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Method:<\/strong> PUT dengan <strong>Contoh:<\/strong> http:\/\/localhost:8000\/products\/1<\/p>\n\n\n\n<p class=\"has-small-font-size\">untuk mengupdate seluruh resource, bisa dilihat dibawah ini dilakukan perubahan data dari yang sebelumnya<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>{ \n    \"name\": \"Laptop Gaming Updated\", \n    \"description\": \"Laptop gaming dengan spek tinggi dan SSD 1TB\", \n    \"price\": 16500000.00, \n    \"stock\": 8 \n} \n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"712\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-22.png\" alt=\"\" class=\"wp-image-164\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-22.png 975w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-22-300x219.png 300w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-22-768x561.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure><\/div>\n\n\n<p><strong>4. DELETE &#8211; Hapus Product<\/strong><\/p>\n\n\n\n<p class=\"has-small-font-size\"><strong>Method:<\/strong> DELETE dengan <strong>Contoh:<\/strong> http:\/\/localhost:8000\/products\/1<\/p>\n\n\n\n<p class=\"has-small-font-size\">untuk menghapus data yang telah dibuat, dibawah ini pada url ditambahkan id berapa data yang akan dihapus dan hasil seperti dibawah ini<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"975\" height=\"611\" src=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-23.png\" alt=\"\" class=\"wp-image-165\" srcset=\"https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-23.png 975w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-23-300x188.png 300w, https:\/\/devia.infokand23.my.id\/laprak1\/wp-content\/uploads\/2025\/06\/image-23-768x481.png 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Home Document GitHub Tutorial RESTful API menggunakan POSTMAN pada project Laravel Komponen-komponen utama API adalah sebagai berikut: RESTful API (Representational State Transfer) adalah arsitektur untuk merancang web services. REST bukan protokol atau standar, melainkan seperangkat prinsip desain. RESTful API adalah jenis antarmuka yang memungkinkan dua sistem komputer berkomunikasi secara aman dan efisien melalui internet dengan &hellip; <a href=\"https:\/\/devia.infokand23.my.id\/laprak1\/laporan-11\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">LAPORAN PRAKTIKUM 11<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-150","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/posts\/150","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/comments?post=150"}],"version-history":[{"count":8,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/posts\/150\/revisions"}],"predecessor-version":[{"id":177,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/posts\/150\/revisions\/177"}],"wp:attachment":[{"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/media?parent=150"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/categories?post=150"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devia.infokand23.my.id\/laprak1\/wp-json\/wp\/v2\/tags?post=150"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}