Skip to content

Commit

Permalink
example: named endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed May 26, 2015
1 parent 19d7224 commit 08698db
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/12. Advanced Action.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ A resource action is – in fact – a state transition. This API example demons
## API Blueprint
+ [Previous: Resource Model](11.%20Resource%20Model.md)
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/12.%20Advanced%20Action.md)
+ [Next: Named Endpoints](13.%20Named%20Endpoints.md)

# Tasks [/tasks/tasks{?status,priority}]

Expand Down
41 changes: 41 additions & 0 deletions examples/13. Named Endpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FORMAT: 1A

# Named Endpoints API
This API example demonstrates how to define a standalone endpoint with an identifier.

## API Blueprint
+ [Previous: Advanced Action](12.%20Advanced%20Action.md)
+ [This: Raw API Blueprint](https://raw.github.com/apiaryio/api-blueprint/master/examples/13.%20Named%20Endpoints.md)

# Group Quick start

## Create user [POST /users]

The first thing we need to do is to add a user that we can later log in as. Do
this by sending a POST request with the relevant details.

+ Request
+ Headers
Content-Type: application/json
+ Body
{ "username": "Linus", "password": "test" }

+ Response 201
+ Headers
Location: /user/1337

## Log in as the user [POST /session]

We can now log in as the user we created. This is accomplished by creating a new
session with the relevant login details.

+ Request
+ Headers
Content-Type: application/json
+ Body
{ "username": "Linus", "password": "test" }

+ Response 201
+ Headers
X-Token: djksaldjaklsj894ut93
Location: /session/8493248

0 comments on commit 08698db

Please sign in to comment.