Last active
March 6, 2021 07:17
-
-
Save hawell/3ea74b732816044ee7518ad8843a572e to your computer and use it in GitHub Desktop.
oas3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: '3.0.6' | |
info: | |
title: 'messaging panel api' | |
description: 'messaging panel api' | |
version: '1.0' | |
servers: | |
- url: https://postman-pat.indraproject.ir/api/v1/admin/ | |
security: | |
- app_id: [] | |
paths: | |
/campaigns: | |
get: | |
summary: 'get list of campaigns' | |
parameters: | |
- name: page_no | |
in: query | |
description: 'start page' | |
required: true | |
schema: | |
type: integer | |
- name: page_size | |
in: query | |
description: 'number of items in response' | |
required: true | |
schema: | |
type: integer | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/campaigns_list' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
post: | |
summary: 'create a new campaign' | |
requestBody: | |
$ref: '#/components/requestBodies/campaign' | |
responses: | |
201: | |
$ref: '#/components/responses/201' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
/campaigns/{campaign_id}: | |
parameters: | |
- name: campaign_id | |
in: path | |
required: true | |
schema: | |
type: string | |
get: | |
summary: "get campaign data" | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/campaign_response' | |
404: | |
$ref: '#/components/responses/404' | |
500: | |
$ref: '#/components/responses/500' | |
/templates: | |
get: | |
summary: 'get list of templates' | |
parameters: | |
- name: page_no | |
in: query | |
description: 'start page' | |
required: true | |
schema: | |
type: integer | |
- name: page_size | |
in: query | |
description: 'number of items in response' | |
required: true | |
schema: | |
type: integer | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/templates_list' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
post: | |
summary: 'create a new template' | |
requestBody: | |
$ref: '#/components/requestBodies/template' | |
responses: | |
201: | |
$ref: '#/components/responses/201' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
/templates/{template_id}: | |
parameters: | |
- name: template_id | |
in: path | |
required: true | |
schema: | |
type: string | |
get: | |
summary: "get template data" | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/template_response' | |
404: | |
$ref: '#/components/responses/404' | |
500: | |
$ref: '#/components/responses/500' | |
/categories: | |
get: | |
summary: 'get list of categories' | |
parameters: | |
- name: page_no | |
in: query | |
description: 'start page' | |
required: true | |
schema: | |
type: integer | |
- name: page_size | |
in: query | |
description: 'number of items in response' | |
required: true | |
schema: | |
type: integer | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/categories_list' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
post: | |
summary: 'create a new category' | |
requestBody: | |
$ref: '#/components/requestBodies/category' | |
responses: | |
201: | |
$ref: '#/components/responses/201' | |
400: | |
$ref: '#/components/responses/400' | |
500: | |
$ref: '#/components/responses/500' | |
/categories/{category_id}: | |
parameters: | |
- name: category_id | |
in: path | |
required: true | |
schema: | |
type: string | |
get: | |
summary: "get category data" | |
responses: | |
200: | |
description: 'successful response' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/category_response' | |
404: | |
$ref: '#/components/responses/404' | |
500: | |
$ref: '#/components/responses/500' | |
components: | |
securitySchemes: | |
app_id: | |
type: apiKey | |
description: api key to authorize requests | |
name: X-API-KEY | |
in: header | |
requestBodies: | |
campaign: | |
description: 'new campaign' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/campaign_request' | |
template: | |
description: 'new template' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/template_request' | |
category: | |
description: 'new category' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/category_request' | |
responses: | |
201: | |
description: 'created' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/create_response' | |
204: | |
description: 'successful' | |
400: | |
description: 'bad request' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/error_response' | |
404: | |
description: 'not found' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/error_response' | |
500: | |
description: 'internal server error' | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/error_response' | |
schemas: | |
error_response: | |
title: 'bad request' | |
type: object | |
properties: | |
status: | |
type: integer | |
message: | |
type: string | |
example: '{ | |
"status": 400, | |
"message": "invalid query param value: page_no" | |
}' | |
create_response: | |
title: create response | |
type: object | |
properties: | |
status: | |
type: integer | |
created: | |
type: boolean | |
id: | |
type: string | |
campaign_request: | |
title: campaign request | |
type: object | |
properties: | |
name: | |
type: string | |
title: | |
type: string | |
summary: | |
type: string | |
category_id: | |
type: string | |
image: | |
type: string | |
template_id: | |
type: string | |
tags: | |
type: array | |
items: | |
type: string | |
users_list: | |
type: string | |
format: binary | |
user_channel: | |
type: string | |
enum: [none, android, ios, site, all] | |
payload: | |
type: object | |
example: '{ | |
"name": "campaign1", | |
"title": "new campaign 1", | |
"summary": "new campaign summary", | |
"category_id": "special offer", | |
"image": "http://images.com/image1.jpg", | |
"template_id": "template1", | |
"tags": ["immediate","important"], | |
"users_list": ["user1", "user2", "user3"], | |
"user_channel": "none", | |
"payload": {"key1": "value1", "key2": "value2"} | |
}' | |
campaign_response: | |
title: campaign response | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
title: | |
type: string | |
summary: | |
type: string | |
category_id: | |
type: string | |
image: | |
type: string | |
template_id: | |
type: string | |
tags: | |
type: array | |
items: | |
type: string | |
user_channel: | |
type: string | |
enum: [none, android, ios, site, all] | |
example: '{ | |
"id": "1234567abc", | |
"name": "campaign1", | |
"title": "new campaign 1", | |
"summary": "new campaign summary", | |
"category_id": "special offer", | |
"image": "http://images.com/image1.jpg", | |
"template_id": "template1", | |
"tags": ["immediate","important"], | |
"user_channel": "none", | |
}' | |
template_request: | |
type: object | |
properties: | |
name: | |
type: string | |
body: | |
type: string | |
fields: | |
type: array | |
items: | |
type: object | |
properties: | |
name: | |
type: string | |
type: | |
type: string | |
enum: [string, number, boolean] | |
example: '{ | |
"name": "template1", | |
"body": "<html>this is a {{.param}}</html>", | |
"fields": [ | |
{"name": "param", "type": "string"} | |
] | |
}' | |
template_response: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
body: | |
type: string | |
fields: | |
type: array | |
items: | |
type: object | |
properties: | |
name: | |
type: string | |
type: | |
type: string | |
example: '{ | |
"id": "123456789abc", | |
"name": "template1", | |
"body": "this is a string {{.str}}. this is a number {{.num}}", | |
"fields": [{"name": "str", "type": "string"}, {"name": "num", "type": "number"}] | |
}' | |
category_request: | |
type: object | |
properties: | |
name: | |
type: string | |
image: | |
type: string | |
example: '{ | |
"name": "cat1", | |
"image": "https://image.com/image1.jpg" | |
}' | |
category_response: | |
type: object | |
properties: | |
id: | |
type: string | |
name: | |
type: string | |
image: | |
type: string | |
example: '{ | |
"id": "123456789abc", | |
"name": "cat1", | |
"image": "https://image.com/image1.jpg" | |
}' | |
campaigns_list: | |
title: list of campaigns | |
description: same format as cerebro list responses, with /components/schemas/campaign_response as items | |
type: object | |
templates_list: | |
title: list of templates | |
description: same format as cerebro list responses, with /components/schemas/template_response as items | |
type: object | |
categories_list: | |
title: list of categories | |
description: same format as cerebro list responses, with /components/schemas/category_response as items | |
type: object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment