Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Commit

Permalink
Added an example for inline action
Browse files Browse the repository at this point in the history
  • Loading branch information
pksunkara committed Feb 27, 2015
1 parent d3f56e8 commit 915dc74
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
3 changes: 2 additions & 1 deletion examples/11. Resource Model.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ Resource model is a [resource manifestation](http://www.w3.org/TR/di-gloss/#def-
Furthermore, in API Blueprint, any `resource model` you have defined can be referenced in a request or response section, saving you lots of time maintaining your API blueprint. You simply define a resource model as any payload (e. g. [request](https://github.com/apiaryio/api-blueprint/blob/master/examples/06.%20Requests.md) or [response](https://github.com/apiaryio/api-blueprint/blob/master/examples/5.%20Responses.md)) and then reference it later where you would normally write a `request` or `response`.

## API Blueprint
+ [Previous: Advanced Attributes](09.%20Advanced%20Attributes.md)
+ [Previous: Data Structures](10.%20Data%20Structures.md)
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/10.%20Resource%20Model.md)
+ [Next: Inline Action](12.%20Inline%20Action.md)

# Group Messages
Group of all messages-related resources.
Expand Down
66 changes: 66 additions & 0 deletions examples/12. Inline Action.md
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"
}
]

0 comments on commit 915dc74

Please sign in to comment.