Skip to content
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.

Resource Information
Tables Are
Response formats JSON
Requires authentication? No
Example Request
GET api/v1/users HTTP/1.1
Accept: application/json
Host: localhost:8080
Example Result
HTTP/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"
        }
    ]
}

GET /api/v1/users

GET /api/v1/users/{userId}/ideas

List user's ideas

Resource Information
Tables Are
Response formats JSON
Requires authentication? No
Example Request
GET api/v1/users/1/ideas HTTP/1.1
Accept: application/json
Host: localhost:8080
Example Result
[  
    {  
        "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"
    }
]

Tags

GET /api/v1/tags

List all tags.

Resource Information
Tables Are
Response formats JSON
Requires authentication? No
Example Request
GET api/v1/tags HTTP/1.1
Accept: application/json
Host: localhost:8080
Example Result
HTTP/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"
             }
        ]
    }
]

GET /api/v1/tags/{tagId}

List the tag with specified ID

Resource Information
Tables Are
Response formats JSON
Requires authentication? No
Example Request
GET api/v1/tags/1 HTTP/1.1
Accept: application/json
Host: localhost:8080
Example Result
HTTP/1.1 200 OK
Content-Type: application/json
{  
    "id": 1,
    "name": "Programming",
    "links": [  
        {  
            "rel": "self",
            "href": "http://localhost/api/v1/tags/1"
        }
    ]
}

GET /api/v1/tags/{tagId}/ideas

List all ideas for tag tagId

Resource Information
Tables Are
Response formats JSON
Requires authentication? No
Example Request
GET api/v1/tags/1/ideas HTTP/1.1
Accept: application/json
Host: localhost:8080
Example Result
HTTP/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"
    }
]