Skip to main content
POST
/
inventory
/
stocks
/
link-supplier
Link Supplier To Stock
curl --request POST \
  --url https://api.decodahealth.com/inventory/stocks/link-supplier \
  --header 'API-KEY: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'TENANT: <tenant>' \
  --data '
[
  {
    "supplierId": "<string>",
    "stockId": "<string>",
    "uoms": [
      {
        "supplierPartNumber": "<string>",
        "conversionFactor": 1,
        "isDefault": false,
        "displayLabel": "<string>",
        "price": 123,
        "leadTime": 1
      }
    ]
  }
]
'
import requests

url = "https://api.decodahealth.com/inventory/stocks/link-supplier"

payload = [
{
"supplierId": "<string>",
"stockId": "<string>",
"uoms": [
{
"supplierPartNumber": "<string>",
"conversionFactor": 1,
"isDefault": False,
"displayLabel": "<string>",
"price": 123,
"leadTime": 1
}
]
}
]
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify([
{
supplierId: '<string>',
stockId: '<string>',
uoms: [
{
supplierPartNumber: '<string>',
conversionFactor: 1,
isDefault: false,
displayLabel: '<string>',
price: 123,
leadTime: 1
}
]
}
])
};

fetch('https://api.decodahealth.com/inventory/stocks/link-supplier', 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://api.decodahealth.com/inventory/stocks/link-supplier",
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([
[
'supplierId' => '<string>',
'stockId' => '<string>',
'uoms' => [
[
'supplierPartNumber' => '<string>',
'conversionFactor' => 1,
'isDefault' => false,
'displayLabel' => '<string>',
'price' => 123,
'leadTime' => 1
]
]
]
]),
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: application/json",
"TENANT: <tenant>"
],
]);

$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://api.decodahealth.com/inventory/stocks/link-supplier"

payload := strings.NewReader("[\n {\n \"supplierId\": \"<string>\",\n \"stockId\": \"<string>\",\n \"uoms\": [\n {\n \"supplierPartNumber\": \"<string>\",\n \"conversionFactor\": 1,\n \"isDefault\": false,\n \"displayLabel\": \"<string>\",\n \"price\": 123,\n \"leadTime\": 1\n }\n ]\n }\n]")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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://api.decodahealth.com/inventory/stocks/link-supplier")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("[\n {\n \"supplierId\": \"<string>\",\n \"stockId\": \"<string>\",\n \"uoms\": [\n {\n \"supplierPartNumber\": \"<string>\",\n \"conversionFactor\": 1,\n \"isDefault\": false,\n \"displayLabel\": \"<string>\",\n \"price\": 123,\n \"leadTime\": 1\n }\n ]\n }\n]")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.decodahealth.com/inventory/stocks/link-supplier")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["TENANT"] = '<tenant>'
request["API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "[\n {\n \"supplierId\": \"<string>\",\n \"stockId\": \"<string>\",\n \"uoms\": [\n {\n \"supplierPartNumber\": \"<string>\",\n \"conversionFactor\": 1,\n \"isDefault\": false,\n \"displayLabel\": \"<string>\",\n \"price\": 123,\n \"leadTime\": 1\n }\n ]\n }\n]"

response = http.request(request)
puts response.read_body
[
  {
    "supplierId": "<string>",
    "stockId": "<string>",
    "id": "<string>",
    "uoms": [
      {
        "supplierPartNumber": "<string>",
        "id": "<string>",
        "supplierToStockId": "<string>",
        "conversionFactor": 1,
        "isDefault": false,
        "displayLabel": "<string>",
        "price": 123,
        "leadTime": 1,
        "createdDate": "2023-11-07T05:31:56Z",
        "updatedDate": "2023-11-07T05:31:56Z",
        "isArchived": false
      }
    ],
    "createdDate": "2023-11-07T05:31:56Z",
    "updatedDate": "2023-11-07T05:31:56Z",
    "isArchived": false
  }
]
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Headers

TENANT
string
required

The tenant you are making this request on behalf of

API-KEY
string
required

Your api key

Body

application/json

Schema for creating a new supplier-to-stock link with UOM entries.

supplierId
string
required

ID of the supplier

stockId
string
required

ID of the stock

uoms
SupplierToStockUomCreate · object[]
required

UOM entries for this supplier-stock link

Minimum array length: 1

Response

Successful Response

supplierId
string
required

ID of the supplier

stockId
string
required

ID of the stock

id
string
required

Unique identifier for the supplier-to-stock relationship

uoms
SupplierToStockUom · object[] | null

UOM variants for this supplier-stock link

createdDate
string<date-time> | null

Date the link was created

updatedDate
string<date-time> | null

Date the link was last updated

isArchived
boolean
default:false

Whether the link is archived