User Tools

Site Tools


en:api_po

This is an old revision of the document!


Purchase Order API

API to submit Purchase Order. Supported methods are:

GET, PUT, POST, DELETE

url:~/purchase_order

JSON Schema

Other reference json schema: object_document, object_variance, object_party

{
  "$id": "https://www.igarment.net/schema/json/v1-0/purchase-order.json",
  "title": "Purchase Order",
  "type": "object",
  "required": [
      "reference",
      "items"
  ],
  "properties": {
      "reference": { "$ref": "object-document.json#/$defs/reference" }, //include purchase order no, iss_date, supplier
      "party":     { "$ref": "object-party.json#/$defs/party" },
      "internal":  { "$ref": "object-document.json#/$defs/internal" },
      "pricing":   { "$ref": "object-document.json#/$defs/pricing" },
      "shipping":  { "$ref": "object-document.json#/$defs/shipping" },
      "userdefs":  { "$ref": "object-document.json#/$defs/userdefs" },
      "status":    { "$ref": "object-document.json#/$defs/status" },
      "system":    { "$ref": "object-document.json#/$defs/system" },
      "items": {
          "type": "array",
          "items": {
              "oneOf": [
                  { "$ref": "#/$defs/material_item" },
                  { "$ref": "#/$defs/charge_item" }
              ],
              "type": "object",
              "properties": {
                  "item_no": { "type": "integer", "exclusiveMinimum": 0 },
                  "amount":  { "type": "number" }
              }
          }, "minItems": 1
      }
  },
  "$defs": {
      "material_item": {
          "type": "object",
          "properties": {
              "material_class": { "type": "string", "maxLength": 2 },
              "material_code":  { "type": "string", "maxLength": 24 },
              "supplier_article": { "type": "string", "maxLength": 40 },
              "description":    { "type": "string", "maxLength": 40 },
              "qty_unit": { "type": "string", "maxLength": 3 },
              "qty":      { "type": "number" },
              "prc_unit": { "type": "string", "maxLength": 3 },
              "prc_factor": {
                  "type": "array",
                  "prefixItems": [
                      { "type": "number" },
                      { "enum": [ "qty/prc", "prc/qty" ] }
                  ]
              },
              "prc": { "type": "number" },
              "delivery_partial_allowed": { "type": "boolean", "default": "False" },
              "delivery_minimum_percent": { "type": "number" },
              "delivery_maximum_percent": { "type": "number" },
              "assortments": { "$ref": "object-variance.json#/$defs/assortment" },
              "charges": {
                  "type": "array",
                  "items": {
                      "type": "object",
                      "properties": {
                          "charge_type": { "type": "string" },
                          "charge_description": { "type": "string" },
                          "charge_amount": { "type": "number" }
                      }
                  }
              }
          }, "required": [ "material_class", "material_code" ]
      },
      "charge_item": {
          "type": "object",
          "properties": {
              "charge_type": { "type": "string" },
              "charge_description": { "type": "string" }
          }, "required": [ "charge_type" ]
      }
  }
}

Attributes can be used in Find method.

document attributes: pu_order_no, supp, iss_date, season, cur

shipping attributes: etd_date, eta_date, ship_to, ship_term

system attributes: sys_owner, sys_create_date, sys_lm_user, sys_lm_date

Example

GET: ~/purchase_order/PO23-103

{
  "reference": {
      "no": "PO23-103",
      "issue_date": "2023-09-28T00:00:00",
      "party_code": "YKK"
  },
  "party": {
      "company": {
          "name": "YKK  ZIPPER COMPANY",
          "address": {
              "street": "Address1 Address2 Address3 Address4"
          }
      },
      "contacts": {
          "name": "Sunny"
      }
  },
  "internal": {
      "prepared_by": "USER"
  },
  "pricing": {
      "cur": "RMB",
      "vat": 0.0,
      "price_inc_vat": false,
      "price_term": "",
      "payment_term": "L/C AT 30 DAYS SIGHT"
  },
  "shipping": {
      "ship_method": "",
      "ship_to_warehouse": "",
      "eta_date": "2023-03-06T00:00:00",
      "final_warehouse": "",
      "final_eta": "2023-03-06T00:00:00"
  },
  "status": {
      "status_code": ""
  },
  "system": {
      "version": "0.1",
      "error": false,
      "owner": "USER",
      "created_user": "USER",
      "created_date": "2023-09-28T17:01:21",
      "last_modified_user": "USER",
      "last_modified_date": "2023-09-28T17:04:49"
  },
  "items": [
      {
          "item_no": 1,
          "amount": 9100.0,
          "material_class": "ZP",
          "material_code": "ZP003",
          "supplier_article": "",
          "description": "",
          "qty_unit": "PCS",
          "qty": 9100.0,
          "prc_unit": "PCS",
          "prc": 0.0,
          "delivery_minimum_percent": 0.0,
          "delivery_maximum_percent": 10.0,
          "prc_factor": [
              0.0,
              "qty/prc"
          ],
          "delivery_partial_allowed": true,
          "charges": [
              {
                  "charge_type": "002",
                  "charge_description": "TEST charge",
                  "charge_amount": 800.0
              }
          ],
          "assortments": [
              {
                  "color": "WHITE",
                  "size": "5\"",
                  "qty": 5160.0,
                  "price": 1.0
              },
              {
                  "color": "WHITE",
                  "size": "5.5\"",
                  "qty": 3940.0,
                  "price": 1.0
              }
          ]
      },
      {
          "item_no": 2,
          "amount": 4550.0,
          "material_class": "ZP",
          "material_code": "ZP-103",
          "supplier_article": "",
          "description": "",
          "qty_unit": "PCS",
          "qty": 9100.0,
          "prc_unit": "PCS",
          "prc": 0.0,
          "delivery_minimum_percent": 0.0,
          "delivery_maximum_percent": 0.0,
          "prc_factor": [
              0.0,
              "qty/prc"
          ],
          "delivery_partial_allowed": true,
          "charges": [],
          "assortments": [
              {
                  "color": "NAVY",
                  "size": "5\"",
                  "qty": 2580.0,
                  "price": 0.5
              },
              {
                  "color": "NAVY",
                  "size": "5.5\"",
                  "qty": 4620.0,
                  "price": 0.5
              },
              {
                  "color": "RED",
                  "size": "5\"",
                  "qty": 450.0,
                  "price": 0.5
              },
              {
                  "color": "RED",
                  "size": "5.5\"",
                  "qty": 750.0,
                  "price": 0.5
              },
              {
                  "color": "YELLOW",
                  "size": "5\"",
                  "qty": 310.0,
                  "price": 0.5
              },
              {
                  "color": "YELLOW",
                  "size": "5.5\"",
                  "qty": 390.0,
                  "price": 0.5
              }
          ]
      },
      {
          "amount": 200.0,
          "charge_type": "011",
          "charge_description": "Order Charge",
          "item_no": 10001
      }
  ]
}
en/api_po.1780483392.txt.gzip · Last modified: by administrator