Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
# RESTful API for a Blog # Resources: /posts, /users, /comments # GET /posts — get all posts # GET /posts/{id} — get one post # POST /posts — create a post # PUT /posts/{id} — replace a post # PATCH /posts/{id} — partially update # DELETE /posts/{id} — delete a post # Example request using curl curl -X GET https://api.example.com/posts \ -H "Accept: application/json" \ -H "Authorization: Bearer your-token" # Example response { "data": [ { "id": 1, "title": "Hello World", "author": "Alice" }, { "id": 2, "title": "REST APIs", "author": "Bob" } ], "meta": { "total": 2, "page": 1, "per_page": 10 } }
Result
Open