Sparetech ChangeIntent API

The ChangeIntent API from Sparetech — 4 operation(s) for changeintent.

OpenAPI Specification

sparetech-changeintent-api-openapi.yml Raw ↑
openapi: 3.0.2
info:
  title: Sync Authentication ChangeIntent API
  version: 0.2.0
  description: '# Authorization


    <!-- Redoc-Inject: <security-definitions> -->

    '
  contact: {}
  x-logo:
    url: https://app.sparetech.io/img/sparetech-logo.png
    backgroundColor: '#FFFFFF'
    altText: Sparetech logo
servers:
- url: https://sync.sparetech.io/v1
  description: Production environment
- url: https://sync.sandbox.sparetech.io/v1
  description: Sandbox environment
tags:
- name: ChangeIntent
paths:
  /change-intents:
    get:
      summary: List all ChangeIntents
      tags:
      - ChangeIntent
      responses:
        '200':
          description: A dictionary with a `changeIntents` property that contains an array of up to `limit` ChangeIntents.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeIntents'
        '404':
          description: Change intent {id} couldn't be found
      operationId: getChangeIntents
      description: Returns a list of ChangeIntents.
      security:
      - Token: []
      parameters:
      - name: status
        in: query
        schema:
          $ref: '#/components/schemas/ChangeIntentStatus'
        description: Only returns intents in the given status.
      - name: created.gt
        in: query
        schema:
          type: string
          format: date
        example: '2022-12-10'
        description: A filter based on the object's `createdAt` field. Return results where the field is greater than or equal to this value. Follows the ISO-8601 standard format.
      - name: created.lt
        in: query
        schema:
          type: string
          format: date
        example: '2022-12-13'
        description: A filter based on the object's `createdAt` field. Return results where the field is less than or equal to this value. Follows the ISO-8601 standard format.
      - name: limit
        in: query
        schema:
          type: integer
          default: 10
        description: A limit on the number of objects to be returned. Limit can range between 1 and 99, and the default is 10.
      - name: page
        in: query
        schema:
          type: integer
          default: 0
        description: A cursor for pagination across multiple pages of results.
      - name: changes.only
        in: query
        schema:
          type: boolean
          default: true
        description: If true, this endpoint only returns fields that have changes as part of the `metadata` property of the `changeIntents` property. This is the default behaviour, mimicking a patch.
      x-validator: true
  /change-intents/{id}:
    parameters:
    - name: id
      in: path
      schema:
        type: string
      required: true
    - name: changes.only
      in: query
      schema:
        type: boolean
        default: true
      description: If true, this endpoint only returns fields that have changes as part of the `metadata` property. This is the default behaviour, mimicking a patch.
    get:
      summary: Retrieve a ChangeIntent
      description: Retrieves the details of a ChangeIntent that has previously been created.
      security:
      - Token: []
      tags:
      - ChangeIntent
      responses:
        '200':
          description: A `ChangeIntent` if a valid `id` was provided.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChangeIntent'
        '404':
          description: Change intent {id} couldn't be found
      operationId: getChangeIntent
      x-validator: true
  /change-intents/{id}/confirm:
    parameters:
    - name: id
      in: path
      schema:
        type: string
      required: true
    post:
      summary: Confirm material change
      description: Confirms the change to the material.
      security:
      - Token: []
      tags:
      - ChangeIntent
      operationId: applyChangeIntent
      responses:
        '200':
          description: OK
        '404':
          description: Change intent {id} couldn't be found
      x-validator: true
  /change-intents/{id}/reject:
    parameters:
    - name: id
      in: path
      schema:
        type: string
      required: true
    post:
      summary: Reject material change
      description: Marks the intent as rejected by the external system.
      tags:
      - ChangeIntent
      operationId: rejectChangeIntent
      security:
      - Token: []
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RejectComment'
      responses:
        '200':
          description: OK
        '404':
          description: Change intent {id} couldn't be found
      x-validator: true
components:
  schemas:
    ChangeIntentStatus:
      title: ChangeIntentStatus
      type: string
      x-stoplight:
        id: lp1e4gqdhcrni
      x-examples:
        example-1:
          id: string
      enum:
      - Ready
      - Done
      description: Status of the object. Possible values are `Ready` when the change is ready to be reflected in external  system and `Done` when the changes have been applied in SPARETECH and in the external system.
      example: Done
    RejectComment:
      title: RejectComment
      type: object
      properties:
        message:
          type: string
          description: Short description of the reason for rejecting the intent.
      required:
      - message
    ChangeIntents:
      title: ChangeIntents
      type: object
      properties:
        hasMore:
          type: boolean
          example: true
          description: Whether or not more intents are available after this set. If `false`, this set comprises the end of the results.
        totalCount:
          type: number
          example: 2
          description: Total number of intents available to retrieve, given the provided parameters.
        limit:
          type: integer
          example: 1
          description: The maximum number of items the `changeIntents` list can have.
        page:
          type: integer
          example: 0
          description: Current cursor of pagination across multiple pages of results.
        changeIntents:
          type: array
          items:
            $ref: '#/components/schemas/ChangeIntent'
      required:
      - hasMore
      - totalCount
      - limit
      - page
      - changeRequests
    ApprovedBy:
      title: ApprovedBy
      type: object
      properties:
        email:
          type: string
          example: approver@example.com
          description: Email of the approver
      required:
      - email
    CreatedBy:
      title: CreatedBy
      type: object
      properties:
        email:
          type: string
          example: creator@example.com
          description: Email of the creator
      required:
      - email
    ChangeIntent:
      title: ChangeIntent
      type: object
      properties:
        id:
          type: string
          example: '904136'
          description: Unique identifier for the intent object.
        createdAt:
          type: string
          example: '2022-12-10T12:05:12Z'
          description: Time at which the object was created. Follows the ISO-8601 standard format.
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        approvedBy:
          $ref: '#/components/schemas/ApprovedBy'
        status:
          $ref: '#/components/schemas/ChangeIntentStatus'
        materialNumber:
          type: string
          example: '79850030905'
          description: Identifier of the material to which the changes will be applied to.
        plant:
          type: string
          example: ''
          description: Plant of material being changed
        metadata:
          type: object
          example:
            MANU: Sparetech
            ART_NUM: SED1234
            TYP: TYP_1234
            DESC: Material Description
          description: Object containing material specific fields. The fields in this object are configuration specific and  are based on the export configuration. Only fields with changes will be returned.
      required:
      - id
      - status
      - metadata
      - materialNumber
      - createdBy
  securitySchemes:
    Token:
      description: This API uses JWT for authorization. SPARETECH will provide your client credentials, that are specific to each organisation and integration environment. See the Authentication section of this documentation for details on how to obtain a token.
      type: http
      scheme: bearer
      bearerFormat: JWT
    ClientCredentials:
      type: http
      scheme: basic
x-stoplight:
  id: gfa4jhd050w9x