Material Requests
Save Material Request Plan
Persist a Material Request in the new schema: header + v1 version + line items (with variation fields) + links to one OR many production orders.
POST
/
api
/
v1
/
material-requests
/
save
Save Material Request Plan
curl --request POST \
--url https://vinmake-erp.onrender.com/api/v1/material-requests/save \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documentId": "<string>",
"salesOrderId": "<string>",
"productionOrderIds": [
"<string>"
],
"status": "draft",
"urgency": "normal",
"notes": "<string>",
"snapshot": {},
"lines": [
{
"materialId": "<string>",
"materialSkuId": "<string>",
"materialName": "<string>",
"color": "<string>",
"size": "<string>",
"dependencyType": "<string>",
"netConsumption": 123,
"garmentQty": 123,
"garmentQtyBasis": "<string>",
"requiredQty": 0,
"qtyToPurchase": 123,
"uom": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"unitPrice": 123
}
]
}
'import requests
url = "https://vinmake-erp.onrender.com/api/v1/material-requests/save"
payload = {
"documentId": "<string>",
"salesOrderId": "<string>",
"productionOrderIds": ["<string>"],
"status": "draft",
"urgency": "normal",
"notes": "<string>",
"snapshot": {},
"lines": [
{
"materialId": "<string>",
"materialSkuId": "<string>",
"materialName": "<string>",
"color": "<string>",
"size": "<string>",
"dependencyType": "<string>",
"netConsumption": 123,
"garmentQty": 123,
"garmentQtyBasis": "<string>",
"requiredQty": 0,
"qtyToPurchase": 123,
"uom": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"unitPrice": 123
}
]
}
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({
documentId: '<string>',
salesOrderId: '<string>',
productionOrderIds: ['<string>'],
status: 'draft',
urgency: 'normal',
notes: '<string>',
snapshot: {},
lines: [
{
materialId: '<string>',
materialSkuId: '<string>',
materialName: '<string>',
color: '<string>',
size: '<string>',
dependencyType: '<string>',
netConsumption: 123,
garmentQty: 123,
garmentQtyBasis: '<string>',
requiredQty: 0,
qtyToPurchase: 123,
uom: '<string>',
supplierId: '<string>',
supplierName: '<string>',
unitPrice: 123
}
]
})
};
fetch('https://vinmake-erp.onrender.com/api/v1/material-requests/save', 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/save",
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([
'documentId' => '<string>',
'salesOrderId' => '<string>',
'productionOrderIds' => [
'<string>'
],
'status' => 'draft',
'urgency' => 'normal',
'notes' => '<string>',
'snapshot' => [
],
'lines' => [
[
'materialId' => '<string>',
'materialSkuId' => '<string>',
'materialName' => '<string>',
'color' => '<string>',
'size' => '<string>',
'dependencyType' => '<string>',
'netConsumption' => 123,
'garmentQty' => 123,
'garmentQtyBasis' => '<string>',
'requiredQty' => 0,
'qtyToPurchase' => 123,
'uom' => '<string>',
'supplierId' => '<string>',
'supplierName' => '<string>',
'unitPrice' => 123
]
]
]),
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/save"
payload := strings.NewReader("{\n \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\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/save")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vinmake-erp.onrender.com/api/v1/material-requests/save")
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 \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"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
Previous
Material Request Variation DetailStep 5b: the new richness of a saved request — version history, the linked
production orders (many-to-many), and line items grouped by material into
color/size variations. Gracefully empty for legacy requests.
Next
⌘I
Save Material Request Plan
curl --request POST \
--url https://vinmake-erp.onrender.com/api/v1/material-requests/save \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"documentId": "<string>",
"salesOrderId": "<string>",
"productionOrderIds": [
"<string>"
],
"status": "draft",
"urgency": "normal",
"notes": "<string>",
"snapshot": {},
"lines": [
{
"materialId": "<string>",
"materialSkuId": "<string>",
"materialName": "<string>",
"color": "<string>",
"size": "<string>",
"dependencyType": "<string>",
"netConsumption": 123,
"garmentQty": 123,
"garmentQtyBasis": "<string>",
"requiredQty": 0,
"qtyToPurchase": 123,
"uom": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"unitPrice": 123
}
]
}
'import requests
url = "https://vinmake-erp.onrender.com/api/v1/material-requests/save"
payload = {
"documentId": "<string>",
"salesOrderId": "<string>",
"productionOrderIds": ["<string>"],
"status": "draft",
"urgency": "normal",
"notes": "<string>",
"snapshot": {},
"lines": [
{
"materialId": "<string>",
"materialSkuId": "<string>",
"materialName": "<string>",
"color": "<string>",
"size": "<string>",
"dependencyType": "<string>",
"netConsumption": 123,
"garmentQty": 123,
"garmentQtyBasis": "<string>",
"requiredQty": 0,
"qtyToPurchase": 123,
"uom": "<string>",
"supplierId": "<string>",
"supplierName": "<string>",
"unitPrice": 123
}
]
}
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({
documentId: '<string>',
salesOrderId: '<string>',
productionOrderIds: ['<string>'],
status: 'draft',
urgency: 'normal',
notes: '<string>',
snapshot: {},
lines: [
{
materialId: '<string>',
materialSkuId: '<string>',
materialName: '<string>',
color: '<string>',
size: '<string>',
dependencyType: '<string>',
netConsumption: 123,
garmentQty: 123,
garmentQtyBasis: '<string>',
requiredQty: 0,
qtyToPurchase: 123,
uom: '<string>',
supplierId: '<string>',
supplierName: '<string>',
unitPrice: 123
}
]
})
};
fetch('https://vinmake-erp.onrender.com/api/v1/material-requests/save', 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/save",
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([
'documentId' => '<string>',
'salesOrderId' => '<string>',
'productionOrderIds' => [
'<string>'
],
'status' => 'draft',
'urgency' => 'normal',
'notes' => '<string>',
'snapshot' => [
],
'lines' => [
[
'materialId' => '<string>',
'materialSkuId' => '<string>',
'materialName' => '<string>',
'color' => '<string>',
'size' => '<string>',
'dependencyType' => '<string>',
'netConsumption' => 123,
'garmentQty' => 123,
'garmentQtyBasis' => '<string>',
'requiredQty' => 0,
'qtyToPurchase' => 123,
'uom' => '<string>',
'supplierId' => '<string>',
'supplierName' => '<string>',
'unitPrice' => 123
]
]
]),
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/save"
payload := strings.NewReader("{\n \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\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/save")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://vinmake-erp.onrender.com/api/v1/material-requests/save")
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 \"documentId\": \"<string>\",\n \"salesOrderId\": \"<string>\",\n \"productionOrderIds\": [\n \"<string>\"\n ],\n \"status\": \"draft\",\n \"urgency\": \"normal\",\n \"notes\": \"<string>\",\n \"snapshot\": {},\n \"lines\": [\n {\n \"materialId\": \"<string>\",\n \"materialSkuId\": \"<string>\",\n \"materialName\": \"<string>\",\n \"color\": \"<string>\",\n \"size\": \"<string>\",\n \"dependencyType\": \"<string>\",\n \"netConsumption\": 123,\n \"garmentQty\": 123,\n \"garmentQtyBasis\": \"<string>\",\n \"requiredQty\": 0,\n \"qtyToPurchase\": 123,\n \"uom\": \"<string>\",\n \"supplierId\": \"<string>\",\n \"supplierName\": \"<string>\",\n \"unitPrice\": 123\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}