User Tools

Site Tools


en:api_saleorder

This is an old revision of the document!


Sales Order API

API to submit Sales Order. Supported methods are:

GET, PUT, POST, DELETE.

url: ~/sales_order

JSON structure

Document Header

List or style, one per style

List of shipment, one per ship include assortment or packs

List of pack, one pack with assortment

JSON Schema

Other reference json schema:

object_document, object_style, object_party

{

  "$id": "https://www.igarment.net/schema/json/v1-0/sales-order.json",
  "title": "Sales Order",
  "type": "object",
  "required": [ "reference", "styles" ],
  "properties": {
      // document header
      "reference": { "$ref": "object-document.json#/$defs/reference" },
      "party":     { "$ref": "object-party.json#/$defs/party" },
      "internal":  { "$ref": "object-document.json#/$defs/internal" },
      "pricing":   { "$ref": "object-document.json#/$defs/pricing" },
      "userdefs":  { "$ref": "object-document.json#/$defs/userdefs" },
      "system":    { "$ref": "object-document.json#/$defs/system" },
      "cutomer_po_ref":   { "type": "string", "maxlength": 26 },
      "customer_po_date": { "type": "string", "format": "date" },
      "agent":            { "type": "string", "maxlength": 5 },
      "agent_commission_precent": { "type": "number" },
      // list of style information in this order
      "styles": {
          "type": "array",
          "items": {
              "type": "object",
              "allOf": [ { "$ref": "#/$defs/style_info" } ],
              "properties": {
                  // assortment of article no
                  "articles": {
                      "type": "array",
                      "items": {
                          "type": "object",
                          "allOf": [ { "$ref": "object-variance.json#/$defs/variance" } ],
                          "properties": {
                              "article_no": { "type": "string" }
                          }
                      }
                  },
                  // list of shipping, prepack is not required.
                  "shipments": {
                      "type": "array",
                      "items": {
                          "type": "object",
                          "allOf": [ { "$ref": "#/$defs/ship_info" } ],
                          "properties": {
                              // assortment of ship, if has pack, no need input
                              "assortments": { "$ref": "object-variance.json#/$defs/assortment" },
                              //list of pack
                              "prepacks": {
                                  "type": "object",
                                  "properties": {
                                      "pack_no":  { "type": "integer", "exclusiveMinimum": 0 },                 //pack no, auto increase
                                      "pre_pack": { "type": "string" },                                         //pack name
                                      "buck_qty": { "type": "integer" },                                        //no of prepacks
                                      "pack_assortments": { "$ref": "object-variance.json#/$defs/assortment" }
                                  }
                              }
                          }
                      }
                  }
              }
          },
          "required": [ "shipments" ],
          "minItems": 1
      }
  },
  "$def": {
      "style_info": {
          "type": "object",
          "allof": [    { "$ref": "object-style.json#/$defs/style" } ],
          "properties": {
              "customer_style": { "type": "string", "maxLength": 24 },               //customer style
              "qty_unit": { "type": "string", "maxLength": 3 },                      //quantity unit
              "prc_unit": { "type": "string", "maxLength": 3 },                      //price unit
              "origin":   { "type": "string", "maxLength": 3 },                      //original country code
              "program_code":   { "type": "string" }                                 //program code
          }
      },
      "ship_info": {
          "type": "object",
          "properties": {
              "ship_no":     { "type": "integer", "exclusiveMinimum": 0 },           //ship no, auto increase, unique
              "ship_date":   { "type": "string", "formate": "date" },                //ship date
              "ship_mode":   { "type": "string" },                                   //ship mode
              "port_load":   { "type": "string", "maxlength": 3 },                   //port code of loading
              "port_disc":   { "type": "string", "maxlength": 3 },                   //port code of discharge
              "destination": { "type": "string", "maxlength": 3 },                   //ship dest code
              "lot_ref_no":  { "type": "string" },                                   //lot reference
              "label":       { "type": "string" },                                   //label
              "remark":      { "type": "string" },                                   //ship remark
              "userdefs":    { "$ref": "object-document.json#/$defs/userdefs" },     //user define fields
              "packing_method": {
                  "enum": [ 0, 1, 2, 3, 4 ]
                  //0: don't care, 1: Single Color, Single Size, 2: Single Color Assorted Size, 3: Assorted Color Single Size, 4: Assorted Color Assorted Size
              }
          }
      }
  }

} Attributes can be used in Find method. document attributes: order_no, customer, iss_date, season, cur, ord_type, division, cust_po_ref, cust_po_date, status system attributes: sys_owner, sys_create_date, sys_lm_user, sys_lm_date

