account-rest-api

RESTful API-blueprint for all things user accounts


Keywords
apiary, api, blueprint
License
ISC
Install
npm install account-rest-api@1.1.0

Documentation

account-json-api

RESTful JSON API-blueprint for all things user accounts

NPM version Build Status

This is a JSON API v1.0 compliant specification for a generic REST API for all things user accounts.

Summary

PUT    /session
GET    /session
DELETE /session
PUT    /session/account
GET    /session/account
PATCH  /session/account
DELETE /session/account
GET    /session/account/profile
PATCH  /session/account/profile

# Password resets, upgrades, etc.
GET    /requests
POST   /requests
GET    /requests/{id}
DELETE /requests/{id}

# Admin only
POST   /accounts
GET    /accounts
GET    /accounts/{id}
PATCH  /accounts/{id}
DELETE /accounts/{id}
GET    /accounts/{id}/profile
PATCH  /accounts/{id}/profile
POST   /accounts/{id}/sessions

Find the full spec at http://docs.accountjsonapi.apiary.io

Example

Request

PUT /session
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
{
    "data": {
        "type": "session",
        "attributes": {
            "username": "john-doe",
            "password": "secret"
        }
    }
}

Response

{
    "links": {
        "self": "https://example.com/session"
    },
    "data": {
        "id": "sessionid123",
        "type": "session",
        "relationships": {
            "account": {
                "links": {
                    "related": "https://example.com/session/account"
                },
                "data": {
                    "id": "abc1234",
                    "type": "account"
                }
            }
        }
    },
    "included": [{
        "id": "abc1234",
        "type": "account",
        "attributes": {
            "username": "jane-doe"
        },
        "relationships": {
            "profile": {
                "links": {
                    "related": "https://example.com/session/account/profile"
                },
                "data": {
                    "id": "abc1234-profile",
                    "type": "accountProfile"
                }
            }
        }
    }]
}

Implementations

The account-json-api is currently being implemented by Hoodie in the hoodie-server-account module.

License

MIT