Newstore stock API

Stock Operations

OpenAPI Specification

newstore-stock-api-openapi.yml Raw ↑
swagger: '2.0'
info:
  version: '1.0'
  title: NewStore address stock 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: stock
  description: Stock Operations
paths:
  /v0/stock/insights:
    get:
      description: "\n<div style=\"background-color: rgba(23, 162, 184, 0.15); border: 1px solid #17a2b8; border-left: 4px solid #17a2b8; padding: 12px; margin: 10px 0; border-radius: 4px; color: #17a2b8;\">\n  <strong>ℹ️ Rate Limit:</strong> This endpoint is rate limited to 90 requests per second.\n</div>\n\nRetrieves the allocations and reservations by ATP keys in your business.\n"
      summary: listAtpInsights
      tags:
      - stock
      operationId: listAtpInsights
      deprecated: false
      produces:
      - application/json
      - application/problem+json
      parameters:
      - name: product_id
        in: query
        required: true
        type: string
        description: The product ID of the item.
      - name: fulfillment_node_id
        in: query
        required: true
        type: string
        description: The fulfillment node ID of the store/warehouse.
      responses:
        default:
          description: Unexpected Error
          headers: {}
        '200':
          description: Successfully retrieved the allocations and reservations by ATP key.
          schema:
            $ref: '#/definitions/AtpInsightsResponse'
          examples:
            application/json:
              allocations:
              - created_at: '2022-01-31T20:00:00Z'
                item_uuid: 3409090f-1881-486e-9e2d-2278020e5655
                order_uuid: 5ca1548c-d228-4f98-a54e-c54bbba0a204
              - created_at: '2022-01-31T20:00:00Z'
                item_uuid: 236a3594-2db2-4491-a5b4-9741ce680b03
                order_uuid: 5ca1548c-d228-4f98-a54e-c54bbba0a204
              fulfillment_node_id: US01
              future_allocations:
              - created_at: '2022-01-31T20:00:00Z'
                item_uuid: aaf13724-94a3-11ec-b909-0242ac120002
                order_uuid: 017b8d63-76a8-46fc-b53a-4e2af8594427
              - created_at: '2022-01-31T20:00:00Z'
                item_uuid: ba44378a-94a3-11ec-b909-0242ac120002
                order_uuid: 017b8d63-76a8-46fc-b53a-4e2af8594427
              product_id: '10000102'
              reservations:
              - created_at: '2022-01-31T20:00:00Z'
                expires_at: '2022-01-31T20:30:00Z'
                item_uuid: 3409090f-1881-486e-9e2d-2278020e5655
                order_uuid: 5ca1548c-d228-4f98-a54e-c54bbba0a204
              - created_at: '2022-01-31T20:00:00Z'
                expires_at: '2022-01-31T20:30:00Z'
                item_uuid: 236a3594-2db2-4491-a5b4-9741ce680b03
                order_uuid: 5ca1548c-d228-4f98-a54e-c54bbba0a204
          headers: {}
        '400':
          description: Invalid request.
          schema:
            $ref: '#/definitions/Problem'
          examples:
            application/problem+json:
              message: '''product_id'' is a required parameter.'
              request_id: 1235a3d3-1884-4e95-9926-d7253edb4f7f
          headers: {}
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/Problem'
          headers:
            Retry-After:
              type: string
        '500':
          description: An internal error occurred.
          schema:
            $ref: '#/definitions/Problem'
          examples:
            application/problem+json:
              message: Human readable error message
              request_id: 1235a3d3-1884-4e95-9926-d7253edb4f7f
          headers: {}
        '502':
          description: Bad Gateway
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
        '503':
          description: Service Unavailable
          schema:
            $ref: '#/definitions/Problem'
          headers: {}
      security:
      - oauth: []
definitions:
  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
  Allocation:
    title: Allocation
    type: object
    properties:
      created_at:
        description: Timestamp at which allocation was created
        type: string
        format: date-time
      item_uuid:
        description: The uuid of the order item.
        type: string
        minLength: 36
        maxLength: 36
      order_uuid:
        description: The uuid of the order.
        type: string
        minLength: 36
        maxLength: 36
    required:
    - created_at
    - item_uuid
    - order_uuid
  AtpInsightsResponse:
    title: AtpInsightsResponse
    description: Limited response of valid request for fetching allocations by ATP keys.
    type: object
    properties:
      allocations:
        description: Allocations for the product with given product_id at the fulfillment node with given fulfillment_node_id. This request will limit the response to a maximum of 2000 allocations.
        type: array
        items:
          $ref: '#/definitions/Allocation'
        maxItems: 1000
      fulfillment_node_id:
        description: The fulfillment node ID of the store/warehouse.
        type: string
      future_allocations:
        description: Future allocations for the product with given product_id at the fulfillment node with given fulfillment_node_id. This request will limit the response to a maximum of 2000 allocations.
        type: array
        items:
          $ref: '#/definitions/FutureAllocation'
        maxItems: 1000
      product_id:
        description: The product ID of the item.
        type: string
      reservations:
        description: Reservations for the product with given product_id at the fulfillment node with given fulfillment_node_id. This request will limit the response to a maximum of 2000 reservations.
        type: array
        items:
          $ref: '#/definitions/Reservation'
        maxItems: 1000
    required:
    - allocations
    - fulfillment_node_id
    - product_id
  FutureAllocation:
    title: FutureAllocation
    type: object
    properties:
      created_at:
        description: Timestamp at which reservation was created
        type: string
        format: date-time
      item_uuid:
        description: The uuid of the order item.
        type: string
        minLength: 36
        maxLength: 36
      order_uuid:
        description: The uuid of the order.
        type: string
        minLength: 36
        maxLength: 36
    required:
    - created_at
    - item_uuid
    - order_uuid
  Reservation:
    title: Reservation
    type: object
    properties:
      created_at:
        description: Timestamp at which reservation was created
        type: string
        format: date-time
      expires_at:
        description: Timestamp at which reservation will expire
        type: string
        format: date-time
      item_uuid:
        description: The uuid of the order item.
        type: string
        minLength: 36
        maxLength: 36
      order_uuid:
        description: The uuid of the order.
        type: string
        minLength: 36
        maxLength: 36
    required:
    - created_at
    - expires_at
    - item_uuid
    - order_uuid
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