From 558e92f2af6e78039bf7f00df1f641f3153fb1a2 Mon Sep 17 00:00:00 2001 From: Evert Prants Date: Tue, 16 Apr 2019 20:21:39 +0300 Subject: [PATCH] Basic API doc, add discord logo back, add icynet git logo --- API.md | 120 +++++++++++++++++++++++++++ static/image/discord.svg | 1 + static/image/icynet-icon-git.svg | 134 +++++++++++++++++++++++++++++++ 3 files changed, 255 insertions(+) create mode 100644 API.md create mode 100644 static/image/discord.svg create mode 100644 static/image/icynet-icon-git.svg diff --git a/API.md b/API.md new file mode 100644 index 0000000..306d8fa --- /dev/null +++ b/API.md @@ -0,0 +1,120 @@ +# IcyNet.eu API Documentation + +## `/oauth2` +OAuth 2.0 Authorization endpoints + +### `GET /authorize` **+session** +OAuth 2.0 Authorization dialog. + +The following query parameters are expected: +* `redirect_uri` - Client redirection URI, must match the redirection URI defined by client. +* `client_id` - Client redirection ID. +* `response_type` - Response type. Pretty much always `code`. +* `scope` *(optional)* - Request additional resources. Available scopes are: `privilege`, `email`, `image`. +* `state` *(optional)* - A forwarded token to prevent request forgery. + +### `POST /token` +Get an Access Token from `code`. + +The following must be passed in the request body: +* `grant_type` - One of `authorization_code`, `client_credentials` or `refresh_token`. +* `scope` *(optional)* - See `/authorize`. + +Successful response: +``` +{ + token_type: 'bearer', + access_token: , + [refresh_token: ,] + expires_in: +} +``` + +A `Authorization: Basic base64(client_id:client_secret)` header must be present **OR** `client_id` and `client_secret` can also be passed in the request body. Both variants are supported by the API. + +### `POST /introspect` +Check for the validity of an Access Token. + +The following must be passed in the request body: +* `token` - The Access Token to introspect. + +Successful response: +``` +{ + token_type: 'bearer', + token: , + expires_in: +} +``` + +Requires client authentication, see `POST /token`. + +### `GET /user` +Get user information using an access token. Access token can be provided via querystring or header. + +Successful response: +``` +{ + id: , + uuid: , + username: , + display_name: , + [email: ] (requires email scope), + [image: ] (requires image scope), + [privilege: ] (requires privilege scope) +} +``` + +## `/api` +Internal API endpoints. + +### `/external` +Authentication callbacks. + +### `GET /news` +Icy Network News. + +#### `GET /news/:id` +Get a news article by it's ID. + +#### `POST /news/edit/:id` **+session** +Edit a news article by it's ID. **Requires a special privileged user** + +#### `GET /news/all/:page` +Get all news articles on `:page`. + +### `POST /avatar` **+session** +Change the avatar of the currently logged in user. + +#### `POST /remove` **+session** +Remove the avatar of the currently logged in user. + +#### `POST /gravatar` **+session** +Set the avatar of the currently logged in user to their Gravatar avatar. + +### `GET /avatar` **+session** +Get the avatar of the currently logged in user. + +#### `GET /gravatar` **+session** +Get the Gravatar avatar of the currently logged in user, if applicable. + +#### `GET /:id` +Get the avatar of the user with ID `:id`. + +### `/oauth2` +Special OAuth 2.0 management endpoints. + +#### `GET /authorized-clients` **+session** +Get the authorized OAuth 2.0 clients of the currently logged in user. + +##### `POST /revoke` **+session** +Revoke an authorized OAuth 2.0 client. Requires `client_id` in the body. + +### `GET /donations` +List the donations given to Icy Network. + +#### `GET /user` **+session** +List the donations given to Icy Network by the currently logged in user. + +### `POST /paypal/ipn` +PayPal Payment Notification endpoint. diff --git a/static/image/discord.svg b/static/image/discord.svg new file mode 100644 index 0000000..4613aa9 --- /dev/null +++ b/static/image/discord.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/image/icynet-icon-git.svg b/static/image/icynet-icon-git.svg new file mode 100644 index 0000000..86b8a2c --- /dev/null +++ b/static/image/icynet-icon-git.svg @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + +