Skip to content

Instantly share code, notes, and snippets.

@cjonagam
Created June 11, 2015 01:37
Show Gist options
  • Save cjonagam/bf282193125869ca844b to your computer and use it in GitHub Desktop.
Save cjonagam/bf282193125869ca844b to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "RAMP Push notifications",
"description": "API for apns/gcm push notifications"
},
"host": "rampdi.corp.equinix.com",
"basePath": "/push",
"schemes": [
"http"
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/tokens": {
"get": {
"description": "Returns all tokens",
"operationId": "getTokens",
"parameters": [
{
"name": "users",
"in": "query",
"description": "filter results with username",
"required": false,
"type": "string"
},
{
"name": "page",
"in": "query",
"description": "filter results with start page",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "orderType",
"in": "query",
"description": "asc or desc order",
"required": false,
"type": "string"
},
{
"name": "orderBy",
"in": "query",
"description": "order by filed name",
"required": false,
"type": "string"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "List all tokens",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/push_registration"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
},
"post": {
"description": "register new device. Duplicates are allowed",
"operationId": "registerDevice",
"produces": [
"application/json"
],
"parameters": [
{
"name": "registration",
"in": "body",
"description": "Register new device",
"required": true,
"schema": {
"$ref": "#/definitions/push_registration"
}
}
],
"responses": {
"200": {
"description": "token response",
"schema": {
"$ref": "#/definitions/push_registration"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
},
"/tokens/{id}": {
"get": {
"description": "Returns a device token info based based on username",
"operationId": "getTokenByUsername",
"parameters": [
{
"name": "id",
"in": "path",
"description": "username of registration to fetch",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "token response",
"schema": {
"$ref": "#/definitions/push_registration"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
},
"delete": {
"description": "deletes a single user token based on userid -> Not impemented yet",
"operationId": "deleteToken",
"parameters": [
{
"name": "id",
"in": "path",
"description": "userid id for whom tokens need to be deleted",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"204": {
"description": "tokens deleted"
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
},
"/messages": {
"get": {
"description": "Returns all messages",
"operationId": "getNotifications",
"parameters": [
{
"name": "users",
"in": "query",
"description": "filter results with username",
"required": false,
"type": "string"
},
{
"name": "page",
"in": "query",
"description": "filter results with start page",
"required": false,
"type": "integer",
"format": "int32"
},
{
"name": "orderType",
"in": "query",
"description": "asc or desc order",
"required": false,
"type": "string"
},
{
"name": "orderBy",
"in": "query",
"description": "order by filed name",
"required": false,
"type": "string"
},
{
"name": "limit",
"in": "query",
"description": "maximum number of results to return",
"required": false,
"type": "integer",
"format": "int32"
}
],
"responses": {
"200": {
"description": "List of messages",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/notification"
}
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
},
"post": {
"description": "register new device. Duplicates are allowed",
"operationId": "addNotification",
"produces": [
"application/json"
],
"parameters": [
{
"name": "registration",
"in": "body",
"description": "Post new message to ramp",
"required": true,
"schema": {
"$ref": "#/definitions/notification"
}
}
],
"responses": {
"200": {
"description": "token response",
"schema": {
"$ref": "#/definitions/notification"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
},
"/messages/{id}": {
"get": {
"description": "Returns a device token based based on username",
"operationId": "getTokenByUsername",
"parameters": [
{
"name": "id",
"in": "path",
"description": "username of registration to fetch",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "notifications response",
"schema": {
"$ref": "#/definitions/notification"
}
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
},
"delete": {
"description": "deletes a single message based on the ID supplied -> Not implemented yet",
"operationId": "deleteNotification",
"parameters": [
{
"name": "id",
"in": "path",
"description": "ID of message to delete",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"204": {
"description": "message deleted"
},
"default": {
"description": "unexpected error",
"schema": {
"$ref": "#/definitions/errorModel"
}
}
}
}
}
},
"definitions": {
"push_registration": {
"required": [
"appId",
"platform",
"userId",
"deviceToken"
],
"properties": {
"appId": {
"type": "string"
},
"platform": {
"type": "string"
},
"userId": {
"type": "string"
},
"deviceToken": {
"type": "string"
},
"lastDeviceToken": {
"type": "string"
}
}
},
"notification": {
"required": [
"appId",
"users",
"message"
],
"properties": {
"appId": {
"type": "string"
},
"users": {
"type": "array",
"items": {
"type": "string"
}
},
"message": {
"type": "object"
}
}
},
"errorModel": {
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment