Skip to content

Instantly share code, notes, and snippets.

@drushman
Last active August 16, 2018 07:33
Show Gist options
  • Save drushman/8b8ad505720f269664635286780edb62 to your computer and use it in GitHub Desktop.
Save drushman/8b8ad505720f269664635286780edb62 to your computer and use it in GitHub Desktop.
swagger: "2.0"
info:
description: ""
version: "1.0.0"
title: "Policy API"
host: "api.go1.co"
basePath: "/policy"
tags:
- name: "Policy Item"
description: "Policy API"
schemes:
- "https"
paths:
/{portalId}:
post:
tags:
- "Policy Item"
summary: "Add a new Policy Item"
description: ""
operationId: "addPolicyItem"
produces:
- "application/json"
parameters:
- name: "portalId"
in: "query"
type: "integer"
required: true
- in: "body"
name: "properties"
description: "Policy item properties"
required: true
schema:
$ref: "#/definitions/PolicyItem"
responses:
200:
description: "The policy item successfully created."
schema:
type: "object"
properties:
id:
type: "string"
400:
description: "Invalid input"
403:
description: "Access denied"
/item/{policyItemId}:
delete:
tags:
- "Policy Item"
summary: "Delete a policy item"
description: ""
operationId: "deletePolicyItem"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "policyItemId"
in: "query"
type: "string"
required: true
responses:
204:
description: "Ok"
403:
description: "Access denied"
404:
description: "Not found"
500:
description: "Internal error"
put:
tags:
- "Policy Item"
summary: "Update a policy item"
description: ""
operationId: "updatePolicyItem"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "policyItemId"
in: "query"
type: "string"
required: true
- in: "body"
name: "properties"
description: "Policy item properties"
required: true
schema:
type: "object"
properties:
type:
type: "string"
responses:
204:
description: "Ok"
403:
description: "Access denied"
404:
description: "Not found"
500:
description: "Internal error"
/{portalId}/{hostEntityType}/{hostEntityId}:
get:
tags:
- "Policy Item"
summary: "Get by host entity"
description: ""
operationId: "getPolicyItemByHost"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "portalId"
in: "query"
type: "integer"
required: true
- name: "hostEntityType"
in: "query"
type: "string"
required: true
- name: "hostEntityId"
in: "query"
type: "string"
required: true
responses:
200:
schema:
type: "array"
items:
type: "object"
properties:
id:
type: "integer"
type:
type: "integer"
entity:
type: "object"
properties:
id:
type: "integer"
type:
type: "string"
title:
type: "string"
403:
description: "Access denied"
404:
description: "Host entity not found"
500:
description: "Internal error"
put:
tags:
- "Policy Item"
summary: "Put items by host entity"
description: ""
operationId: "putPolicyItemByHost"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "portalId"
in: "query"
type: "integer"
required: true
- name: "hostEntityType"
in: "query"
type: "string"
required: true
- name: "hostEntityId"
in: "query"
type: "string"
required: true
- in: "body"
name: "properties"
description: "Policy item properties"
required: true
schema:
type: "array"
items:
$ref: "#/definitions/PutMultipleItemStructure"
responses:
200:
schema:
type: "array"
items:
type: "object"
properties:
id:
type: "integer"
type:
type: "integer"
entity:
type: "object"
properties:
id:
type: "integer"
type:
type: "string"
title:
type: "string"
403:
description: "Access denied"
404:
description: "Host entity not found"
500:
description: "Internal error"
/{portalId}/{hostEntityType}/{hostEntityId}/conflict:
get:
tags:
- "Policy Item"
summary: "Policy conflict dectect"
description: ""
operationId: "detectPolicyConflict"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "portalId"
in: "query"
type: "integer"
required: true
- name: "hostEntityType"
in: "query"
type: "string"
required: true
- name: "hostEntityId"
in: "query"
type: "string"
required: true
responses:
200:
schema:
type: "array"
items:
type: object
additionalProperties:
type: string
example:
3aertp0-loPolicyItemId:
- 34: "Video Tube can not be accessed by user foo@mail.com"
- 35: "Quiz first can not be accessed by portal example.go1.co"
403:
description: "Access denied"
404:
description: "Host entity not found"
500:
description: "Internal error"
/{portalNameOrId}/{keyword}:
get:
tags:
- "Policy Item"
summary: "Search policy item"
description: "Returns a list accounts"
operationId: "searchPolicyItem"
produces:
- "application/json"
parameters:
- name: "portalNameOrId"
in: "path"
description: "Portal ID or Portal name"
required: true
- name: "keyword"
in: "path"
description: "Keyword"
required: true
responses:
200:
schema:
type: "array"
items:
type: "object"
properties:
id:
type: "integer"
type:
type: "integer"
mail:
type: "string"
first_name:
type: "string"
last_name:
type: "string"
403:
description: "Missing or invalid JWT"
404:
description: "Portal not found"
400:
description: "Paramater invalid format"
securityDefinitions:
api_key:
type: "apiKey"
name: "api_key"
in: "header"
definitions:
PolicyItem:
type: "object"
properties:
id:
type: "string"
type:
type: "integer"
host_entity_type:
type: "string"
enum:
- "lo"
- "group"
- "award"
host_entity_id:
type: "integer"
entity_type:
type: "string"
enum:
- "user"
- "portal"
- "group"
entity_ids:
type: "array"
items:
type: "integer"
created:
type: "integer"
updated:
type: "integer"
PutMultipleItemStructure:
type: "object"
properties:
type:
type: "integer"
entity_type:
type: "string"
enum:
- "user"
- "portal"
- "group"
entity_ids:
type: "array"
items:
type: "integer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment