swagger , file example, how to generate sample payload or json.

 SwaggerEditor


it also genarets the sample , json payload.






{
  "openapi": "3.0.0",
  "info": {
    "title": "3PL interfaces",
    "version": "1.0.0",
    "description": " "
  },
  "servers": [
    {
      "url": "http://dev:3000/local"
    },
    {
      "url": "http://qa:3000/local"
    }
  ],
  "paths": {
    "/stockBalance": {
      "post": {
        "tags": [
          "stockBalance"
        ],
        "summary": "Call this API for stockBalance events",
        "description": "Call this API for stockBalance events",
        "parameters": [
          {
            "name": "traceId",
            "in": "header",
            "description": "Client traceId",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "companyCode",
            "in": "header",
            "description": "companyCode",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "sourceType",
            "in": "header",
            "description": "sourceType",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "location",
            "in": "header",
            "description": "location",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "name1",
            "in": "header",
            "description": "name1",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "name2",
            "in": "header",
            "description": "name2",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "houseNumber",
            "in": "header",
            "description": "houseNumber",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "street1",
            "in": "header",
            "description": "street1",
            "required": false,
            "schema": {
              "type": "string"
            }
          },{
            "name": "street2",
            "in": "header",
            "description": "street2",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "postalCode",
            "in": "header",
            "description": "postalCode",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
       {
            "name": "poBox",
            "in": "header",
            "description": "poBox",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
       {
            "name": "city",
            "in": "header",
            "description": "city",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
       {
            "name": "state",
            "in": "header",
            "description": "state",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
       {
            "name": "country",
            "in": "header",
            "description": "country",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "phone",
            "in": "header",
            "description": "phone",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "globalLocationNumber",
            "in": "header",
            "description": "globalLocationNumber",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
      {
            "name": "stockBalanceDate",
            "in": "header",
            "description": "stockBalanceDate",
            "required": true,
            "schema": {
              "type": "string",
              "example": "2024-12-26T10:18:32UTC+00:00"
            }
          },
      {
            "name": "source",
            "in": "header",
            "description": "source",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
       {
            "name": "stockBalanceName",
            "in": "header",
            "description": "stockBalanceName",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
       "requestBody": {
          "required": true,
          "content": {
            "application/gzip": {
              "schema": {
                 
                  "type": "string",
                  "format": "binary"
                   
                  }
                }
              }
           
         
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Success"
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameter in the request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClientError"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ObjectValue": {
        "type": "object"
      },
      "ArrayValue": {
        "type": "array",
        "items": {
          "type": "object"
        }
      },
      "Success": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "SUCCESS"
          },
          "message": {
            "type": "string",
            "example": "Message correctly sent"
          },
          "traceId": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "message"
        ]
      },
      "ServerError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "SERVER_ERROR"
          },
          "message": {
            "type": "string",
            "example": "System is not able to process the message, retry later or contact the support."
          },
          "errorDetails": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObjectValue"
              },
              {
                "$ref": "#/components/schemas/ArrayValue"
              }
            ]
          },
          "traceId": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "message",
          "errorDetails"
        ]
      },
      "ClientError": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "BAD_REQUEST"
          },
          "message": {
            "type": "string",
            "example": "Field xxx is missing or invalid"
          },
          "errorDetails": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ObjectValue"
              },
              {
                "$ref": "#/components/schemas/ArrayValue"
              }
            ]
          },
          "traceId": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "message",
          "errorDetails"
        ]
      },
      "stockBalance": {
        "type": "object",
          "properties": {
          "stockBalance": {
            "$ref": "#/components/schemas/stockBalanceMain",
            "description": "Array of stock balance"
            }
          }
        },
        "stockBalanceMain": {
        "type": "object",
        "properties": {
          "companyCode": {
            "type": "string",
            "description": "Company code",
            "example": "123"
          },
          "sourceType": {
            "type": "string",
            "description": "Type of location in the source entity",
            "example": "PLANT"
          },
                 
        "Source": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "Identification of the partner",
            "example": "RCA"
          },
          "name1": {
            "type": "string",
            "description": "Name of the partner",
            "example": "Royal Canin S.A.S (Cambrai)"
          },
          "name2": {
            "type": "string",
            "description": "Name of the partner",
            "example": " "
          },
          "houseNumber": {
            "type": "string",
            "description": "House number",
            "example": " "
          },  
          "street1": {
            "type": "string",
            "description": "Street",
            "example": "Rue Basse, France"
          },
          "street2": {
            "type": "string",
            "description": "Street",
            "example": "Les Rues des Vignes"
          },
          "postalCode": {
            "type": "string",
            "description": "ZIP code, Postal code",
            "example": "59258"
          },
          "poBox": {
            "type": "string",
            "description": "PO Box",
            "example": " "
          },
          "city": {
            "type": "string",
            "description": "City",
            "example": "Cambrai"
          },
          "state": {
            "type": "string",
            "description": "State",
            "example": " "
          },
          "country": {
            "type": "string",
            "description": "Country",
            "example": "Cambrai"
          },
          "phone": {
            "type": "string",
            "description": "Phone number",
            "example": " "
          },
          "globalLocationNumber": {
            "type": "string",
            "description": "Global location number ",
            "example": "4006561000325"
          }  
        }
      },
          "stockBalanceDate": {
           "type": "string",
           "description": "Date when the stock balance was issued in the WMS side (in the local timezone)",
           "example": "2024-01-25T10:30:25UTC+00:00"
          },
          "stockBalanceName": {
            "type": "string",
            "description": "Name of the partner",
            "example": "RCA stock balance"
          },
               
           "items": {
            "type": "object",
            "description": "Item details",
            "properties": {
              "item": {
                "type": "array",
                "description": "Items records",
                "items": {
                  "$ref": "#/components/schemas/Item"
                }
              }
            }
          }
         }
},
         
         
       "Item": {
        "type": "object",
        "properties": {
          "advancedShippingNotification": {
            "type": "string",
            "description": "Reference of the in transit document",
            "example": " "
          },
      "baseUom": {
            "type": "string",
            "description": "Base unit of measure",
            "example": "EA"
          },
          "batch": {
            "type": "string",
            "description": "Batch number in the Mars GBC format",
            "example": "18564004RCA"
          },
          "batchAvailabilityDate": {
            "type": "string",
            "description": "Date when the batch should be ready in the warehouse to be picked",
            "example": " "
          },
      "bestBeforeDate": {
            "type": "string",
            "description": "Shelf Life Expiration or Best-Before Date",
            "example": "2024-10-28T23:01:14UTC+00:00"
          },
          "certifcateNumber": {
            "type": "string",
            "description": "Certificate",
            "example": " "
          },
      "conversionFactorToBuom": {
            "type": "string",
            "description": "Conversion factor to convert quantity in sales UOM to base UOM",
            "example": " "
          },
          "itemDescription": {
            "type": "string",
            "description": "Description of the item",
            "example": "Material Description 1"
          },
          "itemPosition": {
            "type": "string",
            "description": "Position of the item",
            "example": "1"
          },
          "lastUpdateDate": {
            "type": "string",
            "description": "Timestamp when the quantity of product in the pallet was last updated in the WMS  - this field is only relevant for Agnostic site - it is available in the Experience API but not the core API",
            "example": " "
          },
          "localPalletId": {
            "type": "string",
            "description": "local pallet number   - License Plate Number (LPN) or reference number used to identify the pallet instead of or in addition to SSCC - this field is only relevant for Agnostic site - it is available in the Experience API but not the core API",
            "example": "1235467890"
          },
          "localReferenceNumber": {
            "type": "string",
            "description": "Local Lot Number or reference number used at the factory, if any -  this field is only relevant for Agnostic site - it is available in the Experience API but not the core API",
            "example": " "
          },
          "materialReference": {
            "type": "string",
            "description": "Reference identifying the product",
            "example": "1002000500"
          },
          "materialType": {
            "type": "string",
            "description": "Material Type",
            "example": "FG"
          },
          "positiveRelease": {
            "type": "string",
            "description": "PHR Status of the pallet",
            "example": "Released"
          },
          "positiveReleaseDate": {
            "type": "string",
            "description": "Modification date of PHR Status",
            "example": "2023-12-17T23:01:14UTC+00:00"
          },
          "productionDate": {
            "type": "string",
            "description": "Production Date of the batch",
            "example": "2023-12-10T23:01:14UTC+00:00"
          },                
          "productLifeCycleStatus": {
            "type": "string",
            "description": "productLifeCycleStatus",
            "example": " "
          },
          "qualityStatus": {
            "type": "string",
            "description": "Quality status of the pallet  from a QFS perspetive (tbc)?",
            "example": "Released"
          },
          "quantityInAuom": {
            "type": "string",
            "description": "Quantity in an alternative unit of measure (base or not)",
            "example": "1908"
          },          
          "quantityInBuom": {
            "type": "string",
            "description": "Quantity in base unit of measure ",
            "example": "1908"
          },
          "ssccNumber": {
            "type": "string",
            "description": "Serial Shipping Container Code (handling unit)",
            "example": "031825520046241281"
          },
          "startProductionDate": {
            "type": "string",
            "description": "date when the production started (production goods receipt of the SSCC)",
            "example": "2023-12-10T23:01:00UTC+00:00"
          },
          "stockBalanceItemtype": {
            "type": "string",
            "description": "category of the location for a stock balance item line",
            "example": "Storage Location"
          },
          "stockType": {
            "type": "string",
            "description": "Type of stock",
            "example": " "
          },
          "storageLocation": {
            "type": "string",
            "description": "Storage location",
            "example": "RCA-Loc"
          },
          "uomCode": {
            "type": "string",
            "description": "Sales unit of measure",
            "example": "EA"
          },
          "vendorLocation": {
            "type": "string",
            "description": "Vendor when stock is located at a vendor location",
            "example": " "
          },
          "wmsQualityStatus": {
            "type": "string",
            "description": "Quality status of the pallet from a WMS perspective",
            "example": "PHR"
          }
         
        }
      }        
      }
  }
   
}

Popular posts from this blog

SAP CPI : camle expression in sap cpi , cm, router, filter and groovy script. format

SAP CPI camel conditions and xpath conditions

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024