Example GET: ~/sales_order/PO23-103

{

  "reference": {
      "no": "2503-0002",                               //sales order no
      "issue_date": "2025-03-28T00:00:00",             //order date
      "party_code": "AGW"                              //customer code
  },
  "party": {
      "company": {
          "name": "iGarment (Shanghai) Limited",       //customer name
          "address": {                                 //customer address
              "street": "www.igarment.net Room/B, 11/F, #432 Kaili Plaza, Huanghai West Road Shanghai, China (200052)"
          }
      },
      "contacts": {
          "name": "王某某"
      }
  },
  "internal": {
      "prepared_by": "LILLIAN",                        //owner -- user code
      "division": "01",                                //division code
      "remark": ""                                     //sales order remark
 },
  "pricing": {
      "cur": "RMB",                                    //currency
      "price_term": "FOB CHINA",                       //price term
      "payment_term": "月结30天"                        //payment term
  },
  "system": {
      "owner": "LILLIAN",                              //owner -- user code
      "created_user": "LILLIAN",                       //owner -- user code
      "created_date": "2025-03-28T16:33:11",           //created date, auto set by system
      "last_modified_user": "LILLIAN",                 //last modified user -- user code
      "last_modified_date": "2025-03-28T16:36:52"      //last modified date, auto set by system
  },
  "cutomer_po_ref": "CN25-0001",                       //customer purchase order no
  "agent": "",                                         //agent code
  "agent_commission_precent": 0.0,                     //agent commission percent
  "userdefs": [
      {
          "ext_name": "12",                            //user define field's name
          "ext_value": "1"                             //user define field's value
      }
  ],
  "styles": [
      {
          "style": "326190",                           //style
          "garment_type": "100",                       //garment type code
          "description": "女式外套",                     //style description
          "full_description": "60%涤纶20%棉",           //style full description
          "customer_style": "326190",                  //customer style
          "qty_unit": "PCS",                           //quantity unit
          "origin": "CHN",                             //original country code
          "program_code": "",                          //program code
          "userdefs": [
              {
                  "ext_name": "style extend 1",        //user define field's name
                  "ext_value": "12345"                 //user define field's value
              }
          ],
          "shipments": [
              {
                  "ship_no": 2,                        //ship no, auto increase, unique
                  "ship_date": "2025-05-01T00:00:00",  //ship date
                  "ship_mode": "By Sea",               //ship mode
                  "port_load": "C1",                   //port code of loading
                  "port_disc": "CA4",                  //port code of discharge
                  "destination": "007",                //ship dest code
                  "lot_ref_no": "",                    //lot reference
                  "label": "",                         //label
                  "qty": 1400,                         //total quantity, sum of assortments
                  "userdefs": [],
                  "assortments": [
                      {
                          "color": "90001PINK",        //color
                          "size": "S",                 //size
                          "dim3": "",
                          "qty": 200,                  //quantity
                          "price": 135.0               //price
                      },
                      {
                          "color": "90001PINK",
                          "size": "M",
                          "dim3": "",
                          "qty": 300,
                          "price": 135.0
                      },
                      {
                          "color": "90001PINK",
                          "size": "L",
                          "dim3": "",
                          "qty": 200,
                          "price": 135.0
                      },
                      {
                          "color": "90002WHITE",
                          "size": "S",
                          "dim3": "",
                          "qty": 200,
                          "price": 135.0
                      },
                      {
                          "color": "90002WHITE",
                          "size": "M",
                          "dim3": "",
                          "qty": 300,
                          "price": 135.0
                      },
                      {
                          "color": "90002WHITE",
                          "size": "L",
                          "dim3": "",
                          "qty": 200,
                          "price": 135.0
                      }
                  ],
                  "prepacks": []                       //prepack details
              }
          ]
      }
  ]

}

en/api_saleorder.1780482417.txt.gzip · Last modified: by administrator