Newstore cart API

Operations on carts

OpenAPI Specification

newstore-cart-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  version: '1.0'
  title: NewStore address cart API
  description: NewStore public APIs
  contact:
    email: support@newstore.com
    name: NewStore API Support
    url: https://developer.newstore.com
host: dodici-demo.p.newstore.net
basePath: /
schemes:
- https
consumes:
- application/json
produces:
- application/json
security: []
tags:
- name: cart
  description: Operations on carts
paths:
  /checkout/carts:
    post:
      description: Creates a new empty cart.
      summary: createCart
      tags:
      - cart
      operationId: createCart
      deprecated: false
      produces:
      - application/problem+json
      consumes:
      - application/json
      parameters:
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/CreateCartRequestBody'
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '201':
          description: Created
          headers:
            Access-Control-Allow-Headers:
              type: string
            Access-Control-Allow-Methods:
              type: string
            Access-Control-Allow-Origin:
              type: string
            Access-Control-Expose-Headers:
              type: string
            Location:
              type: string
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
  /checkout/carts/{cartId}:
    get:
      description: Returns a cart by its ID.
      summary: showCart
      tags:
      - cart
      operationId: showCart
      deprecated: false
      produces:
      - application/problem+json
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '200':
          description: OK
          schema:
            $ref: '#/definitions/CartResource'
          headers: {}
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:read
    patch:
      description: Changes a cart.
      summary: updateCart
      tags:
      - cart
      operationId: updateCart
      deprecated: false
      produces:
      - application/problem+json
      consumes:
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/ChangeCartRequestBody'
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '200':
          description: OK
          headers:
            Access-Control-Allow-Headers:
              type: string
            Access-Control-Allow-Methods:
              type: string
            Access-Control-Allow-Origin:
              type: string
            Access-Control-Expose-Headers:
              type: string
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '409':
          description: Conflict
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
  /checkout/carts/{cartId}/items:
    post:
      description: Add a line item to a cart
      summary: createLineItem
      tags:
      - cart
      operationId: createLineItem
      deprecated: false
      produces:
      - application/problem+json
      - application/json
      consumes:
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/AddItemRequestBody'
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '201':
          description: Created
          schema:
            $ref: '#/definitions/AddItemResponseBody'
          headers:
            Access-Control-Allow-Headers:
              type: string
            Access-Control-Allow-Methods:
              type: string
            Access-Control-Allow-Origin:
              type: string
            Access-Control-Expose-Headers:
              type: string
            Location:
              type: string
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '409':
          description: Conflict
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
  /checkout/carts/{cartId}/items/{lineItemId}:
    delete:
      description: Removes a line item and all its add-ons from the cart.
      summary: destroyLineItem
      tags:
      - cart
      operationId: destroyLineItem
      deprecated: false
      produces:
      - application/problem+json
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      - name: lineItemId
        in: path
        required: true
        type: string
        description: Line Item ID
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '200':
          description: OK
          schema:
            $ref: '#/definitions/RemoveItemResponseBody'
          headers: {}
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '409':
          description: Conflict
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
    patch:
      description: Updates cart line item details
      summary: updateLineItem
      tags:
      - cart
      operationId: updateLineItem
      deprecated: false
      produces:
      - application/problem+json
      - application/json
      consumes:
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      - name: lineItemId
        in: path
        required: true
        type: string
        description: Line Item ID
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/ChangeItemRequestBody'
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '200':
          description: OK
          schema:
            $ref: '#/definitions/ChangeItemResponseBody'
          headers:
            Access-Control-Allow-Headers:
              type: string
            Access-Control-Allow-Methods:
              type: string
            Access-Control-Allow-Origin:
              type: string
            Access-Control-Expose-Headers:
              type: string
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '409':
          description: Conflict
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
  /checkout/carts/{cartId}/items/{lineItemId}/add-ons:
    post:
      description: Create an add-on for a line item on a cart
      summary: createAddOnLineItem
      tags:
      - cart
      operationId: createAddOnLineItem
      deprecated: false
      produces:
      - application/problem+json
      - application/json
      consumes:
      - application/json
      parameters:
      - name: cartId
        in: path
        required: true
        type: string
        description: Cart ID
      - name: lineItemId
        in: path
        required: true
        type: string
        description: Parent Line Item ID
      - name: Content-Type
        in: header
        required: false
        enum:
        - application/json
        type: string
        description: ''
      - name: body
        in: body
        required: true
        description: ''
        schema:
          $ref: '#/definitions/AddItemRequestBody'
      responses:
        default:
          description: Unexpected error not otherwise documented
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '201':
          description: Created
          schema:
            $ref: '#/definitions/AddItemResponseBody'
          headers:
            Access-Control-Allow-Headers:
              type: string
            Access-Control-Allow-Methods:
              type: string
            Access-Control-Allow-Origin:
              type: string
            Access-Control-Expose-Headers:
              type: string
            Location:
              type: string
        '400':
          description: Bad Request
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '404':
          description: Not Found
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '409':
          description: Conflict
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '422':
          description: Unprocessable Entity
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: Internal Server Error
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth:
        - checkout:carts:write
