Sudah tahu sekilas tentang REST. Tapi mendapat penjelasan lebih dalam lagi dari artikel ini.
Disalin langsung dari sumbernya:
What is REST?
Representational State Transfer (REST) is lightweight, HTTP based and runs on web servers much like ‘normal’ web sites. Instead of delivering in HTML, which is a combination of presentation and data, data is displayed with minimum formatting using separators and delimiters (like JSON). It can be thought of as an architectural style for designing networked applications or as a way of delivering web services. REST is browsable, so helps developers modify and check the correctness of their code as only the data is displayed in the browser. It is a safer method of providing services or data access as it does not expose much unnecessary surface area of the database used by the website. Some well-known REST apis are from Twitter and Facebook Graph.
REST is platform and language independent. You could write a REST API with any languages that are typically associated with website creation such as PHP, Python or Ruby. There are four commonly defined methods used in REST architecture. These are the
create
,read
,update
anddelete
(CRUD) methods. It is also possible to add more specialized methods such as retrieving the top ten most popular items or the highscore of all users. This could be achieved by writing a new method or using a query parameter such as/api/items?top=10
.HTTP Methods and API endpoints
You might remember from creating web forms (synchronous) or ajax request (asynchronous) calls that you used GET and POST requests. The PUT and DELETE requests are less used. If you then wrote an application in PHP, Python or other language to process form data, you have written your own simple REST framework. POST, GET, PUT and DELETE correspond to create, read, update and delete and relate to basic database operations. API endpoints describe available operations on data exposed by the service. Think of them as urls that provide data (GET request) or an url where you can submit data to (POST request). Many data formats could be used but the more common are JSON and XML. GET
/api/boats/123456
will return data on the boat with an id of 123456 even when applied multiple times.
Tutorialnya menggunakan Python. Karena tidak menguasai, jadi tidak bisa mencoba 😁
Tapi yang penting malah bisa dapat konsepnya di sini.
***
Sekalian mencoba fitur Press This! yang katanya diperbarui di WordPress 4.2.
Lumayan sih, tapi sepertinya hanya mengambil Excerpt-nya saja. Bukan satu artikel penuh.
Ini dia penampakannya:
***
Mark Wong shows us how to create a simple REST API using Python to feed data to an iOS application.