Skip to content

Instantly share code, notes, and snippets.

@maikokuppe
Last active August 7, 2017 13:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maikokuppe/c59cd93b607bf521a5244fd5eb75bfed to your computer and use it in GitHub Desktop.
Save maikokuppe/c59cd93b607bf521a5244fd5eb75bfed to your computer and use it in GitHub Desktop.
api-james.json
{
"swagger": "2.0",
"info": {
"title": "Generic James24 API",
"description": "A collection of the APIs of all microservices being used and maintained by James24",
"version": "0.0.1"
},
"host": "james24apis.com",
"schemes": [
"https"
],
"basePath": "/",
"produces": [
"application/json"
],
"securityDefinitions": {
"UserSecurity": {
"type": "apiKey",
"in": "header",
"name": "Authorization"
}
},
"security": [
{
"UserSecurity": []
}
],
"definitions": {
"OAuthResponse": {
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "Token needed for identifying and authorizing the user.",
"example": "mHnSl4TJDxlopIueKkI3hJHjX8Gpe83eG7y94gNpkNqfMvl4kkLy5BZbUutuwHWI"
}
}
},
"UserAccount": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "Unique identifier representing a user.",
"example": "9136ecc772496c987828ebea9823d0ba09445d619e6c5c8ddba60880350c5bb8"
},
"accountId": {
"type": "string",
"description": "Provider-specific account identifier.",
"example": "100424951926780795838"
},
"provider": {
"type": "string",
"description": "Provider identifier.",
"example": "google"
},
"account": {
"type": "object",
"description": "Actual content of the user account.",
"properties": {
"profile": {
"type": "object",
"description": "Raw provider-specific profile object."
},
"firstName": {
"type": "string",
"description": "First name of the user.",
"example": "John"
},
"lastName": {
"type": "string",
"description": "Last name of the user.",
"example": "Wick"
},
"email": {
"type": "string",
"description": "Email address of the user",
"example": "john.wick@gmail.com"
},
"picture": {
"type": "string",
"description": "Image URL of the user.",
"example": "https://api.adorable.io/avatars/160/example.png"
}
}
}
}
},
"UserPreferences": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "Unique identifier representing a user.",
"example": "9136ecc772496c987828ebea9823d0ba09445d619e6c5c8ddba60880350c5bb8"
},
"venture": {
"type": "string",
"description": "Venture identifier.",
"example": "default"
},
"data": {
"$ref": "#/definitions/UserPreferencesData"
}
}
},
"UserPreferencesData": {
"type": "object",
"properties": {
"color": {
"type": "string",
"description": "User's favorite color.",
"example": "black"
}
}
},
"UserProfile": {
"type": "object",
"properties": {
"userId": {
"type": "string",
"description": "Unique identifier representing a user.",
"example": "9136ecc772496c987828ebea9823d0ba09445d619e6c5c8ddba60880350c5bb8"
},
"venture": {
"type": "string",
"description": "Venture identifier.",
"example": "default"
},
"data": {
"$ref": "#/definitions/UserProfileData"
}
}
},
"UserProfileData": {
"type": "object",
"properties": {
"age": {
"type": "number",
"description": "User's age.",
"example": 42
}
}
},
"Providers": {
"type": "string",
"enum": [
"google",
"facebook"
]
},
"Ventures": {
"type": "string",
"enum": [
"default",
"jobs"
]
},
"User": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string",
"example": "lukeskywalker"
},
"token": {
"type": "string",
"example": "z99sZsPvSlXEkyBJk9q1wdCb935FHlVA9e76obJ4u4LFHgJ5bTqdZTRMa4KRleNm"
}
}
},
"Error400": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"example": 400
},
"message": {
"type": "string",
"example": "Request body is not valid JSON."
}
}
},
"Error404": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"example": 404
},
"message": {
"type": "string",
"example": "Resource does not exist"
}
}
},
"Error409": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"example": 409
},
"message": {
"type": "string",
"example": "Resource already exists"
}
}
},
"Error422": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"example": 422
},
"message": {
"type": "string",
"example": "Resource validation failed"
}
}
},
"Error500": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"example": 500
},
"message": {
"type": "string",
"example": "Internal Server Error"
}
}
}
},
"paths": {
"/users/v1": {
"post": {
"security": [],
"summary": "Create user",
"description": "Create a user.",
"parameters": [
{
"name": "User",
"in": "body",
"description": "Object containing the User ID to create.",
"required": true,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"tags": [
"Users"
],
"responses": {
"201": {
"description": "Created.",
"schema": {
"$ref": "#/definitions/User"
}
},
"400": {
"description": "Malformed request body.",
"schema": {
"$ref": "#/definitions/Error400"
}
},
"409": {
"description": "Already exists.",
"schema": {
"$ref": "#/definitions/Error409"
}
},
"422": {
"description": "Validation error.",
"schema": {
"$ref": "#/definitions/Error422"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/users/v1/me": {
"delete": {
"summary": "Delete current user",
"description": "Delete the currently authenticated user including all of its UserAccounts, UserPreferences and UserProfiles.",
"tags": [
"Users"
],
"responses": {
"204": {
"description": "Deleted."
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/oauth/v1/signin/{provider}": {
"get": {
"security": [],
"summary": "OAuth signin endpoint",
"description": "Wrapper for the provider-specific proprietary OAuth signin endpoint. This endpoint can be used to implement the OAuth flow into a mobile or web app.",
"parameters": [
{
"name": "provider",
"in": "path",
"description": "Identifier for the UserAccount provider.",
"required": true,
"type": "string",
"enum": [
"google",
"facebook"
]
}
],
"tags": [
"OAuth"
],
"responses": {
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/oauth/v1/callback/{provider}": {
"get": {
"security": [],
"summary": "OAuth callback endpoint",
"description": "Wrapper for the provider-specific proprietary OAuth callback endpoint. This endpoint can be used to implement the OAuth flow into a mobile or web app.",
"parameters": [
{
"name": "provider",
"in": "path",
"description": "Identifier for the UserAccount provider.",
"required": true,
"type": "string",
"enum": [
"google",
"facebook"
]
}
],
"tags": [
"OAuth"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"$ref": "#/definitions/OAuthResponse"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-accounts/v1/me": {
"get": {
"summary": "Get all my UserAccounts",
"description": "Returns all provider-specific UserAccounts belonging to the authenticated user. This can be used to list a user's connected accounts.",
"tags": [
"UserAccounts"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/UserAccount"
}
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"delete": {
"summary": "Delete all my UserAccounts",
"description": "Returns all provider-specific UserAccounts belonging to the authenticated user. This can be used to list a user's connected accounts.",
"tags": [
"UserAccounts"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/UserAccount"
}
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-accounts/v1/me/{provider}": {
"get": {
"summary": "Get UserAccount",
"description": "Returns the authenticated user's provider-specific UserAccount, e.g. her `google` or `facebook` UserAccount.",
"parameters": [
{
"name": "provider",
"in": "path",
"description": "Identifier for the UserAccount provider.",
"required": true,
"type": "string",
"enum": [
"google",
"facebook"
]
}
],
"tags": [
"UserAccounts"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"$ref": "#/definitions/UserAccount"
}
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"delete": {
"summary": "Delete UserAccount",
"description": "Delete the authenticated user's provider-specific UserAccount, e.g. her `google` or `facebook` UserAccount.",
"parameters": [
{
"name": "provider",
"in": "path",
"description": "Identifier for the UserAccount provider.",
"required": true,
"type": "string",
"enum": [
"google",
"facebook"
]
}
],
"tags": [
"UserAccounts"
],
"responses": {
"204": {
"description": "Deleted."
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-preferences/v1/me": {
"get": {
"summary": "Get all my UserPreferences",
"description": "Returns all provider-specific UserPreferences belonging to the authenticated user. This can be used to list a user's connected preferences.",
"tags": [
"UserPreferences"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/UserPreferences"
}
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-preferences/v1/me/{venture}": {
"get": {
"summary": "Get UserPreferences",
"description": "Returns the authenticated user's venture-specific UserPreferences, e.g. her `default` or `jobs` preferences.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserPreferences venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
}
],
"tags": [
"UserPreferences"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"$ref": "#/definitions/UserPreferences"
}
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"post": {
"summary": "Create UserPreferences",
"description": "Create the authenticated user's venture-specific UserPreferences, e.g. her `default` or `jobs` preferences.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserPreferences venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
},
{
"name": "UserPreferences",
"in": "body",
"description": "UserPreferences to create.",
"required": true,
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/UserPreferencesData"
}
}
}
}
],
"tags": [
"UserPreferences"
],
"responses": {
"200": {
"description": "Created.",
"schema": {
"$ref": "#/definitions/UserPreferences"
}
},
"409": {
"description": "Already exists.",
"schema": {
"$ref": "#/definitions/Error409"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"put": {
"summary": "Update UserPreferences",
"description": "Update the authenticated user's venture-specific UserPreferences, e.g. her `default` or `jobs` preferences.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserPreferences venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
},
{
"name": "UserPreferences",
"in": "body",
"description": "UserPreferences to save.",
"required": true,
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/UserPreferencesData"
}
}
}
}
],
"tags": [
"UserPreferences"
],
"responses": {
"200": {
"description": "Updated.",
"schema": {
"$ref": "#/definitions/UserPreferences"
}
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"delete": {
"summary": "Delete UserPreferences",
"description": "Delete the authenticated user's venture-specific UserPreferences, e.g. her `default` or `jobs` UserPreferences.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserPreferences venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
}
],
"tags": [
"UserPreferences"
],
"responses": {
"204": {
"description": "Deleted."
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-profiles/v1/me": {
"get": {
"summary": "Get all my UserProfiles",
"description": "Returns all provider-specific UserProfiles belonging to the authenticated user. This can be used to list a user's connected profile.",
"tags": [
"UserProfiles"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/UserProfile"
}
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
},
"/user-profiles/v1/me/{venture}": {
"get": {
"summary": "Get UserProfile",
"description": "Returns the authenticated user's venture-specific UserProfile, e.g. her `default` or `jobs` UserProfile.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserProfiles venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
}
],
"tags": [
"UserProfiles"
],
"responses": {
"200": {
"description": "Ok.",
"schema": {
"$ref": "#/definitions/UserProfile"
}
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"post": {
"summary": "Create UserProfile",
"description": "Create the authenticated user's venture-specific UserProfile, e.g. her `default` or `jobs` UserProfile.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserProfiles venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
},
{
"name": "UserProfile",
"in": "body",
"description": "UserProfile to create.",
"required": true,
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/UserProfileData"
}
}
}
}
],
"tags": [
"UserProfiles"
],
"responses": {
"200": {
"description": "Created.",
"schema": {
"$ref": "#/definitions/UserProfile"
}
},
"409": {
"description": "Already exists.",
"schema": {
"$ref": "#/definitions/Error409"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"put": {
"summary": "Update UserProfile",
"description": "Update the authenticated user's venture-specific UserProfile, e.g. her `default` or `jobs` UserProfile.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserProfiles venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
},
{
"name": "UserProfile",
"in": "body",
"description": "UserProfile to save.",
"required": true,
"schema": {
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/UserProfileData"
}
}
}
}
],
"tags": [
"UserProfiles"
],
"responses": {
"200": {
"description": "Updated.",
"schema": {
"$ref": "#/definitions/UserProfile"
}
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
},
"delete": {
"summary": "Delete UserProfile",
"description": "Delete the authenticated user's venture-specific UserProfile, e.g. her `default` or `jobs` UserProfile.",
"parameters": [
{
"name": "venture",
"in": "path",
"description": "Identifier for the UserProfile venture.",
"required": true,
"type": "string",
"enum": [
"default",
"jobs"
]
}
],
"tags": [
"UserProfiles"
],
"responses": {
"204": {
"description": "Deleted."
},
"404": {
"description": "Not found.",
"schema": {
"$ref": "#/definitions/Error404"
}
},
"default": {
"description": "Unexpected error.",
"schema": {
"$ref": "#/definitions/Error500"
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment