Material Requests
Create Purchase Orders From Material Requests
POST
/
api
/
v1
/
material-requests
/
create-purchase-orders
Create Purchase Orders From Material Requests
curl --request POST \
--url https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"<string>"
],
"dryRun": true,
"expectedDeliveryDate": "<string>",
"notes": "<string>",
"skipInvalidLines": false,
"poStatus": "Submitted"
}
'import requests
url = "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders"
payload = {
"ids": ["<string>"],
"dryRun": True,
"expectedDeliveryDate": "<string>",
"notes": "<string>",
"skipInvalidLines": False,
"poStatus": "Submitted"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ids: ['<string>'],
dryRun: true,
expectedDeliveryDate: '<string>',
notes: '<string>',
skipInvalidLines: false,
poStatus: 'Submitted'
})
};
fetch('https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
],
'dryRun' => true,
'expectedDeliveryDate' => '<string>',
'notes' => '<string>',
'skipInvalidLines' => false,
'poStatus' => 'Submitted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"dryRun": true,
"requestedIds": [
"<string>"
],
"totalPurchaseOrders": 123,
"grandTotal": 123,
"preview": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"sourceMaterialRequestIds": [
"<string>"
],
"sourceMaterialRequestDocuments": [
"<string>"
],
"supplierId": "<string>",
"supplierName": "<string>",
"lineItemCount": 123,
"subtotal": 123,
"taxRate": 123,
"taxAmount": 123,
"total": 123,
"orderDate": "<string>",
"items": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"materialRequestLineId": "<string>",
"itemNumber": 123,
"supplierId": "<string>",
"supplierName": "<string>",
"requiredQty": 123,
"qtyToPurchase": 123,
"unitPrice": 123,
"estimatedAmount": 123,
"materialId": "<string>",
"materialName": "<string>",
"uom": "<string>"
}
],
"productionOrderId": "<string>",
"productionOrderDocumentId": "<string>",
"salesOrderId": "<string>",
"expectedDeliveryDate": "<string>"
}
],
"createdPurchaseOrders": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"purchaseOrderId": "<string>",
"purchaseOrderDocumentId": "<string>",
"lineItemCount": 123,
"subtotal": 123,
"taxAmount": 123,
"total": 123
}
],
"validationIssues": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"materialRequestLineId": "<string>",
"reason": "<string>",
"itemNumber": 123,
"materialName": "<string>",
"supplierId": "<string>",
"supplierName": "<string>"
}
],
"skippedLineCount": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Headers
Body
application/json
Response
Successful Response
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Previous
Plan Material Request QuantitiesCompute the consolidated material-variation plan for an order.
Explodes each material across the order's color/size breakdown, applies
``required = net consumption (after waste) × garment qty``, then merges by
dependency type (color → one line per color, size → one line per size summed
across colors, order → a single line). This is the server-authoritative
Material Request quantity engine; the caller supplies the resolved BOM
materials and the order breakdown (DB auto-sourcing from a production order
is the next increment).
Next
⌘I
Create Purchase Orders From Material Requests
curl --request POST \
--url https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
"<string>"
],
"dryRun": true,
"expectedDeliveryDate": "<string>",
"notes": "<string>",
"skipInvalidLines": false,
"poStatus": "Submitted"
}
'import requests
url = "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders"
payload = {
"ids": ["<string>"],
"dryRun": True,
"expectedDeliveryDate": "<string>",
"notes": "<string>",
"skipInvalidLines": False,
"poStatus": "Submitted"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
ids: ['<string>'],
dryRun: true,
expectedDeliveryDate: '<string>',
notes: '<string>',
skipInvalidLines: false,
poStatus: 'Submitted'
})
};
fetch('https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ids' => [
'<string>'
],
'dryRun' => true,
'expectedDeliveryDate' => '<string>',
'notes' => '<string>',
'skipInvalidLines' => false,
'poStatus' => 'Submitted'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders"
payload := strings.NewReader("{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vinmake-erp.onrender.com/api/v1/material-requests/create-purchase-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"<string>\"\n ],\n \"dryRun\": true,\n \"expectedDeliveryDate\": \"<string>\",\n \"notes\": \"<string>\",\n \"skipInvalidLines\": false,\n \"poStatus\": \"Submitted\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"dryRun": true,
"requestedIds": [
"<string>"
],
"totalPurchaseOrders": 123,
"grandTotal": 123,
"preview": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"sourceMaterialRequestIds": [
"<string>"
],
"sourceMaterialRequestDocuments": [
"<string>"
],
"supplierId": "<string>",
"supplierName": "<string>",
"lineItemCount": 123,
"subtotal": 123,
"taxRate": 123,
"taxAmount": 123,
"total": 123,
"orderDate": "<string>",
"items": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"materialRequestLineId": "<string>",
"itemNumber": 123,
"supplierId": "<string>",
"supplierName": "<string>",
"requiredQty": 123,
"qtyToPurchase": 123,
"unitPrice": 123,
"estimatedAmount": 123,
"materialId": "<string>",
"materialName": "<string>",
"uom": "<string>"
}
],
"productionOrderId": "<string>",
"productionOrderDocumentId": "<string>",
"salesOrderId": "<string>",
"expectedDeliveryDate": "<string>"
}
],
"createdPurchaseOrders": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"purchaseOrderId": "<string>",
"purchaseOrderDocumentId": "<string>",
"lineItemCount": 123,
"subtotal": 123,
"taxAmount": 123,
"total": 123
}
],
"validationIssues": [
{
"materialRequestId": "<string>",
"materialRequestDocumentId": "<string>",
"materialRequestLineId": "<string>",
"reason": "<string>",
"itemNumber": 123,
"materialName": "<string>",
"supplierId": "<string>",
"supplierName": "<string>"
}
],
"skippedLineCount": 0
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}