boobo94

BK Xmas Campaign API

Oct 29th, 2018
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 12.08 KB | None | 0 0
  1. swagger: '2.0'
  2. info:
  3.   version: ''
  4.   title: Burger King Christmas Campaign API
  5.   description: |-
  6.     ## Code format
  7.  
  8.     The codes will be composed of `11` uppercase alpha numeric characters, `[A-Z0-9]`.
  9.  
  10.     ## Status codes
  11.  
  12.     ### 200
  13.  
  14.     OK.
  15.  
  16.     ### 400
  17.  
  18.     Bad request. You may be missing a required parameter or sending it in the wrong format.
  19.  
  20.     ### 401
  21.  
  22.     Not authorized. You forgot to include the `API Key` in the `Authorization` header, or the `API Key` is invalid.
  23.  
  24.     ### 404
  25.  
  26.     Not found. You may be trying to access an invalid resource (e.g. non-existent code).
  27.  
  28.     ### 500
  29.  
  30.     Internal server error. Something went wrong on our side.
  31.  
  32.     ## Errors
  33.  
  34.     Responses with bad status codes (`>= 400`) will include an error in the payload.
  35.  
  36.     Here are some example errors:
  37.     ### Authorization error
  38.  
  39.     ```json
  40.     {
  41.      "code":401,
  42.      "message":"You are not authorized"
  43.     }
  44.     ```
  45.  
  46.     ### Bad request
  47.  
  48.     ```json
  49.     {
  50.       "code": 400,
  51.       "message": "Bad Request. Your request is incorrect or you missed some required fields for this request."
  52.     }
  53.     ```
  54.  
  55.     ### Resource not found
  56.  
  57.     ```json
  58.     {
  59.       "code": 404,
  60.       "message": "Resource was not found"
  61.     }
  62.     ```
  63.  
  64.     #### Try to redeem a code before being activated from the app
  65.  
  66.     ```json
  67.     {
  68.       "code": 1,
  69.       "message": "The code has not been activated yet. Please activate it inside the app before redeeming."
  70.     }
  71.     ```
  72.  
  73.     #### Try to redeem a code outside the campaign period (e.g. before Nov 27th)
  74.  
  75.     ```json
  76.     {
  77.       "code": 2,
  78.       "message": "Can't redeem codes at this time."
  79.     }
  80.     ```
  81.  
  82.     #### Try to redeem a code which has already been redeemed
  83.  
  84.     ```json
  85.     {
  86.       "code": 3,
  87.       "message": "The code has already been redeemed."
  88.     }
  89.     ```
  90.  
  91.     ### Generic error message (when the cause is unknown)
  92.  
  93.     ```json
  94.     {
  95.      "code":-1,
  96.      "message":"Something went wrong"
  97.     }
  98.     ``` ## Code format
  99.  
  100.     The codes will be composed of `11` uppercase alpha numeric characters, `[A-Z0-9]`.
  101.  
  102.     ## Status codes
  103.  
  104.     ### 200
  105.  
  106.     OK.
  107.  
  108.     ### 400
  109.  
  110.     Bad request. You may be missing a required parameter or sending it in the wrong format.
  111.  
  112.     ### 401
  113.  
  114.     Not authorized. You forgot to include the `API Key` in the `Authorization` header, or the `API Key` is invalid.
  115.  
  116.     ### 404
  117.  
  118.     Not found. You may be trying to access an invalid resource (e.g. non-existent code).
  119.  
  120.     ### 500
  121.  
  122.     Internal server error. Something went wrong on our side.
  123.  
  124.     ## Errors
  125.  
  126.     Responses with bad status codes (`>= 400`) will include an error in the payload.
  127.  
  128.     Here are some example errors:
  129.     ### Authorization error
  130.  
  131.     ```json
  132.     {
  133.      "code":401,
  134.      "message":"You are not authorized"
  135.     }
  136.     ```
  137.  
  138.     ### Bad request
  139.  
  140.     ```json
  141.     {
  142.       "code": 400,
  143.       "message": "Bad Request. Your request is incorrect or you missed some required fields for this request."
  144.     }
  145.     ```
  146.  
  147.     ### Resource not found
  148.  
  149.     ```json
  150.     {
  151.       "code": 404,
  152.       "message": "Resource was not found"
  153.     }
  154.     ```
  155.  
  156.     #### Try to redeem a code before being activated from the app
  157.  
  158.     ```json
  159.     {
  160.       "code": 1,
  161.       "message": "The code has not been activated yet. Please activate it inside the app before redeeming."
  162.     }
  163.     ```
  164.  
  165.     #### Try to redeem a code outside the campaign period (e.g. before Nov 27th)
  166.  
  167.     ```json
  168.     {
  169.       "code": 2,
  170.       "message": "Can't redeem codes at this time."
  171.     }
  172.     ```
  173.  
  174.     #### Try to redeem a code which has already been redeemed
  175.  
  176.     ```json
  177.     {
  178.       "code": 3,
  179.       "message": "The code has already been redeemed."
  180.     }
  181.     ```
  182.  
  183.     ### Generic error message (when the cause is unknown)
  184.  
  185.     ```json
  186.     {
  187.      "code":-1,
  188.      "message":"Something went wrong"
  189.     }
  190.     ```
  191. host: 'localhost:8000'
  192. basePath: /api/v1
  193. schemes:
  194.  - http
  195.   - https
  196. consumes:
  197.  - application/json
  198. produces:
  199.  - application/json
  200. securityDefinitions:
  201.   Authorization:
  202.     name: Authorization
  203.     type: apiKey
  204.     in: header
  205. paths:
  206.   '/pos/codes/{code}/printed':
  207.     parameters:
  208.       - name: code
  209.         in: path
  210.         required: true
  211.         type: string
  212.     put:
  213.       operationId: MarkCodePrinted
  214.       summary: Mark Code as Printed
  215.       tags:
  216.        - Pos
  217.       description: Mark the code as printed.
  218.       responses:
  219.         '200':
  220.           description: ''
  221.           schema:
  222.             $ref: '#/definitions/code-details'
  223.         '400':
  224.           $ref: '#/responses/trait:error:400'
  225.         '401':
  226.           $ref: '#/responses/trait:error:401'
  227.         '404':
  228.           $ref: '#/responses/trait:error:404'
  229.         '500':
  230.           $ref: '#/responses/trait:error:500'
  231.       security:
  232.         - Authorization: []
  233.       x-stoplight:
  234.         id: MarkCodePrinted
  235.         beforeScript: null
  236.         afterScript: null
  237.         public: true
  238.         mock:
  239.           statusCode: 200
  240.           dynamic: false
  241.           enabled: false
  242.   '/pos/codes/{code}':
  243.     parameters:
  244.       - name: code
  245.         in: path
  246.         required: true
  247.         type: string
  248.     get:
  249.       operationId: Get Code
  250.       summary: Get Code Details
  251.       tags:
  252.        - Pos
  253.       description: Return the details for a specific code.
  254.       responses:
  255.         '200':
  256.           description: ''
  257.           schema:
  258.             $ref: '#/definitions/code-details'
  259.         '400':
  260.           $ref: '#/responses/trait:error:400'
  261.         '401':
  262.           $ref: '#/responses/trait:error:401'
  263.         '404':
  264.           $ref: '#/responses/trait:error:404'
  265.         '500':
  266.           $ref: '#/responses/trait:error:500'
  267.       security:
  268.         - Authorization: []
  269.       x-stoplight:
  270.         id: Get Code
  271.         beforeScript: null
  272.         afterScript: null
  273.         public: true
  274.         mock:
  275.           statusCode: 200
  276.           dynamic: false
  277.           enabled: false
  278.   /pos/codes:
  279.     post:
  280.       operationId: GenerateCode
  281.       summary: Generate Code
  282.       tags:
  283.        - Pos
  284.       description: Generate a new code.
  285.       parameters:
  286.         - name: body
  287.           in: body
  288.           schema:
  289.             type: object
  290.             properties:
  291.               restaurant_id:
  292.                 type: string
  293.                 description: 'The ID of the restaurant, e.g. 24188'
  294.               prize_quantity:
  295.                 type: integer
  296.                 minimum: 0
  297.                 description: The number of products bought from restaurant.
  298.             required:
  299.              - restaurant_id
  300.       responses:
  301.         '200':
  302.           description: ''
  303.           schema:
  304.             $ref: '#/definitions/code-details'
  305.         '400':
  306.           $ref: '#/responses/trait:error:400'
  307.         '401':
  308.           $ref: '#/responses/trait:error:401'
  309.         '404':
  310.           $ref: '#/responses/trait:error:404'
  311.         '500':
  312.           $ref: '#/responses/trait:error:500'
  313.       security:
  314.         - Authorization: []
  315.       x-stoplight:
  316.         id: GenerateCode
  317.         beforeScript: null
  318.         afterScript: null
  319.         public: true
  320.         mock:
  321.           statusCode: 200
  322.           dynamic: false
  323.           enabled: false
  324.   '/pos/codes/{code}/redeem':
  325.     parameters:
  326.       - name: code
  327.         in: path
  328.         required: true
  329.         type: string
  330.     put:
  331.       operationId: RedeemCode
  332.       summary: Redeem Code
  333.       tags:
  334.        - Pos
  335.       description: Redeem a code.
  336.       parameters:
  337.         - name: body
  338.           in: body
  339.           schema:
  340.             type: object
  341.             properties:
  342.               restaurant_id:
  343.                 type: string
  344.                 description: 'The restaurant ID, e.g. 24188'
  345.             required:
  346.              - restaurant_id
  347.       responses:
  348.         '200':
  349.           description: ''
  350.           schema:
  351.             $ref: '#/definitions/code-details'
  352.         '400':
  353.           $ref: '#/responses/trait:error:400'
  354.         '401':
  355.           $ref: '#/responses/trait:error:401'
  356.         '404':
  357.           $ref: '#/responses/trait:error:404'
  358.         '500':
  359.           $ref: '#/responses/trait:error:500'
  360.       security:
  361.         - Authorization: []
  362.       x-stoplight:
  363.         id: RedeemCode
  364.         beforeScript: null
  365.         afterScript: null
  366.         public: true
  367.         mock:
  368.           statusCode: 200
  369.           dynamic: false
  370.           enabled: false
  371. responses:
  372.   'trait:error:400':
  373.     description: ''
  374.     schema:
  375.       $ref: '#/definitions/error-response'
  376.   'trait:error:401':
  377.     description: ''
  378.     schema:
  379.       $ref: '#/definitions/error-response'
  380.   'trait:error:404':
  381.     description: ''
  382.     schema:
  383.       $ref: '#/definitions/error-response'
  384.   'trait:error:500':
  385.     description: ''
  386.     schema:
  387.       $ref: '#/definitions/error-response'
  388. definitions:
  389.   code-details:
  390.     title: Code Details
  391.     type: object
  392.     properties:
  393.       code:
  394.         type: string
  395.         description: The code
  396.       prize_name:
  397.         type: string
  398.         description: The name of the prize
  399.       prize_image_url:
  400.         type: string
  401.         description: The image URL of the prize
  402.       status:
  403.         type: string
  404.         description: |
  405.          The status of the code.
  406.  
  407.           `available` - The code is available
  408.  
  409.           `generated` - The code was assigned to a restaurant, but not printed, yet
  410.  
  411.           `printed` - The code has been printed by the restaurant
  412.  
  413.           `activated` - The code has been activated by a user inside the App
  414.  
  415.           `redeemed` - The code has been redeemed by the user
  416.         enum:
  417.          - available
  418.           - generated
  419.           - printed
  420.           - activated
  421.           - redeemed
  422.       redeem_date:
  423.         type: string
  424.         format: date-time
  425.         description: The date when this code was redeemed. Will only be available if the `status` is `redeemed`.
  426.       product_id_ncr:
  427.         type: integer
  428.         description: Prize ID for the NCR's systems
  429.       product_id_toshiba:
  430.         type: integer
  431.         description: Prize ID for Toshiba's systems
  432.       creation_date:
  433.         type: string
  434.         format: date-time
  435.         description: The date when the code was generated and printed.
  436.       restaurant_id_generated:
  437.         type: string
  438.         description: 'The restaurant id, where the client bought a BK product and the code was generated and printed.'
  439.       restaurant_id_redeemed:
  440.         type: string
  441.         description: 'The restaurant id, where de gift was obtained from.'
  442.     required:
  443.      - code
  444.       - prize_name
  445.       - prize_image_url
  446.       - status
  447.       - product_id_ncr
  448.       - product_id_toshiba
  449.       - creation_date
  450.       - restaurant_id_generated
  451.     x-stoplight:
  452.       id: code-details
  453.       name: Code Details
  454.       public: true
  455.   error-response:
  456.     title: Error Response
  457.     type: object
  458.     properties:
  459.       code:
  460.         type: integer
  461.       message:
  462.         type: string
  463.     required:
  464.      - code
  465.       - message
  466.     x-stoplight:
  467.       id: error-response
  468.       name: Error Response
  469.       public: true
  470. x-stoplight:
  471.   beforeScript: ''
  472.   afterScript: ''
  473.   version:
  474.     groups:
  475.       utilFuncs: []
  476.       savedEntries: []
  477.       tests: []
  478.       traits: []
  479.       docs:
  480.         - items:
  481.             - type: endpoints
  482.               _id: MarkCodePrinted
  483.             - type: endpoints
  484.               _id: Get Code
  485.             - type: endpoints
  486.               _id: GenerateCode
  487.             - type: endpoints
  488.               _id: RedeemCode
  489.           name: Pos
  490.         - items:
  491.             - type: schemas
  492.               _id: code-details
  493.             - type: schemas
  494.               _id: error-response
  495.           description: Models make up the core input and ouput structures in this API. They are used in endpoint request and response bodies.
  496.           name: Models
  497.         - items:
  498.             - type: traits
  499.               _id: error
  500.           description: Traits describe common behaviors or structures in this API.
  501.           name: Traits
  502.   functions: {}
  503.   textSections: {}
  504.   mock:
  505.     dynamic: false
  506.     enabled: false
  507. x-tests: {}
Add Comment
Please, Sign In to add comment