swagger: "2.0"
schemes:
  - https
host: event.jirafe.com
basePath: /v2
info:
  contact:
    email: support@jirafe.com
  description: API endpoins for sending Jirafe events
  termsOfService: https://jirafe.com/policies/terms/
  title: Jirafe Events
  version: 2.0.0
  x-apisguru-categories:
    - marketing
  x-logo:
    backgroundColor: "#4BC9C5"
    url: https://twitter.com/jirafe/profile_image?size=original
  x-origin:
    - converter:
        url: https://github.com/lucybot/api-spec-converter
        version: 2.7.31
      format: swagger
      url: https://event.jirafe.com/api-docs
      version: "1.2"
  x-providerName: jirafe.com
externalDocs:
  url: https://docs.jirafe.com/api/
produces:
  - application/json
securityDefinitions:
  oauth2_accessCode:
    authorizationUrl: https://account.jirafe.com/oauth2/auth_token
    flow: accessCode
    scopes:
      write: Send events
    tokenUrl: https://account.jirafe.com/oauth2/code
    type: oauth2
  oauth2_implicit:
    authorizationUrl: https://account.jirafe.com/oauth2/authorize
    flow: implicit
    scopes:
      write: Send events
    type: oauth2
tags:
  - description: Batch events
    name: batch
  - description: Cart events
    name: cart
  - description: Category events
    name: category
  - description: Customer events
    name: customer
  - description: Order events
    name: order
  - description: Product events
    name: product
paths:
  "/{siteId}/batch":
    post:
      operationId: postBatch
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: batch json of events
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Batch"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a batch for the given site
      tags:
        - batch
  "/{siteId}/cart":
    post:
      operationId: postCart
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: cart json for the event
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Cart"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a cart for the given site
      tags:
        - cart
  "/{siteId}/category":
    post:
      operationId: postCategory
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: category json for the event
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Category"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a category for the given site
      tags:
        - category
  "/{siteId}/customer":
    post:
      operationId: postCustomer
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: customer json for the event
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Customer"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a customer for the given site
      tags:
        - customer
  "/{siteId}/order":
    post:
      operationId: postOrderCancelled
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: order json for the event
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/OrderCancelled"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a order for the given site
      tags:
        - order
  "/{siteId}/product":
    post:
      operationId: postProduct
      parameters:
        - description: ID site to send the event
          in: path
          name: siteId
          required: true
          type: string
        - description: product json for the event
          in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/Product"
      responses:
        "200":
          description: No response was specified
        "400":
          description: validation
        "403":
          description: authorization
        "503":
          description: unknown
      security:
        - oauth2_accessCode:
            - write
        - oauth2_implicit:
            - write
      summary: Send a product for the given site
      tags:
        - product
