-
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
42 additions
and
0 deletions.
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,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 |