Create package

POST /OrderPackage/CreatePackage — OMS API · Packages

Adds a shipment package to a previously saved order.

When to call: If you saved the order without packages or if a new package was created later.

  • The order is found by matching both sourceOrderId and sourceOrderNumber (corresponding to orderId and orderNumber in SaveOrders).
  • packageItems[].sourceOrderItemId must belong to an item in the order.
  • If the order is not found, returns HTTP 200, isSuccess: false, errorMesssage: "Order Not Found !!".
  • Each successful package is listed inside items[] with itemCode = sourcePackageId.

İstek gövdesi

  • packages (object[]): Packages to be added.
    • packages.cargoKey (string): Cargo key.
    • packages.lastStatus (string): Last status of the package in the source system.
    • packages.vendorCode (string): Seller code who will send the package. When called with a seller user, all packages must belong to that seller.
    • packages.trackingURL (string): Cargo tracking link.
    • packages.packageItems (object[], zorunlu): Items included in the package.
      • packages.packageItems.vatRate (number<double>): VAT rate.
      • packages.packageItems.quantity (integer<int32>): Quantity included in this package.
      • packages.packageItems.saleTotal (number<double>): Sales amount allocated to the package.
      • packages.packageItems.vendorSku (string): Seller's own SKU code.
      • packages.packageItems.sourceOrderItemId (string, zorunlu): items[].sourceOrderItemId value of the order item included in this package.
      • packages.packageItems.packageItemAttributes (object[]): Additional fields for the package item.
    • packages.subVendorCode (string): Sub-seller code.
    • packages.deliveryMethod (integer<int32>): Delivery method. 0 = delivery by cargo (default).
    • packages.erpOrderNumber (string): ERP order number of the package.
    • packages.invoiceAddress (object, zorunlu): Invoice address.
      • packages.invoiceAddress.phone (string, zorunlu): Phone number.
      • packages.invoiceAddress.region (string): Region information.
      • packages.invoiceAddress.isValid (boolean): Whether the address is verified.
      • packages.invoiceAddress.zipCode (string, zorunlu): Postal code.
      • packages.invoiceAddress.cityCode (string): City code.
      • packages.invoiceAddress.cityName (string, zorunlu): City name.
      • packages.invoiceAddress.lastName (string, zorunlu): Recipient's last name.
      • packages.invoiceAddress.firstName (string, zorunlu): Recipient's first name.
      • packages.invoiceAddress.stateCode (string): State/region code.
      • packages.invoiceAddress.stateName (string): State/region name (for international addresses).
      • packages.invoiceAddress.taxNumber (string): Tax number (for corporate invoices).
      • packages.invoiceAddress.taxOffice (string): Tax office (for corporate invoices).
      • packages.invoiceAddress.streetCode (string): Street code.
      • packages.invoiceAddress.streetName (string): Street name.
      • packages.invoiceAddress.addressType (string, zorunlu): Address type: Shipment (delivery) or Invoice (billing).
      • packages.invoiceAddress.companyName (string): Company name (for corporate invoices).
      • packages.invoiceAddress.countryName (string, zorunlu): Country name.
      • packages.invoiceAddress.phonePrefix (string): Phone country code prefix.
      • packages.invoiceAddress.addressLine1 (string, zorunlu): Address line 1.
      • packages.invoiceAddress.addressLine2 (string, zorunlu): Address line 2. This field is mandatory; if no second line, send a value like -.
      • packages.invoiceAddress.buildingCode (string): Building code.
      • packages.invoiceAddress.districtCode (string): District code.
      • packages.invoiceAddress.districtName (string, zorunlu): District name.
      • packages.invoiceAddress.provinceName (string): Province name (for international addresses).
      • packages.invoiceAddress.identityNumber (string): Identity number (for individual invoices).
      • packages.invoiceAddress.sourceAddressId (string, zorunlu): Identifier of the address in your system; must be unique within the order (can be values like 1, 2).
      • packages.invoiceAddress.externalCityCode (string): External system code for the city.
      • packages.invoiceAddress.formattedAddress (string): Formatted full address text.
      • packages.invoiceAddress.neighborhoodCode (string): Neighborhood code.
      • packages.invoiceAddress.addressAttributes (object[]): Additional fields for the address.
      • packages.invoiceAddress.externalStateCode (string): External system code for the state/region.
      • packages.invoiceAddress.neighbourhoodName (string): Neighborhood name.
      • packages.invoiceAddress.externalStreetCode (string): External system code for the street.
      • packages.invoiceAddress.externalAddressCode (string): External system code for the address.
      • packages.invoiceAddress.externalBuildingCode (string): External system code for the building.
      • packages.invoiceAddress.externalDistrictCode (string): External system code for the district.
      • packages.invoiceAddress.externalNeighborhoodCode (string): External system code for the neighborhood.
    • packages.trackingNumber (string): Cargo tracking number.
    • packages.shipmentAddress (object): Delivery address. Must be sent for delivery by cargo (deliveryMethod 0); otherwise, invoice address is used.
      • packages.shipmentAddress.phone (string, zorunlu): Phone number.
      • packages.shipmentAddress.region (string): Region information.
      • packages.shipmentAddress.isValid (boolean): Whether the address is verified.
      • packages.shipmentAddress.zipCode (string, zorunlu): Postal code.
      • packages.shipmentAddress.cityCode (string): City code.
      • packages.shipmentAddress.cityName (string, zorunlu): City name.
      • packages.shipmentAddress.lastName (string, zorunlu): Recipient's last name.
      • packages.shipmentAddress.firstName (string, zorunlu): Recipient's first name.
      • packages.shipmentAddress.stateCode (string): State/region code.
      • packages.shipmentAddress.stateName (string): State/region name (for international addresses).
      • packages.shipmentAddress.taxNumber (string): Tax number (for corporate invoices).
      • packages.shipmentAddress.taxOffice (string): Tax office (for corporate invoices).
      • packages.shipmentAddress.streetCode (string): Street code.
      • packages.shipmentAddress.streetName (string): Street name.
      • packages.shipmentAddress.addressType (string, zorunlu): Address type: Shipment (delivery) or Invoice (billing).
      • packages.shipmentAddress.companyName (string): Company name (for corporate invoices).
      • packages.shipmentAddress.countryName (string, zorunlu): Country name.
      • packages.shipmentAddress.phonePrefix (string): Phone country code prefix.
      • packages.shipmentAddress.addressLine1 (string, zorunlu): Address line 1.
      • packages.shipmentAddress.addressLine2 (string, zorunlu): Address line 2. This field is mandatory; if no second line, send a value like -.
      • packages.shipmentAddress.buildingCode (string): Building code.
      • packages.shipmentAddress.districtCode (string): District code.
      • packages.shipmentAddress.districtName (string, zorunlu): District name.
      • packages.shipmentAddress.provinceName (string): Province name (for international addresses).
      • packages.shipmentAddress.identityNumber (string): Identity number (for individual invoices).
      • packages.shipmentAddress.sourceAddressId (string, zorunlu): Identifier of the address in your system; must be unique within the order (can be values like 1, 2).
      • packages.shipmentAddress.externalCityCode (string): External system code for the city.
      • packages.shipmentAddress.formattedAddress (string): Formatted full address text.
      • packages.shipmentAddress.neighborhoodCode (string): Neighborhood code.
      • packages.shipmentAddress.addressAttributes (object[]): Additional fields for the address.
      • packages.shipmentAddress.externalStateCode (string): External system code for the state/region.
      • packages.shipmentAddress.neighbourhoodName (string): Neighborhood name.
      • packages.shipmentAddress.externalStreetCode (string): External system code for the street.
      • packages.shipmentAddress.externalAddressCode (string): External system code for the address.
      • packages.shipmentAddress.externalBuildingCode (string): External system code for the building.
      • packages.shipmentAddress.externalDistrictCode (string): External system code for the district.
      • packages.shipmentAddress.externalNeighborhoodCode (string): External system code for the neighborhood.
    • packages.sourcePackageId (string, zorunlu): Unique identifier of the package in your system. A package sent twice with the same ID is skipped.
    • packages.deliverySlotCode (string): Delivery time slot code (maximum 50 characters).
    • packages.lastModifiedDate (string<date-time>): Last modification time of the package. If not sent, the request time is used.
    • packages.cargoIsChangeable (boolean): Whether the cargo company can be changed later.
    • packages.packageAttributes (object[]): Additional fields for the package.
      • packages.packageAttributes.attributeKey (string, zorunlu): Additional field name.
      • packages.packageAttributes.attributeValue (string, zorunlu): Additional field value.
    • packages.carrierCompanyCode (string): Cargo company code.
    • packages.erpOrderCreateDate (string<date-time>): Order creation time in ERP.
    • packages.deliveryServiceType (string): Delivery service type. Can be left empty; if filled, must be one of the listed values, otherwise the order is rejected (case insensitive).
  • sourceOrderId (string, zorunlu): The orderId value sent with SaveOrders for the order.
  • sourceOrderNumber (string, zorunlu): The orderNumber value sent with SaveOrders for the order.

Yanıtlar

  • 200: Successful. Always check the isSuccess field in the body.
  • 400: Body validation failed (missing required field, type mismatch, or malformed JSON). Response is in ASP.NET Core ValidationProblemDetails format; the errors field indicates which field is invalid.
  • 401: Authorization header missing, token invalid or expired. Body returns empty; obtain a new token via /Auth/login.
  • 500: Unexpected server error. This response returns with PascalCase field names (unlike other responses) and includes null fields.

200 yanıt alanları

  • items (object[], zorunlu): Separate result for each submitted record.
    • items.itemCode (string, zorunlu): Code of the record the result belongs to (in order record orderNumber, in package creation sourcePackageId).
    • items.isSuccess (boolean, zorunlu): true if this record was processed successfully.
    • items.errorMesssage (string): Error message if the record failed. Returns only if not empty.
  • errorType (string): General error type. Returned only if not empty.
  • isSuccess (boolean, zorunlu): true if all records in the list are successful; false if at least one fails.
  • errorSource (string): Error source. Returned only if not empty.
  • errorMesssage (string): General error message (e.g. order not found). Returned only if not empty.