Create Stock From Image
curl --request POST \
--url https://api.decodahealth.com/inventory/stocks/create-from-image \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'TENANT: <tenant>' \
--form image='@example-file' \
--form 'supplier_id=<string>' \
--form 'location_id=<string>' \
--form 'description=<string>'import requests
url = "https://api.decodahealth.com/inventory/stocks/create-from-image"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"supplier_id": "<string>",
"location_id": "<string>",
"description": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('image', '<string>');
form.append('supplier_id', '<string>');
form.append('location_id', '<string>');
form.append('description', '<string>');
const options = {method: 'POST', headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.decodahealth.com/inventory/stocks/create-from-image', 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/create-from-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: multipart/form-data",
"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/create-from-image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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/create-from-image")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/inventory/stocks/create-from-image")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body[
{
"name": "<string>",
"id": "<string>",
"description": "<string>",
"notes": "<string>",
"category": "<string>",
"isArchived": false,
"shipments": [
{
"stockId": "<string>",
"supplierId": "<string>",
"locationId": "<string>",
"quantity": 123,
"remainingQuantity": 123,
"locationName": "<string>",
"id": "<string>",
"lotNumber": "<string>",
"expiryDate": "2023-11-07T05:31:56Z",
"sku": "<string>",
"cost": 123,
"supplier": {
"name": "<string>",
"id": "<string>",
"description": "<string>",
"website": "<string>",
"email": "<string>",
"preferredContactMethod": "<string>",
"phoneNumber": "<string>",
"addressLineOne": "<string>",
"addressLineTwo": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"country": "<string>",
"isArchived": false
},
"createdDate": "2023-11-07T05:31:56Z",
"note": "<string>"
}
]
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Inventory
Create Stock From Image
Create a new stock item by analyzing an uploaded image.
POST
/
inventory
/
stocks
/
create-from-image
Create Stock From Image
curl --request POST \
--url https://api.decodahealth.com/inventory/stocks/create-from-image \
--header 'API-KEY: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--header 'TENANT: <tenant>' \
--form image='@example-file' \
--form 'supplier_id=<string>' \
--form 'location_id=<string>' \
--form 'description=<string>'import requests
url = "https://api.decodahealth.com/inventory/stocks/create-from-image"
files = { "image": ("example-file", open("example-file", "rb")) }
payload = {
"supplier_id": "<string>",
"location_id": "<string>",
"description": "<string>"
}
headers = {
"TENANT": "<tenant>",
"API-KEY": "<api-key>"
}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('image', '<string>');
form.append('supplier_id', '<string>');
form.append('location_id', '<string>');
form.append('description', '<string>');
const options = {method: 'POST', headers: {TENANT: '<tenant>', 'API-KEY': '<api-key>'}};
options.body = form;
fetch('https://api.decodahealth.com/inventory/stocks/create-from-image', 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/create-from-image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"API-KEY: <api-key>",
"Content-Type: multipart/form-data",
"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/create-from-image"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TENANT", "<tenant>")
req.Header.Add("API-KEY", "<api-key>")
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/create-from-image")
.header("TENANT", "<tenant>")
.header("API-KEY", "<api-key>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.decodahealth.com/inventory/stocks/create-from-image")
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.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"supplier_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"location_id\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"description\"\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body[
{
"name": "<string>",
"id": "<string>",
"description": "<string>",
"notes": "<string>",
"category": "<string>",
"isArchived": false,
"shipments": [
{
"stockId": "<string>",
"supplierId": "<string>",
"locationId": "<string>",
"quantity": 123,
"remainingQuantity": 123,
"locationName": "<string>",
"id": "<string>",
"lotNumber": "<string>",
"expiryDate": "2023-11-07T05:31:56Z",
"sku": "<string>",
"cost": 123,
"supplier": {
"name": "<string>",
"id": "<string>",
"description": "<string>",
"website": "<string>",
"email": "<string>",
"preferredContactMethod": "<string>",
"phoneNumber": "<string>",
"addressLineOne": "<string>",
"addressLineTwo": "<string>",
"city": "<string>",
"state": "<string>",
"zipCode": "<string>",
"country": "<string>",
"isArchived": false
},
"createdDate": "2023-11-07T05:31:56Z",
"note": "<string>"
}
]
}
]{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Headers
The tenant you are making this request on behalf of
Your api key
Body
multipart/form-data
Response
Successful Response
Name of the stock
Unit of measurement
Available options:
AMPOULES, APPLICATORS, BOTTLES, BOXES, CAPSULES, CUPS, DOSES, G_PER_ML, GRAMS, IU, IU_PER_ML, OUNCES, FLUID_OUNCES, KG, KITS, LITERS, MCG, MG, MG_PER_ML, ML, MMOL, MICROGRAM_PER_ML, PACKS, PAIRS, PATCHES, PERCENTAGE, PIECES, POUCHES, ROLLS, SACHETS, SHEETS, SPRAYS, STRIPS, SYRINGES, TABLETS, TABLETS_PER_DAY, TESTS, TUBES, UNITS, VIALS, TREATMENTS, SESSIONS, PULSES, JOULES, CENTIMETERS, THREAD_COUNT, INJECTIONS, WRINKLE_UNITS, POUNDS, FEET, INCHES Unique identifier for the stock
Optional description of the stock
Notes about the stock
Category name (references category.name)
Whether the stock is archived
Shipments in the stock
Show child attributes
Show child attributes
⌘I
