Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
284 lines (270 sloc) 7.04 KB
openapi: 3.0.0
info:
description: Mangler end-point
version: 0.0.1-dev
title: Mangler
license:
name: MIT
tags:
- name: url
description: URL Management
- name: analytics
description: URL Analytics
- name: user
description: User Management
paths:
/url:
get:
tags:
- url
summary: Get all URLs for users
description: Returns all urls shortned by users
responses:
'200':
description: Success, URL list
content:
appliation/json:
schema:
type: object
properties:
urls:
type: array
items:
type: object
properties:
id:
type: string
url:
type: string
aliases:
type: array
items:
type: string
post:
tags:
- url
summary: Add new URL
description: Add new URL with initial aliases
requestBody:
description: Long URL
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewUrl'
responses:
'201':
description: Success Created
content:
application/json:
schema:
type: object
properties:
id:
type: "string"
description: "Core ID"
url:
type: "string"
description: "Long URL"
aliases:
type: "array"
description: "Successful aliases added"
items:
type: string
'401':
description: URL exists and is registered to current user
content:
application/json:
schema:
$ref: "#/components/schemas/ApiError"
/url/{url-id}:
get:
summary: Return URL info
description: Return URL info by url-id
tags:
- url
parameters:
- $ref: '#/components/parameters/UrlId'
responses:
'200':
description: Return url info
content:
application/json:
schema:
type: object
properties:
id:
type: string
description: Url Primary ID
url:
type: string
description: Long URL
aliases:
type: array
description: URL Alises
items:
type: string
created:
type: string
format: datetime
'404':
description: URL or Alias does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
delete:
summary: Remove URL
description: Remove URL by url-id
tags:
- url
parameters:
- $ref: '#/components/parameters/UrlId'
responses:
'204':
description: "Removed successfully"
'404':
description: URL or Alias does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'/{url-id}/alias':
get:
summary: Return aliases for URL
description: Resturns all aliases for given URL from url-id
tags:
- url
parameters:
- $ref: '#/components/parameters/UrlId'
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
id:
type: string
aliases:
type: array
items:
type: string
'404':
description: URL or Alias does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
post:
summary: Add alias to URL
description: Add alias to URL from url-id
tags:
- url
parameters:
- $ref: '#/components/parameters/UrlId'
requestBody:
description: URL Alias
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/NewAlias'
responses:
'200':
description: Ok
content:
application/json:
schema:
type: object
properties:
id:
type: string
aliases:
type: array
items:
type: string
'402':
description: Alias already exists
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'404':
description: URL or Alias does not exist
content:
application/json:
schema:
$ref: '#/components/schemas/ApiError'
'/{url-id}/alias/{alias-id}':
delete:
summary: Return aliases for URL
description: Resturns all aliases for given URL from url-id
tags:
- url
parameters:
- $ref: '#/components/parameters/UrlId'
- $ref: '#/components/parameters/AliasId'
responses:
'200':
description: Ok, Deleted
'403':
description: Cannot remove core Alias/ID
'404':
description: Alias not found
components:
parameters:
UrlId:
name: "url-id"
in: path
required: true
description: URL ID or Alias
schema:
type: "string"
AliasId:
name: "alias-id"
in: path
required: true
description: Alias id
schema:
type: "string"
schemas:
NewUrl:
type: object
properties:
url:
type: string
format: url
description: Long URL
aliases:
type: array
description: Aliases
items:
type: string
xml:
name: NewUrl
NewAlias:
type: object
properties:
alias:
description: Alias value
type: string
xml:
name: NewAlias
ApiError:
type: "object"
properties:
error:
description: Error message
type: string
ApiResponse:
type: object
properties:
result:
type: integer
format: int32
description: Response/Result Code
version:
type: string
description: API Version Hash