definitions:
  ExtendedAttribute:
    title: ExtendedAttribute
    type: object
    properties:
      name:
        description: Extended attribute name
        type: string
      value:
        description: Extended attribute value
        type: string
    required:
    - name
    - value
  CartLinks:
    title: CartLinks
    type: object
    properties:
      add_item:
        $ref: '#/definitions/Link'
      change_cart:
        $ref: '#/definitions/Link'
      items:
        $ref: '#/definitions/Link'
      self:
        $ref: '#/definitions/Link'
    required:
    - items
    - self
  ItemResource:
    title: ItemResource
    type: object
    properties:
      _links:
        $ref: '#/definitions/ItemLinks'
      add_ons:
        description: Item add-ons
        type: array
        items:
          $ref: '#/definitions/AddOnResource'
      epc:
        description: Electronic Product Code
        type: string
      extended_attributes:
        description: Extended attributes
        type: array
        items:
          $ref: '#/definitions/ExtendedAttribute'
      fulfillment:
        description: Fulfillment method, can be SHIPPING,IN_STORE_HANDOVER
        type: string
      id:
        description: Line ID
        type: string
      price:
        $ref: '#/definitions/ItemPrice'
      product_id:
        description: Item ID
        type: string
      quantity:
        description: Number of items in the line
        type: integer
        format: int32
      serial_number:
        description: Unique item serial number
        type: string
      source_id:
        description: Source identifier
        type: string
    required:
    - _links
    - add_ons
    - extended_attributes
    - id
    - price
    - product_id
    - quantity
  CreateCartRequestBody:
    title: CreateCartRequestBody
    type: object
    properties:
      associate_id:
        description: Associate ID
        example: 0196f384-9d57-72bc-b2ed-bf489d65719d
        type: string
        minLength: 1
      catalog:
        description: Catalog name
        example: storefront-catalog-en
        type: string
        minLength: 1
      channel_id:
        description: Channel ID (e.g. the store ID)
        example: US_BOSTON_01
        type: string
        minLength: 1
      channel_type:
        description: Channel type
        type: string
        default: STORE
      currency:
        description: Currency
        example: USD
        type: string
        pattern: ^[a-zA-Z]{3}$
      customer_id:
        description: Customer ID
        example: 0196f384-9d57-7190-9e3e-89d5816f5805
        type: string
        minLength: 1
      device_id:
        description: Device ID
        example: 0196f384-9d57-72bc-b2ed-bf489d65719d
        type: string
        minLength: 1
      locale:
        description: Catalog locale
        example: en_US
        type: string
        minLength: 1
    required:
    - associate_id
    - catalog
    - channel_id
    - channel_type
    - currency
    - locale
  ChangeItemResponseBody:
    title: ChangeItemResponseBody
    type: object
    properties:
      messages:
        type: array
        items:
          type: string
      warnings:
        type: array
        items:
          type: string
    required:
    - messages
    - warnings
  ItemLinks:
    title: ItemLinks
    type: object
    properties:
      add_add_on:
        $ref: '#/definitions/Link'
      add_ons:
        $ref: '#/definitions/Link'
      change_item:
        $ref: '#/definitions/Link'
      remove_item:
        $ref: '#/definitions/Link'
      self:
        $ref: '#/definitions/Link'
    required:
    - add_ons
    - self
  AddOnLinks:
    title: AddOnLinks
    type: object
    properties:
      change_add_on:
        $ref: '#/definitions/Link'
      remove_add_on:
        $ref: '#/definitions/Link'
      self:
        $ref: '#/definitions/Link'
    required:
    - self
  ChangeItemExtendedAttribute:
    title: ChangeItemExtendedAttribute
    type: object
    properties:
      name:
        example: engraving
        type: string
      value:
        example: For you.
        type: string
    required:
    - name
    - value
  AddItemRequestBody:
    title: AddItemRequestBody
    type: object
    properties:
      epc:
        example: 30A12BCDEF0123456789A1BCDEF01234
        type: string
      extended_attributes:
        type: array
        items:
          $ref: '#/definitions/AddItemExtendedAttribute'
        maxItems: 100
      fulfillment:
        type: object
        allOf:
        - $ref: '#/definitions/Fulfillment'
        - description: Fulfillment type
      price:
        $ref: '#/definitions/AddItemItemPrice'
      product_id:
        description: Product ID
        example: '1000761'
        type: string
      serial_number:
        example: ABC123
        type: string
      source_id:
        description: Source identifier
        example: gid://newstore/reservations/523/items/345
        type: string
    required:
    - product_id
  AddItemResponseBody:
    title: AddItemResponseBody
    type: object
    properties:
      messages:
        type: array
        items:
          type: string
        maxItems: 100
      warnings:
        type: array
        items:
          type: string
        maxItems: 100
    required:
    - messages
    - warnings
  AddItemExtendedAttribute:
    title: AddItemExtendedAttribute
    type: object
    properties:
      name:
        example: engraving
        type: string
      value:
        example: For you.
        type: string
    required:
    - name
    - value
  ChangeItemRequestBody:
    title: ChangeItemRequestBody
    type: object
    properties:
      extended_attributes:
        type: array
        items:
          $ref: '#/definitions/ChangeItemExtendedAttribute'
      fulfillment:
        type: object
        allOf:
        - $ref: '#/definitions/Fulfillment'
        - description: Fulfillment type
      source_id:
        description: Source identifier
        example: gid://newstore/reservations/523/items/345
        type: string
  Problem:
    title: Problem
    type: object
    properties:
      detail:
        description: A human readable explanation specific to this occurrence of the problem that is helpful to locate the problem and give advice on how to proceed. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
        example: some description for the error situation
        type: string
      error_code:
        type: string
      instance:
        description: A URI reference that identifies the specific occurrence of the problem, e.g. by adding a fragment identifier or sub-path to the problem type. May be used to locate the root of this problem in the source code.
        example: /some/uri-reference#specific-occurrence-context
        type: string
      message:
        type: string
      messages:
        type: array
        items:
          type: string
      request_id:
        type: string
      status:
        description: The HTTP status code generated by the origin server for this occurrence of the problem.
        type: integer
        minimum: 100.0
        maximum: 600.0
        exclusiveMaximum: true
        format: int32
      title:
        description: A short summary of the problem type. Written in English and readable for engineers, usually not suited for non technical stakeholders and not localized.
        example: some title for the error situation
        type: string
      type:
        description: A URI reference that uniquely identifies the problem type only in the context of the provided API. Opposed to the specification in RFC-7807, it is neither recommended to be dereferenceable and point to a human-readable documentation nor globally unique for the problem type.
        example: /some/uri-reference
        type: string
        default: about:blank
  ItemPrice:
    title: ItemPrice
    type: object
    properties:
      source:
        type: string
      source_id:
        type: string
    required:
    - source
    - source_id
  ChangeCartRequestBody:
    title: ChangeCartRequestBody
    type: object
    properties:
      customer_id:
        description: Customer ID
        example: 0196f384-9d57-7190-9e3e-89d5816f5805
        type: string
  RemoveItemResponseBody:
    title: RemoveItemResponseBody
    type: object
    properties:
      messages:
        description: Informational messages
        type: array
        items:
          type: string
      warnings:
        description: Warning messages
        type: array
        items:
          type: string
    required:
    - messages
    - warnings
  CartResource:
    title: CartResource
    type: object
    properties:
      _links:
        $ref: '#/definitions/CartLinks'
      associate_id:
        description: Associate ID
        type: string
      catalog:
        description: Catalog name
        type: string
      channel_id:
        description: Channel ID, corresponds to the store ID if channel_type is STORE
        type: string
      channel_type:
        description: Channel type (e.g. STORE)
        type: string
      currency:
        description: ISO 4217 currency code
        type: string
      customer_id:
        description: Customer ID
        type: string
      device_id:
        description: Device ID
        type: string
      id:
        description: Cart ID
        type: string
      items:
        type: array
        items:
          $ref: '#/definitions/ItemResource'
      locale:
        description: Catalog locale
        type: string
      state:
        description: Cart state
        type: string
    required:
    - _links
    - associate_id
    - catalog
    - channel_id
    - channel_type
    - currency
    - id
    - items
    - locale
    - state
  Fulfillment:
    title: Fulfillment
    description: Fulfillment type
    type: string
    enum:
    - SHIPPING
    - IN_STORE_HANDOVER
  AddItemItemPrice:
    title: AddItemItemPrice
    type: object
    properties:
      source:
        type: object
        allOf:
        - $ref: '#/definitions/Source'
        - description: Price source
          example: INTERNAL
      source_id:
        description: Price source ID, e.g. name of pricebook
        example: default
        type: string
  Source:
    title: Source
    description: Price source
    example: INTERNAL
    type: string
    enum:
    - INTERNAL
    - internal
  Link:
    title: Link
    type: object
    properties:
      href:
        description: Resource URI
        type: string
      method:
        description: Request method
        type: string
    required:
    - href
  AddOnResource:
    title: AddOnResource
    type: object
    properties:
      _links:
        $ref: '#/definitions/AddOnLinks'
      extended_attributes:
        description: Extended attributes
        type: array
        items:
          $ref: '#/definitions/ExtendedAttribute'
      fulfillment:
        description: Fulfillment method, can be SHIPPING,IN_STORE_HANDOVER
        type: string
      id:
        description: Line ID
        type: string
      price:
        $ref: '#/definitions/ItemPrice'
      product_id:
        description: Item ID
        type: string
      quantity:
        description: Number of items in the line
        type: integer
        format: int32
      source_id:
        description: Source identifier
        type: string
    required:
    - _links
    - extended_attributes
    - id
    - price
    - product_id
    - quantity
