Skip to content

Instantly share code, notes, and snippets.

@walkline
Last active September 24, 2015 13:44
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 walkline/6eb28278ac6b29c4f5aa to your computer and use it in GitHub Desktop.
Save walkline/6eb28278ac6b29c4f5aa to your computer and use it in GitHub Desktop.
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "eBags API",
"description": "\n## Authorization\nFor client authentication we will use `ApiAccessToken` which will be in the header of request.\n\nTo receive `ApiAccessToken`, client should make request to one of three endpoints - /members/RegisterResponsive, /members/SignInCustomer or /members/RefreshToken.\n\nAlso `ApiAccessToken` will be used in webview's requests. If site's backend will see `ApiAccessToken` in the header of request, and if client doesn't have cookies, than backend should create cookies using `ApiAccessToken`.\n\n## Steal/Deal of the Day\nWill be implemented by pushing notifications to customer.\n\nPayload for Steal/Deal of the Day should have `\"steal_deal_url\"` parameter.\n\nPayload for iOS device will be like:\n```json\n{\n \"aps\" : {\n ...\n }\n \n \"steal_deal_url\" : \"http://...\"\n}\n```\n## Bag Shazam\nWill be implemented by using api.pcsso.com. If we want to use this API we will need `pcsso-auth-key`. To receive this key, client should make request to `/api/v1/ServiceAccess/pcsso`.\n"
},
"paths": {
"/members/RegisterResponsive": {
"post": {
"description": "Creating new customer.\n",
"parameters": [
{
"name": "FirstName",
"in": "query",
"description": "First name for new user",
"type": "string",
"required": true
},
{
"name": "CustomerEmail",
"in": "query",
"description": "Email for new user",
"type": "string",
"required": true
},
{
"name": "CustomerPassword",
"in": "query",
"description": "Password for new user",
"type": "string",
"required": true
},
{
"name": "ApiCall",
"in": "query",
"description": "For our app value will be always true.",
"type": "boolean",
"required": true
},
{
"name": "DeviceType",
"in": "query",
"description": "Type of users device.<br>\n0 - iOS device;<br>\n1 - android device.\n",
"type": "integer",
"required": true
},
{
"name": "DeviceToken",
"in": "query",
"description": "Device token for pushing messages to device.",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/AuthorizationResponse"
}
},
"400": {
"description": "Bad request or email already in use."
}
}
}
},
"/members/SignInCustomer": {
"post": {
"description": "Sign in with email and password .\n",
"parameters": [
{
"name": "CustomerEmail",
"in": "query",
"description": "Customer's email",
"type": "string",
"required": true
},
{
"name": "CustomerPassword",
"in": "query",
"description": "Customer's password",
"type": "string",
"required": true
},
{
"name": "ApiCall",
"in": "query",
"description": "For our app value will be always true.",
"type": "boolean",
"required": true
},
{
"name": "DeviceType",
"in": "query",
"description": "Type of users device.<br>\n0 - iOS device;<br>\n1 - android device.\n",
"type": "number",
"required": true
},
{
"name": "DeviceToken",
"in": "query",
"description": "Device token for pushing messages to device.",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/AuthorizationResponse"
}
},
"400": {
"description": "Bad request."
},
"403": {
"description": "Wrong password or email."
}
}
}
},
"/members/RefreshToken": {
"post": {
"description": "Used for generating new access token if old one expired.\n",
"parameters": [
{
"name": "ApiRefreshToken",
"in": "query",
"description": "Refresh token that was received in AuthorizationResponse.",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/AuthorizationResponse"
}
},
"400": {
"description": "Bad request."
},
"403": {
"description": "Wrong token."
}
}
}
},
"/api/v1/ServiceAccess/pcsso": {
"get": {
"description": "Used for getting `pcsso-auth-key`, which is used in `api.pcsso.com`.\n",
"parameters": [
{
"name": "ApiAccessToken",
"in": "header",
"description": "Header with API token.",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/ServiceAccess"
}
},
"400": {
"description": "Bad request."
}
}
}
},
"/api/v1/Rewards": {
"get": {
"description": "Getting data about rewards for customer.\n",
"parameters": [
{
"name": "ApiAccessToken",
"in": "header",
"description": "Header with API token.",
"type": "string",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Rewards"
}
},
"400": {
"description": "Bad request."
}
}
}
}
},
"definitions": {
"AuthorizationResponse": {
"type": "object",
"properties": {
"customer": {
"$ref": "#/definitions/Customer"
},
"api_access_token": {
"type": "string"
},
"api_token_expiration_time": {
"type": "integer",
"format": "int64",
"description": "Token expiration time in unix timestamp format. If value equal to 0, than token will not expire."
},
"api_refresh_token": {
"type": "string",
"description": "Token for receiving a new api_access_token."
}
}
},
"Customer": {
"type": "object",
"properties": {
"first_name": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"ServiceAccess": {
"type": "object",
"properties": {
"service_name": {
"type": "string",
"description": "In our case it will be \"pcsso\"."
},
"auth_parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/ServiceAuthParameters"
}
}
}
},
"ServiceAuthParameters": {
"type": "object",
"properties": {
"parameter_name": {
"type": "string",
"description": "In our case it will be \"pcsso-auth-key\"."
},
"parameter_value": {
"type": "string",
"description": "Here will be pcsso's API key."
}
}
},
"Rewards": {
"type": "object",
"properties": {
"points_available_to_redeem": {
"type": "string",
"description": "Total points available to redeem."
},
"points_pending": {
"type": "string",
"description": "Total points pending."
},
"points_since_account_was_opened": {
"type": "string",
"description": "Total points earned since account was opened."
},
"points_redeemed_since_account_was_opened": {
"type": "string",
"description": "Total points redeemed since account was opened."
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment