Repository URL to install this package:
| 
      
     
      
        
        
        Version: 
        
         
  
        
    
          
          0.4.198  ▾
        
         
  
      
        
      
  
      
  
     | 
    
    lib-py-b2b
  
    /
        b2bApi.yaml
    | 
|---|
---
swagger: "2.0"
info:
  version: "1.0.0"
  title: "Barnhardt Mfg API"
  description: |
    ### Introduction
    This API provides functionality for automating B2B purchase orders with Barnhardt Mfg. It provides the capability to place a new order, receive order acknowledgements, shipping notices, and check status on existing orders. The API exposes Restful APIs for inbound transactions and Webhooks for outbound notifications.
    ### Order Process
    The overall process involves the receipt and acceptance of a purchase order, the acceptance of that order, and notifications of changes to the state of that order.  The following diagram provides a high level illustration of this process.
    
    #### Order Status
    Orders can be in one of 4 states: VALID, ACCEPTED, REJECTED, or SHIPPED.  This is illustrated below:
    
    #### Order Submission
    Orders placed via this API will are validated against the [Order](#definition-Order) schema for structure. If they fail this validation, the customer will receive an http 400 error. In this case, the customer is responsible for re-submissions and error handling. If the document structure is valid, the customer will receive an http 200 response and the order status will be set to VALID.
    #### Acceptance
    Valid orders will be checked for item validity, manufacturing constraints, and other business factors. Once a determination is made, the order will move to a status of ACCEPTED or REJECTED. If the order included an order_acknowledgement notification_url, this state change will trigger an order acknowledgement notification.
    #### Ammendment
    A rejected order can be re-submitted if the purchase_order_revision is modified.  This is useful for correcting small errors in the order. This is an exception process and may require some additional communications. If the changes are approved, the order will enter a status of ACCEPTED. If registered, this status change will trigger an order acknowledgement.
    #### Shipment
    Once an order has been accepted, manufactured, and scheduled for shipment, the order will enter a SHIPPED status.  If the order included a ship_notice notification_url, this status change will trigger a notification of shipment with applicable tracking information.
    ### Webhooks
    A WebHook is an HTTP POST callback. The webhooks provided in this API are registered as a part of *each* inbound order request.
    #### Order Acknowledgement
    The order acknowledgement provides feedback to the customer as to whether the order was ACCEPTED or REJECTED. In the case of a rejection, it will provide the reasons why (e.g. Item does not exist, Missing property, etc).  An order may be re-submitted after a rejection by incrementing the version number of the order PUT request. *It's important that an order acknowledgement url is provided with the order request so that the customer can be made aware of any order content errors.*
    The order_acknowledgement url for a particular order is provided in the PUT request to /order as a part of the notification_urls object.  The url should be a fully formed https url.  It will be sent as an HTTPS POST operation with a body conforming to the [OrderAcknowledgement](#definition-OrderAcknowledgement) schema.
    #### Ship Notice
    The ship notice will provide feedback as to when an order has been shipped and any tracking information associated with it.
    The ship_notice url is provided in the PUT request to /order as a part of the notification_urls object.  The url should be a fully formed https url.  It will be sent as an HTTPS POST operation with a body conforming to the [ShipNotice](#definition-ShipNotice) schema.
    ### Cross-Origin Resource Sharing
    This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with  [W3C spec](https://www.w3.org/TR/cors/).
    And that allows cross-domain communication from the browser.
    All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
    <!-- ReDoc-Inject: <security-definitions> -->
  contact:
    email: apiteam@barnhardt.net
  x-logo:
    url: 'https://www.barnhardt.net/img/BarnhardtCorporateLogo_no_cotton_boll.png'
  license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
  - name: Orders
    description: Access to submit and get information about your orders.
host: "api.barnhardt.net"
basePath: "/v1"
schemes:
  - "https"
produces:
  - application/json
paths:
  /order:
    post:
      summary: Create New Order
      description: |
        Place a new order with Barnhardt Mfg.
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "Order"
        description: |
          The order request details
        required: true
        schema:
          $ref: "#/definitions/Order"
      tags:
      - Orders
      responses:
        200:
          schema:
            $ref: "#/definitions/Empty"
          description: "Success"
          headers:
            Access-Control-Allow-Origin:
              type: "string"
        400:
          description: "Bad Request - The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."
          schema:
            $ref: "#/definitions/Error"
        500:
          description: "Internal Server Error - The server encountered an unexpected condition which prevented it from fulfilling the request."
          schema:
            $ref: "#/definitions/Error"
        403:
          description: "Forbidden - User is not authorized for this request."
          schema:
            $ref: "#/definitions/Error"
        404:
          description: "Not Found - The server has not found anything matching the Request-URI."
          schema:
            $ref: "#/definitions/Error"
      security:
      - api_key: []
      x-amazon-apigateway-request-validator: "Validate body"
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
          ^\[Forbidden].*:
            statusCode: "403"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[InternalServerError].*:
            statusCode: "500"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[NotFound].*:
            statusCode: "404"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[BadRequest].*:
            statusCode: "400"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            \n    }\n}\n"
        uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:803813156102:function:public-b2b-Order-post:${stageVariables.env}/invocations"
        passthroughBehavior: "when_no_templates"
        httpMethod: "POST"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
    get:
      summary: List Order Status
      description: |
        Retrieves a list of the current customer's order statuses.
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - name: "beginDate"
        in: "query"
        required: false
        description: First request date to include in the results. Use javascript parsable date (ISO 8601). For example, 2016-12-30.
        type: "string"
      - name: "endDate"
        in: "query"
        required: false
        description: Last request date to include in the results.  Use javascript parsable date (ISO 8601). For example, 2017-02-04.
        type: "string"
      tags:
      - Orders
      responses:
        200:
          description: "Success"
          schema:
            $ref: "#/definitions/ArrayOfOrderStatus"
        400:
          description: "Bad Request - The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."
          schema:
            $ref: "#/definitions/Error"
        500:
          description: "Internal Server Error - The server encountered an unexpected condition which prevented it from fulfilling the request."
          schema:
            $ref: "#/definitions/Error"
        403:
          description: "Forbidden - User is not authorized for this request."
          schema:
            $ref: "#/definitions/Error"
        404:
          description: "Not Found - The server has not found anything matching the Request-URI."
          schema:
            $ref: "#/definitions/Error"
      security:
      - api_key: []
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
          ^\[Forbidden].*:
            statusCode: "403"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[InternalServerError].*:
            statusCode: "500"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[NotFound].*:
            statusCode: "404"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[BadRequest].*:
            statusCode: "400"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            \n    }\n}\n"
        uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:803813156102:function:public-b2b-Order-get:${stageVariables.env}/invocations"
        passthroughBehavior: "when_no_templates"
        httpMethod: "POST"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
    options:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      tags:
      - Orders
      responses:
        200:
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
          headers:
            Access-Control-Allow-Origin:
              type: "string"
            Access-Control-Allow-Methods:
              type: "string"
            Access-Control-Allow-Headers:
              type: "string"
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
            responseParameters:
              method.response.header.Access-Control-Allow-Methods: "'POST,GET,OPTIONS'"
              method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
              method.response.header.Access-Control-Allow-Origin: "'*'"
        requestTemplates:
          application/json: "{\"statusCode\": 200}"
        passthroughBehavior: "when_no_match"
        type: "mock"
  /order/{purchaseorder}:
    get:
      summary: Retrieve An Order Status
      description: |
        Get the status for a specific purchase order.
      consumes:
      - "application/json"
      produces:
      - "application/json"
      parameters:
      - name: "purchaseorder"
        in: "path"
        required: true
        description: The purchase order number provided with the original order request.
        type: "string"
      tags:
      - Orders
      responses:
        200:
          description: "Success"
          schema:
            $ref: "#/definitions/OrderStatus"
          headers:
            Access-Control-Allow-Origin:
              type: "string"
        400:
          description: "Bad Request - The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications."
          schema:
            $ref: "#/definitions/Error"
        500:
          description: "Internal Server Error - The server encountered an unexpected condition which prevented it from fulfilling the request."
          schema:
            $ref: "#/definitions/Error"
        403:
          description: "Forbidden - User is not authorized for this request."
          schema:
            $ref: "#/definitions/Error"
        404:
          description: "Not Found - The server has not found anything matching the Request-URI."
          schema:
            $ref: "#/definitions/Error"
      security:
      - api_key: []
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
          ^\[Forbidden].*:
            statusCode: "403"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[InternalServerError].*:
            statusCode: "500"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[NotFound].*:
            statusCode: "404"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
          ^\[BadRequest].*:
            statusCode: "400"
            responseTemplates:
              application/json: "#set($inputRoot = $input.path('$'))\n{\n  \"message\"\
                \ : \"$inputRoot.errorMessage\"\n}"
            contentHandling: "CONVERT_TO_TEXT"
        requestTemplates:
          application/json: "##  See http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html\n\
            ##  This template will pass through all parameters including path, querystring,\
            \ header, stage variables, and context through to the integration endpoint\
            \ via the body/payload\n#set($allParams = $input.params())\n{\n\"body-json\"\
            \ : $input.json('$'),\n\"params\" : {\n#foreach($type in $allParams.keySet())\n\
            \    #set($params = $allParams.get($type))\n\"$type\" : {\n    #foreach($paramName\
            \ in $params.keySet())\n    \"$paramName\" : \"$util.escapeJavaScript($params.get($paramName))\"\
            \n        #if($foreach.hasNext),#end\n    #end\n}\n    #if($foreach.hasNext),#end\n\
            #end\n},\n\"stage-variables\" : {\n#foreach($key in $stageVariables.keySet())\n\
            \"$key\" : \"$util.escapeJavaScript($stageVariables.get($key))\"\n   \
            \ #if($foreach.hasNext),#end\n#end\n},\n\"context\" : {\n    \"account-id\"\
            \ : \"$context.identity.accountId\",\n    \"api-id\" : \"$context.apiId\"\
            ,\n    \"api-key\" : \"$context.identity.apiKey\",\n    \"authorizer-principal-id\"\
            \ : \"$context.authorizer.principalId\",\n    \"caller\" : \"$context.identity.caller\"\
            ,\n    \"cognito-authentication-provider\" : \"$context.identity.cognitoAuthenticationProvider\"\
            ,\n    \"cognito-authentication-type\" : \"$context.identity.cognitoAuthenticationType\"\
            ,\n    \"cognito-identity-id\" : \"$context.identity.cognitoIdentityId\"\
            ,\n    \"cognito-identity-pool-id\" : \"$context.identity.cognitoIdentityPoolId\"\
            ,\n    \"http-method\" : \"$context.httpMethod\",\n    \"stage\" : \"\
            $context.stage\",\n    \"source-ip\" : \"$context.identity.sourceIp\"\
            ,\n    \"user\" : \"$context.identity.user\",\n    \"user-agent\" : \"\
            $context.identity.userAgent\",\n    \"user-arn\" : \"$context.identity.userArn\"\
            ,\n    \"request-id\" : \"$context.requestId\",\n    \"resource-id\" :\
            \ \"$context.resourceId\",\n    \"resource-path\" : \"$context.resourcePath\"\
            \n    }\n}\n"
        uri: "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:803813156102:function:public-b2b-Order-get:${stageVariables.env}/invocations"
        passthroughBehavior: "when_no_templates"
        httpMethod: "POST"
        contentHandling: "CONVERT_TO_TEXT"
        type: "aws"
    options:
      consumes:
      - "application/json"
      produces:
      - "application/json"
      tags:
      - Orders
      responses:
        200:
          description: "200 response"
          schema:
            $ref: "#/definitions/Empty"
          headers:
            Access-Control-Allow-Origin:
              type: "string"
            Access-Control-Allow-Methods:
              type: "string"
            Access-Control-Allow-Headers:
              type: "string"
      x-amazon-apigateway-integration:
        responses:
          default:
            statusCode: "200"
            responseParameters:
              method.response.header.Access-Control-Allow-Methods: "'GET,OPTIONS'"
              method.response.header.Access-Control-Allow-Headers: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
              method.response.header.Access-Control-Allow-Origin: "'*'"
        requestTemplates:
          application/json: "{\"statusCode\": 200}"
        passthroughBehavior: "when_no_match"
        type: "mock"
securityDefinitions:
  api_key:
    description: All http requests require an api key in the header of the request.
    type: "apiKey"
    name: "x-api-key"
    in: "header"
definitions:
  Order:
    type: "object"
    required:
    - "carrier"
    - "customer_edi_id"
    - "notification_urls"
    - "order_lines"
    - "purchase_order"
    - "required_date"
    - "shipTo"
    properties:
      customer_edi_id:
        type: "string"
        description: "The customer's Barnhardt assigned edi id."
        title: "Customer EDI Id"
        pattern: "^[a-zA-Z0-9-_]+$"
        maxLength: 20
      purchase_order:
        type: "string"
        description: "The customer's purchase order number. The combination of the Customer EDI Id and Purchase Order should be unique."
        title: "Purchase Order"
        pattern: "^[a-zA-Z0-9-_]+$"
        maxLength: 20
      purchase_order_revision:
        type: "integer"
        description: "If there have been revisions or ammendments to an existing purchase\
          \ order, it needs a numeric revision number."
        pattern: "^[a-zA-Z0-9-_]+$"
        title: "Revision"
      carrier:
        type: "string"
        description: "The shipping carrier."
        title: "Carrier"
        maxLength: 4
        enum:
        - "FDX"
        default: "FDX"
      required_date:
        type: "string"
        description: "The date the order needs to be delivered to the customer in\
          \ ISO 8601 format. Example: 2014-06-10T16:30:00-07:00"
        title: "Required Date"
        maxLength: 25
        pattern: "^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\\
          d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\\
          d|2[0-3]):[0-5]\\d:[0-5]\\d(?:Z|[+-][01]\\d:[0-5]\\d)$"
      not_before_date:
        type: "string"
        description: "Do not ship before this date in ISO 8601 format. Example: 2014-06-10T16:30:00-07:00"
        title: "Not Before Date"
        maxLength: 25
        pattern: "^(?:[1-9]\\d{3}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1\\d|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[1-9]\\\
          d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)-02-29)T(?:[01]\\\
          d|2[0-3]):[0-5]\\d:[0-5]\\d(?:Z|[+-][01]\\d:[0-5]\\d)$"
      note:
        type: "string"
        description: "A note about the order."
        title: "Note"
        maxLength: 70
        default: ""
      order_lines:
        type: "array"
        description: Array of [OrderLine](#/definitions/OrderLine) objects.
        items:
          $ref: "#/definitions/OrderLine"
      shipTo:
          description: Address where the order should be delivered.
          $ref: "#/definitions/Address"
      notification_urls:
        type: "object"
        description: Webhook urls used for order event notification.
        properties:
          order_acknowledgement:
            type: "string"
            description: "The callback URL for order acknowledgements or rejections.\
              \  If a url is not provided, an order acknowledgement will not be sent."
            title: "Order Acknowledgement URL"
            pattern: "^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\
              \ \\.-]*)*\\/?$"
            default: "https://somewhere.com/orders/acknowlege/43223512"
          ship_notice:
            type: "string"
            description: "The callback URL for shipment notifications.  If a url is\
              \ not provided, a shipment notice will not be sent."
            title: "Ship Notice URL"
            pattern: "^(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\
              \ \\.-]*)*\\/?$"
            default: "https://somewhere.com/orders/shipped/43223512"
  ArrayOfOrderStatus:
    type: "array"
    items:
      $ref: "#/definitions/OrderStatus"
  Address:
    type: "object"
    properties:
      address1:
        type: "string"
        description: "The first address line for the address."
        title: "Address1"
        minLength: 1
        maxLength: 35
      address2:
        type: "string"
        description: "The second address line for the address."
        title: "Address2"
        maxLength: 35
      address3:
        type: "string"
        description: "The third address line for the address."
        title: "Address3"
        maxLength: 35
      city:
        type: "string"
        description: "The city for the address."
        title: "City"
        minLength: 1
        maxLength: 20
      company:
        type: "string"
        description: "If the address is a company, the name of the company for\
          \ the address."
        title: "Company"
        maxLength: 35
      country:
        type: "string"
        description: "The country for the address. (3 letter ISO abbreviation)"
        title: "Country"
        minLength: 2
        maxLength: 3
        default: "USA"
      email:
        type: "string"
        description: "The email address for the contact."
        title: "Email Address"
        maxLength: 256
        pattern: "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$"
      name:
        type: "string"
        description: "The name for the contact."
        title: "Name"
        maxLength: 35
      phone:
        type: "string"
        description: "The telephone number for the contact."
        title: "Phone"
        maxLength: 35
        pattern: "^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\\
          s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\\
          s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\\
          d+))?$"
      postalCode:
        type: "string"
        description: "The postal code for the address."
        title: "Postal Code"
        maxLength: 10
        pattern: "(\\d{5}([\\-]\\d{4})?)"
      state:
        type: "string"
        description: "State or Province for the address."
        title: "State"
        minLength: 1
        maxLength: 2
    required:
    - "address1"
    - "city"
    - "country"
    - "name"
    - "phone"
    - "postalCode"
    - "state"
  OrderLine:
    type: "object"
    title: "Order Line"
    properties:
      purchase_order_line:
        type: "string"
        description: "Customer's purchase order line identifier."
        title: "Purchase Order Line"
        maxLength: 4
      note:
        type: "string"
        description: "A note about the order line."
        title: "Line Note"
        maxLength: 70
      product_external_id:
        type: "string"
        description: "The customer's product id.  This will be included with\
          \ order acknowledgements and ship notices."
        title: "Product External Id"
        maxLength: 30
      product_id:
        type: "string"
        description: "The Barnhardt product identifier."
        title: "Product Id"
        maxLength: 30
      quantity:
        type: "integer"
        description: "The quantity ordered for this line item."
        title: "Quantity"
        minimum: 0.0
        maximum: 999999.0
    required:
    - "product_id"
    - "purchase_order_line"
    - "quantity"
  OrderStatus:
    type: "object"
    title: "Order Status"
    properties:
      request:
        $ref: "#/definitions/Order"
      status:
        type: "string"
        enum:
          - "ACCEPTED"
          - "REJECTED"
          - "SHIPPED"
  Empty:
    type: "object"
    title: "Empty Schema"
  Error:
    type: "object"
    properties:
      message:
        type: "string"
    title: "Error Schema"
  ShipNotice:
    title: "Shipping Notice"
    required:
    - customer_edi_id
    - purchase_order
    - purchase_order_line
    - tracking
    type: object
    properties:
      customer_edi_id:
        description: The customer's electronic transaction identifier.
        maxLength: 20
        title: Customer EDI Id
        type: string
      purchase_order:
        description: The customer's purchase order number
        maxLength: 20
        title: Purchase Order
        type: string
      purchase_order_line:
        description: The customer's identifier for the order line.
        title: Purchase Order Line
        maxLength: 4
        type: string
      tracking:
        type: array
        items:
          required:
          - url
          - carrier
          - tracking
          type: object
          properties:
            carrier:
              description: The shipment's carrier.
              maxLength: 4
              title: Carrier
              type: string
            tracking:
              description: The carrier's tracking number for this shipment
              maxLength: 256
              title: Tracking Number
              type: string
            url:
              description: The url to tracking information from the carrier.
              maxLength: 512
              title: Tracking URL
              type: string
  OrderAcknowledgement:
    title: "Order Acknowledgement"
    required:
    - customer_edi_id
    - status
    - purchase_order
    - order_number
    - errors
    type: object
    properties:
      customer_edi_id:
        description: Customer's identifier for electronic transactions
        title: Customer EDI Id
        maxLength: 20
        type: string
      purchase_order:
        description: The customer supplied purchase order.
        title: Purchase Order
        maxLength: 20
        type: string
      order_number:
        description: The Barnhardt order number.
        title: Order Number
        maxLength: 20
        type: string
      status:
        description: The status for the order
        title: Status
        type: string
        enum:
        - ACCEPTED
        - REJECTED
        - AMMENDED
      errors:
        type: array
        items:
          required:
          - message
          - type
          type: object
          properties:
            message:
              description: An explanation of the error
              title: Error Message
              maxLength: 50
              type: string
            type:
              description: Whether the error concerns the order itself or one of it's
                lines
              title: Error Type
              enum:
              - order
              - line
              type: string
x-amazon-apigateway-request-validators:
  Validate body:
    validateRequestParameters: false
    validateRequestBody: true