Selasa, 20 Agustus 2019

REST API

Application Programming Interface (API) : is a set of routines, protocols, and tools for building software applications

Beberapa Jenis API :
• Representational State Transfer (REST)
• Remote Procedure Calls (RPC)
• Simple Object Access Protocol (SOAP)

REST
• REST kependekan dari REpresentational State Transfer
The REST architectural style describes six constraints. These constraints, applied to the architecture, were originally communicated by Roy Fielding in his doctoral dissertation (see https://www.ics.uci.edu/~fielding/pubs/dissertation/ rest_arch_style.htm) and defines the basis of RESTfulstyle. 

The six constraints are: 
• Uniform Interface 
• Stateless 
• Cacheable 
• Client-Server 
• Layered System 
• Code on Demand (optional)

  •  Generality – language agnostic 
  • Familiarity 
  • Scalability 
  • Segmentation 
  • Speed 
  • Security 
  • Encapsulation 

REST API
• Berjalan di atas protokol HTTP 
• Menggunakan JSON atau XML untuk mengirimkan data

JSON
• Better Language Support 
• Lightweight (much less code than XML)

PRAKTEK :
Database : xampp diaktifkan > Apache & my SQL

Buka localhost > phpmyadmin > input > choose File (sebelumnya download dahulu folder ServerRest
lalu File ServerRest dicut dan dipindahkan di xampp > htdocs > ServerRest

Buka postman isikan URL si localhost (http://127.0.0.1/serverrest/index.php/kontak)

Pilih menu Body selsct x-www-form-urlencoded
Dsini kita bisa pilih GET, POST, DELETE, ect...
untuk menjalankan fungsi lain harus ditambahin source code unutk DELETE, PUT, ect..
dengan membuka open folfer di visual code application > (kontak.php)


untuk mempelajari lebih detail dapat dilihat di



Tidak ada komentar:

Posting Komentar