From ff392a5181d3e4daac5d8a426f7f92c789b0bbfc Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Sat, 19 Dec 2015 12:35:09 -0800 Subject: [PATCH] Initial swagger doc for hackazon. --- web/swagger.json | 1085 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1085 insertions(+) create mode 100644 web/swagger.json diff --git a/web/swagger.json b/web/swagger.json new file mode 100644 index 00000000..06541f8b --- /dev/null +++ b/web/swagger.json @@ -0,0 +1,1085 @@ +{ + "swagger":"2.0", + "info":{ + "version":"1.0.0", + "title":"Hackazon Mobile API", + "description":"#### Shopping API for Hackazon mobile app.\n" + }, + "schemes":[ + "http" + ], + "securityDefinitions":{ + "basicAuth":{ + "type":"basic", + "description":"HTTP Basic Authentication." + }, + "apiKey":{ + "name":"Authorization", + "type":"apiKey", + "in":"header", + "description":"API Key" + } + }, + "consumes":[ + "application/json" + ], + "produces":[ + "application/json" + ], + "host":"hackazon.webscantest.com", + "basePath":"/", + "paths":{ + "/api/auth":{ + "get":{ + "security":[ + { + "basicAuth":[ + + ] + } + ], + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/AuthResponse" + } + } + } + }, + "description":"Authentication requests" + } + }, + "/api/category":{ + "get":{ + "security":[ + { + "apiKey":[ + + ] + } + ], + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/GenericResponse" + } + } + } + }, + "description":"Get lists of products by category", + "parameters":[ + { + "name":"Authorization", + "required":false, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"page", + "required":false, + "in":"query", + "description":"Current page of results. Default is 1", + "type":"integer" + }, + { + "name":"per_page", + "required":false, + "in":"query", + "description":"Number to show per page of results", + "type":"integer" + } + ] + } + }, + "/api/product":{ + "get":{ + "security":[ + { + "apiKey":[ + + ] + } + ], + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/GenericResponse" + } + } + } + }, + "description":"Get lists of products by category", + "parameters":[ + { + "name":"Authorization", + "required":false, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"page", + "required":false, + "in":"query", + "description":"Current page of results. Default is 1", + "type":"integer" + }, + { + "name":"categoryID", + "required":false, + "in":"query", + "description":"Category ID", + "type":"integer" + } + ] + } + }, + "/api/product/{product_id}":{ + "get":{ + "security":[ + { + "apiKey":[ + + ] + } + ], + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/ProductResponse" + } + } + }, + "description":"Get a product from it's ID", + "parameters":[ + { + "name":"Authorization", + "required":false, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "in":"path", + "name":"product_id", + "description":"ID of product that needs to be fetched", + "required":true, + "type":"integer", + "format":"int64" + }, + { + "name":"categoryID", + "required":false, + "in":"query", + "description":"Category ID", + "type":"integer" + } + ] + } + }, + "/api/cart/cartItems":{ + "post":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/Cart" + } + } + }, + "description":"Adds an item to the cart", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"uid", + "required":false, + "in":"query", + "description":"Session based web application scanning with tweaks.", + "type":"string" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/Cart" + } + } + ] + } + }, + "/api/customerAddress":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/GenericResponse" + } + } + } + }, + "description":"Get lists of products by category", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"page", + "required":false, + "in":"query", + "description":"Current page of results. Default is 1", + "type":"integer" + }, + { + "name":"per_page", + "required":false, + "in":"query", + "description":"Number to show per page of results", + "type":"integer" + } + ] + }, + "post":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/CustomerAddress" + } + } + } + }, + "description":"Adds a new customer address", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/CustomerAddress" + } + } + ] + } + }, + "/api/cart/my":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/CartResponse" + } + } + } + }, + "description":"Get lists of products by category", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"uid", + "required":false, + "in":"query", + "description":"Session based web application scanning with tweaks.", + "type":"string" + } + ] + } + }, + "/api/cart/{cart_id}":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/CartResponse" + } + } + }, + "description":"Get Cart by ID", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"cart_id", + "required":true, + "in":"path", + "description":"cart id that is being updated", + "type":"string" + } + ] + }, + "put":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/CartResponse" + } + } + }, + "description":"Update Cart by ID", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"cart_id", + "required":true, + "in":"path", + "description":"cart id that is being updated", + "type":"string" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/CartResponse" + } + } + ] + }, + "delete":{ + "responses":{ + "200":{ + "description":"Response will be in JSON" + } + }, + "description":"Get lists of products by category", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"cart_id", + "required":true, + "in":"path", + "description":"cart id that is being updated", + "type":"string" + } + ] + } + }, + "/api/order":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/Order" + } + } + } + }, + "description":"Gets all orders.", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"page", + "required":false, + "in":"query", + "description":"Current page of results. Default is 1", + "type":"integer" + }, + { + "name":"per_page", + "required":false, + "in":"query", + "description":"Number to show per page of results", + "type":"integer" + } + ] + }, + "post":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/Order" + } + } + }, + "description":"Creates an order", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/Order" + } + } + ] + } + }, + "/api/order/{order_id}":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/Order" + } + } + }, + "description":"Gets an order by ID.", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"page", + "required":false, + "in":"query", + "description":"Current page of results. Default is 1", + "type":"integer" + }, + { + "name":"per_page", + "required":false, + "in":"query", + "description":"Number to show per page of results", + "type":"integer" + }, + { + "name":"order_id", + "in":"path", + "required":true, + "type":"integer" + } + ] + } + }, + "/api/orderAddresses":{ + "post":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/OrderAddress" + } + } + }, + "description":"Creates an order", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/OrderAddress" + } + } + ] + } + }, + "/api/orderItems":{ + "post":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "$ref":"#/definitions/OrderItem" + } + } + }, + "description":"Adds an item to an order", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + }, + { + "name":"body", + "in":"body", + "required":true, + "schema":{ + "$ref":"#/definitions/OrderItem" + } + } + ] + } + }, + "/api/user/me":{ + "get":{ + "responses":{ + "200":{ + "description":"Response will be in JSON", + "schema":{ + "type":"array", + "items":{ + "$ref":"#/definitions/UserProfileData" + } + } + } + }, + "description":"Get current users profile data", + "parameters":[ + { + "name":"Authorization", + "required":true, + "in":"header", + "description":"In the form of: Token kjs879sad78f9sd87f", + "type":"string", + "pattern":"Token \\w+" + } + ] + } + } + }, + "definitions":{ + "AuthResponse":{ + "type":"object", + "properties":{ + "message":{ + "type":"string", + "description":"Status message" + }, + "code":{ + "type":"integer", + "description":"HTTP response code" + }, + "trace":{ + "type":"string", + "description":"To be defined" + }, + "token":{ + "type":"string", + "description":"Session token to be used by all other requests" + } + } + }, + "Cart":{ + "type":"object", + "properties":{ + "cart_id":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "product_id":{ + "type":"integer" + }, + "id":{ + "type":"string" + }, + "price":{ + "type":"string" + }, + "qty":{ + "type":"integer" + } + } + }, + "CartResponse":{ + "type":"object", + "properties":{ + "id":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "items_count":{ + "type":"integer" + }, + "items_qty":{ + "type":"integer" + }, + "total_price":{ + "type":"integer" + }, + "uid":{ + "type":"string" + }, + "customer_id":{ + "type":"string" + }, + "customer_email":{ + "type":"string" + }, + "customer_is_guest":{ + "type":"string" + }, + "payment_method":{ + "type":"string" + }, + "shipping_method":{ + "type":"string" + }, + "shipping_address_id":{ + "type":"string" + }, + "billing_address_id":{ + "type":"string" + }, + "last_step":{ + "type":"string" + }, + "items":{ + "type":"array", + "items":{ + "$ref":"#/definitions/CartItemResponse" + } + } + } + }, + "CartItemResponse":{ + "type":"object", + "properties":{ + "id":{ + "type":"string" + }, + "cart_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "product_id":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "qty":{ + "type":"string" + }, + "price":{ + "type":"string" + } + } + }, + "CustomerAddress":{ + "type":"object", + "properties":{ + "address_line_1":{ + "type":"string" + }, + "address_line_2":{ + "type":"string" + }, + "city":{ + "type":"string" + }, + "country_id":{ + "type":"string" + }, + "customer_id":{ + "type":"integer" + }, + "full_name":{ + "type":"string" + }, + "id":{ + "type":"string" + }, + "phone":{ + "type":"string" + }, + "region":{ + "type":"string" + }, + "zip":{ + "type":"string" + } + } + }, + "GenericResponse":{ + "type":"object", + "properties":{ + + } + }, + "Order":{ + "type":"object", + "properties":{ + "comment":{ + "type":"string" + }, + "coupon_id":{ + "type":"string" + }, + "created_at":{ + "type":"string" + }, + "customer_email":{ + "type":"string" + }, + "customer_firstname":{ + "type":"string" + }, + "customer_id":{ + "type":"string" + }, + "customer_lastname":{ + "type":"string" + }, + "discount":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "increment_id":{ + "type":"string" + }, + "orderAddress":{ + "type":"array", + "items":{ + "$ref":"#/definitions/OrderAddress" + } + }, + "orderItems":{ + "type":"array", + "items":{ + "$ref":"#/definitions/GenericResponse" + } + }, + "payment_method":{ + "type":"string" + }, + "shipping_method":{ + "type":"string" + }, + "status":{ + "type":"string" + }, + "total_price":{ + "type":"string" + }, + "id":{ + "type":"integer" + } + } + }, + "OrderAddress":{ + "type":"object", + "properties":{ + "address_line_1":{ + "type":"string" + }, + "address_line_2":{ + "type":"string" + }, + "address_type":{ + "type":"string" + }, + "city":{ + "type":"string" + }, + "country_id":{ + "type":"string" + }, + "customer_id":{ + "type":"integer" + }, + "full_name":{ + "type":"string" + }, + "zip":{ + "type":"string" + }, + "order_id":{ + "type":"integer" + }, + "phone":{ + "type":"string" + }, + "region":{ + "type":"string" + }, + "id":{ + "type":"integer" + } + } + }, + "OrderItem":{ + "type":"object", + "properties":{ + "cart_id":{ + "type":"integer" + }, + "created_at":{ + "type":"string" + }, + "updated_at":{ + "type":"string" + }, + "name":{ + "type":"string" + }, + "order_id":{ + "type":"integer" + }, + "product_id":{ + "type":"integer" + }, + "price":{ + "type":"string" + }, + "qty":{ + "type":"integer" + }, + "id":{ + "type":"integer" + } + } + }, + "ProductResponse":{ + "type":"object", + "properties":{ + "productID":{ + "type":"integer" + }, + "categoryID":{ + "type":"integer" + }, + "name":{ + "type":"string" + }, + "description":{ + "type":"string" + }, + "customers_rating":{ + "type":"string" + }, + "Price":{ + "type":"integer" + }, + "picture":{ + "type":"string" + }, + "in_stock":{ + "type":"string" + }, + "thumbnail":{ + "type":"string" + }, + "customer_votes":{ + "type":"integer" + }, + "items_sold":{ + "type":"integer" + }, + "big_picture":{ + "type":"string" + }, + "enabled":{ + "type":"integer" + }, + "brief_description":{ + "type":"string" + }, + "list_price":{ + "type":"string" + }, + "product_code":{ + "type":"string" + }, + "hurl":{ + "type":"string" + }, + "accompanyID":{ + "type":"string" + }, + "brandID":{ + "type":"string" + }, + "meta_title":{ + "type":"string" + }, + "meta_keywords":{ + "type":"string" + }, + "meta_desc":{ + "type":"string" + }, + "canonical":{ + "type":"string" + }, + "h1":{ + "type":"string" + }, + "yml":{ + "type":"string" + }, + "min_qunatity":{ + "type":"string" + }, + "managerID":{ + "type":"string" + } + } + }, + "UserProfileData":{ + "type":"object", + "properties":{ + "id":{ + "type":"integer", + "description":"User ID number" + }, + "username":{ + "type":"string", + "description":"User name." + }, + "first_name":{ + "type":"string", + "description":"Users first name." + }, + "last_name":{ + "type":"string", + "description":"Users last name." + }, + "user_phone":{ + "type":"string", + "description":"Users phone number." + }, + "email":{ + "type":"string", + "description":"Users email address." + }, + "oauth_provider":{ + "type":"string", + "description":"For OAuth integration." + }, + "oauth_uid":{ + "type":"string", + "description":"For OAuth integration.." + }, + "created_on":{ + "type":"string", + "description":"Date account was created." + }, + "last_login":{ + "type":"string", + "description":"Date of last login." + }, + "active":{ + "type":"string", + "description":"User has active account." + }, + "photo":{ + "type":"string", + "description":"Users profile photo.." + }, + "photoUrl":{ + "type":"string", + "description":"Users profile photo.." + } + } + } + } +} \ No newline at end of file