definitions:
  Address: {}
  Attribute:
    properties:
      id:
        type: string
      name:
        type: string
      value:
        type: string
    required:
      - id
      - name
      - value
    type: object
  BaseProduct:
    properties:
      code:
        type: string
      id:
        type: string
      name:
        type: string
    type: object
  Batch:
    properties:
      cart:
        items:
          $ref: "#/definitions/Cart"
        type: array
      category:
        items:
          $ref: "#/definitions/Category"
        type: array
      customer:
        items:
          $ref: "#/definitions/Customer"
        type: array
      employee:
        items:
          $ref: "#/definitions/Employee"
        type: array
      order:
        items:
          $ref: "#/definitions/Order"
        type: array
      product:
        items:
          $ref: "#/definitions/Product"
        type: array
    type: object
  Cart:
    properties:
      cart_id:
        type: string
      change_date:
        format: date-time
        type: string
      cookies:
        type: object
      create_date:
        format: date-time
        type: string
      currency:
        type: string
      customer:
        $ref: "#/definitions/Customer"
      id:
        type: string
      items:
        items:
          $ref: "#/definitions/CartItem"
        type: array
      previous_items:
        items:
          $ref: "#/definitions/CartItem"
        type: array
      subtotal:
        type: number
      total:
        maximum: 9007199254740992
        minimum: 0
        type: number
      total_discounts:
        maximum: 9007199254740992
        minimum: 0
        type: number
      total_payment_cost:
        maximum: 9007199254740992
        minimum: 0
        type: number
      total_shipping:
        maximum: 9007199254740992
        minimum: 0
        type: number
      total_tax:
        maximum: 9007199254740992
        minimum: 0
        type: number
      visit:
        $ref: "#/definitions/Visit"
    required:
      - id
      - create_date
      - change_date
      - subtotal
      - total
      - total_tax
      - total_shipping
      - total_payment_cost
      - total_discounts
      - currency
      - customer
      - items
    type: object
  CartItem:
    properties:
      cart_item_number:
        type: string
      change_date:
        format: date-time
        type: string
      create_date:
        format: date-time
        type: string
      discount_price:
        maximum: 9007199254740992
        minimum: 0
        type: number
      id:
        type: string
      price:
        maximum: 9007199254740992
        minimum: 0
        type: number
      product:
        $ref: "#/definitions/Product"
      quantity:
        maximum: 9007199254740992
        minimum: -9007199254740992
        type: integer
    required:
      - id
      - create_date
      - change_date
      - cart_item_number
      - quantity
      - price
      - discount_price
      - product
    type: object
  Catalog:
    properties:
      id:
        type: string
      name:
        type: string
      version_id:
        type: string
    required:
      - id
    type: object
  Category:
    properties:
      id:
        type: string
      name:
        type: string
    required:
      - id
      - name
    type: object
  Customer:
    properties:
      active_flag:
        default: true
        type: boolean
      change_date:
        format: date-time
        type: string
      company:
        type: string
      cookies:
        type: object
      create_date:
        format: date-time
        type: string
      department:
        type: string
      email:
        type: string
      first_name:
        type: string
      id:
        type: string
      last_name:
        type: string
      marketing_opt_in:
        type: boolean
      name:
        type: string
      phone:
        type: string
      position:
        type: string
    required:
      - id
      - create_date
      - change_date
    type: object
  Employee: {}
  Image: {}
  Order:
    properties:
      cart_id:
        type: string
      change_date:
        format: date-time
        type: string
      create_date:
        format: date-time
        type: string
      currency:
        type: string
      customer:
        $ref: "#/definitions/Customer"
      items:
        items:
          $ref: "#/definitions/OrderItem"
        minimum: 1
        type: array
      order_date:
        format: date-time
        type: string
      order_number:
        type: string
      previous_items:
        items:
          $ref: "#/definitions/OrderItem"
        type: array
      status:
        default: accepted
        enum:
          - accepted
        type: string
      subtotal:
        type: number
      total:
        type: number
      total_discounts:
        type: number
      total_payment_cost:
        type: number
      total_shipping:
        type: number
      total_tax:
        type: number
    required:
      - order_number
      - customer
      - order_date
      - create_date
      - change_date
      - status
      - subtotal
      - total
      - total_tax
      - total_shipping
      - total_payment_cost
      - total_discounts
      - currency
      - items
    type: object
  OrderCancelled:
    properties:
      cancel_date:
        format: date-time
        type: string
      order_number:
        type: string
      status:
        default: cancelled
        enum:
          - cancelled
        type: string
    required:
      - order_number
      - cancel_date
      - status
    type: object
  OrderItem:
    properties:
      change_date:
        format: date-time
        type: string
      create_date:
        format: date-time
        type: string
      discount_price:
        maximum: 9007199254740992
        minimum: 0
        type: number
      id:
        type: string
      order_item_number:
        type: string
      price:
        maximum: 9007199254740992
        minimum: 0
        type: number
      product:
        $ref: "#/definitions/Product"
      quantity:
        maximum: 9007199254740992
        minimum: -9007199254740992
        type: integer
      status:
        enum:
          - accepted
          - cancelled
    required:
      - id
      - create_date
      - change_date
      - order_item_number
      - quantity
      - status
      - price
      - discount_price
      - product
    type: object
  ParentCategory:
    properties:
      id:
        type: string
    required:
      - id
    type: object
  Product:
    properties:
      ancestors:
        items:
          type: string
        type: array
      attributes:
        items:
          $ref: "#/definitions/Attribute"
        type: array
        uniqueItems: true
      base_product:
        $ref: "#/definitions/BaseProduct"
      brand:
        type: string
      catalog:
        $ref: "#/definitions/Catalog"
      categories:
        items:
          $ref: "#/definitions/Category"
        type: array
        uniqueItems: true
      change_date:
        format: date-time
        type: string
      code:
        type: string
      create_date:
        format: date-time
        type: string
      id:
        type: string
      images:
        items:
          $ref: "#/definitions/Image"
        type: array
      is_order:
        type: boolean
      is_sku:
        type: boolean
      name:
        type: string
      rating:
        type: number
      urls:
        $ref: "#/definitions/Url"
      vendors:
        items:
          $ref: "#/definitions/Vendor"
        type: array
    required:
      - id
      - is_order
      - is_sku
      - code
      - create_date
      - change_date
    type: object
  Url:
    properties:
      admin:
        format: uri
        type: string
      store:
        format: uri
        type: string
    type: object
  Vendor:
    properties:
      id:
        type: string
      name:
        type: string
    type: object
  Visit:
    properties:
      last_pageview_id:
        type: string
      pageview_id:
        type: string
      visit_id:
        type: string
      visitor_id:
        type: string
    required:
      - visit_id
      - visitor_id
      - pageview_id
      - last_pageview_id
    type: object
