Start a new topic

Adding, issuing and receiving a purchase using the API

Please review other topics for information about accessing urls, collections and endpoints.   This topic assumes the user has a functional understanding of these concepts and these concepts are described in detail in other forum topics.   This example assumes a vendor BESTBUY exists, and items WIDGET and GADGET are present.


The following example will perform the following tasks;


1 - Add a purchase order

2 - Issue the purchase order

3 - Receive quantities against the purchase order

4 - Perform the receive process


Add a purchase order


Perform a POST action to the following endpoint;


https://localhost:10880/api/v2/companies/SuperCo/purchasing/orders



{
  "trackingNo": "My tracking number",
  "vendor": {
    "vendorNo": "BESTBUY"
  },
  "status": "O",
  "location": "My location",
  "items": [
    {
      "inventory": {
        "whse": "00",
        "partNo": "GADGET"
      },
      "orderQty": "10",
      "unitPrice": "10"
    },
    {
      "inventory": {
        "whse": "00",
        "partNo": "WIDGET"
      },
      "orderQty": "100",
      "unitPrice": "20"
    }
  ],
  "referenceNo": "Ref1"
}

Issue the purchase order


To issue the purchase order just created, perform POST with an empty JSON body to;


https://localhost:10880/api/v2/companies/SuperCo/purchasing/orders/1/issue


Note that 1 is the ID of the purchase order we are issuing.


Apply quantities to the issues purchase order


To apply quantities to the purchase order, perform a PUT to the following endpoint;


https://localhost:10880/api/v2/companies/SuperCo/purchasing/orders/1


Using the following JSON, which receives 2 WIDGET and 3 GADGET quantities.


{
  "id": 1,
  "number": "0000080000",
  "vendor": {
    "id": 1
  },
  "status": "R",
  "items": [
    {
      "id": 1,
      "whse": "00",
      "partNo": "WIDGET",
      "inventory": {
        "id": 1
      },
      "receiveQty": "2"
    },
    {
      "id": 2,
      "whse": "00",
      "partNo": "GADGET",
      "inventory": {
        "id": 2
      },
      "receiveQty": "3"
    }
  ]
}


Receive the purchase receipt items


To recognize the receipt of the items, perform a POST with an empty JSON payload to the following endpoint;


https://localhost:10880/api/v2/companies/SuperCo/purchasing/orders/1/receive




Login or Signup to post a comment