-
Notifications
You must be signed in to change notification settings - Fork 2
REST APIs
Dzmitry Shylovich edited this page Mar 23, 2015
·
4 revisions
The REST API provide programmatic access to read and write app data. Author a new Idea, read author profile and more. The REST API identifies users using OAuth; responses are available in JSON.
- Users
- POST /api/v1/users: Create new user
- GET /api/v1/users: List all users
- GET /api/v1/users/{userId}: List the user with the specified ID
- DELETE /api/v1/users/{userId}: Delete the user with the specified ID
- PUT /api/v1/users/{userId}: Change parameters of the user with the specified ID
-
GET /api/v1/users/{userId}/ideas: List all ideas for user
userId -
POST /api/v1/users/{userId}/ideas: Create idea for user
userId -
GET /api/v1/users/{userId}/comments: List all comments for user
userId - Tags
- GET /api/v1/tags: List all tags
- GET /api/v1/tags/{tagId}: List the tag with specified ID
-
GET /api/v1/tags/{tagId}/ideas: List all ideas for tag
tagId
Create new user.
| Tables | Are |
|---|---|
| Response formats | JSON |
| Requires authentication? | No |
GET api/v1/users HTTP/1.1
Accept: application/json
Host: localhost:8080HTTP/1.1 201 Created
Content-Type: application/json
Location: http://localhost/api/v1/users/1
{
"id": 1
"username": "Super user",
"email": "test@email.com",
"createdAt": "2015-01-12T00:00Z",
"links": [
{
"rel":"self",
"href":"http://localhost/api/v1/users/1"
}
]
}List user's ideas
| Tables | Are |
|---|---|
| Response formats | JSON |
| Requires authentication? | No |
GET api/v1/users/1/ideas HTTP/1.1
Accept: application/json
Host: localhost:8080[
{
"title":"Bar",
"description":"Lorem ipsum",
"rating":5,
"tags":[
{
"name":"Foo",
"links":[
],
"id":1
}
],
"links":[
{
"rel":"author",
"href":"http://localhost/api/v1/users/1"
},
{
"rel":"self",
"href":"http://localhost/api/v1/ideas/1"
}
],
"id":1,
"createdAt":"2014-02-12T10:00Z",
"lastModifiedAt":"2014-10-05T00:00Z"
}
]List all tags.
| Tables | Are |
|---|---|
| Response formats | JSON |
| Requires authentication? | No |
GET api/v1/tags HTTP/1.1
Accept: application/json
Host: localhost:8080HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id": 1,
"name": "Programming",
"links": [
{
"rel":"self",
"href":"http://localhost/api/v1/tags/1"
}
]
},
{
"id": 2,
"name": "Dota",
"links": [
{
"rel":"self",
"href":"http://localhost/api/v1/tags/2"
}
]
}
]List the tag with specified ID
| Tables | Are |
|---|---|
| Response formats | JSON |
| Requires authentication? | No |
GET api/v1/tags/1 HTTP/1.1
Accept: application/json
Host: localhost:8080HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "Programming",
"links": [
{
"rel": "self",
"href": "http://localhost/api/v1/tags/1"
}
]
}List all ideas for tag tagId
| Tables | Are |
|---|---|
| Response formats | JSON |
| Requires authentication? | No |
GET api/v1/tags/1/ideas HTTP/1.1
Accept: application/json
Host: localhost:8080HTTP/1.1 200 OK
Content-Type: application/json
[
{
"title":"Bar",
"description":"Lorem ipsum",
"rating":5,
"links":[
{
"rel":"author",
"href":"http://localhost/api/v1/users/1"
},
{
"rel":"self",
"href":"http://localhost/api/v1/ideas/1"
}
],
"id":1,
"createdAt":"2014-02-12T10:00Z",
"lastModifiedAt":"2014-10-05T00:00Z"
}
]