This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
FORMAT: 1A | ||
|
||
# Inline Action API | ||
This API example demonstrates that a resource can contain an in-place definition of another resource. This allows us to show that the resource `Task` can afford an action that is not limited to the resource `Task`. | ||
|
||
## API Blueprint | ||
+ [Previous: Resource Model](11.%20Resource%20Model.md) | ||
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/11.%20Inline%20Action.md) | ||
|
||
# Task [/tasks/{id}] | ||
|
||
+ Parameters | ||
+ id (string) | ||
|
||
## Retrieve Task [GET] | ||
|
||
+ Response 200 (application/json) | ||
|
||
{ | ||
"id": 123, | ||
"name": "Go to gym", | ||
"done": false, | ||
"type": "task" | ||
} | ||
|
||
## Update Task [PATCH] | ||
This is a state transition within the same resource | ||
|
||
+ Request (application/json) | ||
|
||
{ | ||
"name": "Exercise in gym" | ||
} | ||
|
||
+ Response 200 (application/json) | ||
|
||
{ | ||
"id": 123, | ||
"name": "Exercise in gym", | ||
"done": false, | ||
"type": "task" | ||
} | ||
|
||
## List All Tasks [GET /tasks{?status,priority}] | ||
This is a state transition to another resource | ||
|
||
+ Parameters | ||
+ status (string) | ||
+ priority (number) | ||
|
||
+ Response 200 (application/json) | ||
|
||
[ | ||
{ | ||
"id": 123, | ||
"name": "Exercise in gym", | ||
"done": false, | ||
"type": "task" | ||
}, | ||
{ | ||
"id": 123, | ||
"name": "Shop for groceries", | ||
"done": true, | ||
"type": "task" | ||
} | ||
] |