securityDefinitions:
  oauth:
    type: oauth2
    flow: application
    tokenUrl: https://id.p.newstore.net/auth/realms/dodici-demo/protocol/openid-connect/token
    scopes:
      catalog:import-schemas:read: Grants privileges to read import schema
      catalog:import-schemas:write: Grants privileges to write import schema
      catalog:pricebook-export:read: Grants privileges to export pricebook data
      catalog:product-export:read: Grants privileges to export product data
      checkout:carts:read: Grants privileges to read cart data
      checkout:carts:write: Grants privileges to write cart data
      clienteling:profile:read: Grants privileges to read clienteling profiles
      customer:profile:read: Grants privileges to read API customer data
      customer:profile:write: Grants privileges to modify API customer data
      newstore:configuration:read: Grants privileges to read configuration
      newstore:configuration:write: Grants privileges to write configuration
      fiscalization:orders:read: View orders with fiscal transactions and signatures
      fiscalization:orders:write: Create orders with fiscal transactions and signatures
      shipments:read: Read Shipping Options and Audits
      iam:providers:read: ' Grants read privileges to provider resources'
      iam:providers:write: ' Grants write privileges to provider resources'
      iam:roles:read: ' Grants privileges to read roles data'
      iam:roles:write: ' Grants privileges to write roles data'
      iam:users:read: ' Grants privileges to read user data'
      iam:users:write: ' Grants privileges to write user data'
      inventory:reservations:read: Allows access to retrieve reservations
      inventory:reservations:write: Allows access to create and update reservations
      promotions:config:read: Grants privileges to read configuration
      promotions:config:write: Grants privileges to write into configuration
      promotions:reason-codes:read: Grants privileges to list reason codes
      promotions:reason-codes:write: Grants privileges to create and update reason codes
      audit-events:read: Grants read access to the tenant's audit events.
      taxes:preview-transactions:write: Preview tax transactions
      taxes:transactions:read: Read tax transactions