curl -X POST " https://api.playground.try.be/inventory/orders " \
-H " Authorization: Bearer YOUR_API_KEY " \
-H " Accept: application/json " \
-H " Content-Type: application/json " \
-d ' {
"purchase_order_number": "PO123",
"supplier_id": "00000000-0000-0000-0000-000000000000",
"supplier_email": "orders@example.com",
"site_id": "00000000-0000-0000-0000-000000000000"
} ' const response = await fetch ( ' https://api.playground.try.be/inventory/orders ' , {
method : ' POST ' ,
headers : {
Authorization : ' Bearer YOUR_API_KEY ' ,
' Content-Type ' : ' application/json ' ,
Accept : ' application/json ' ,
},
body : JSON . stringify ( {
" purchase_order_number " : " PO123 " ,
" supplier_id " : " 00000000-0000-0000-0000-000000000000 " ,
" supplier_email " : " orders@example.com " ,
" site_id " : " 00000000-0000-0000-0000-000000000000 "
} ) ,
} )
if ( ! response . ok ) {
throw new Error ( ` Trybe API ${ response . status } : ${ await response . text () }` )
}
const data = await response . json () import httpx
response = httpx . post (
" https://api.playground.try.be/inventory/orders " ,
headers = {
" Authorization " : " Bearer YOUR_API_KEY " ,
" Accept " : " application/json " ,
" Content-Type " : " application/json " ,
},
json = {
" purchase_order_number " : " PO123 " ,
" supplier_id " : " 00000000-0000-0000-0000-000000000000 " ,
" supplier_email " : " orders@example.com " ,
" site_id " : " 00000000-0000-0000-0000-000000000000 "
},
)
response . raise_for_status ()
data = response . json () <? php
$ client = new \ GuzzleHttp \ Client ();
$ response = $ client -> request ( ' POST ' , ' https://api.playground.try.be/inventory/orders ' , [
' headers ' => [
' Authorization ' => ' Bearer YOUR_API_KEY ' ,
' Accept ' => ' application/json ' ,
' Content-Type ' => ' application/json ' ,
],
' json ' => [
' purchase_order_number ' => ' PO123 ' ,
' supplier_id ' => ' 00000000-0000-0000-0000-000000000000 ' ,
' supplier_email ' => ' orders@example.com ' ,
' site_id ' => ' 00000000-0000-0000-0000-000000000000 '
],
]);
$ data = json_decode ($ response -> getBody (), true ); package main
import (
" bytes "
" encoding/json "
" net/http "
)
func main () {
payload , _ := json . Marshal ( map [ string ] interface {}{
" purchase_order_number " : " PO123 " ,
" supplier_id " : " 00000000-0000-0000-0000-000000000000 " ,
" supplier_email " : " orders@example.com " ,
" site_id " : " 00000000-0000-0000-0000-000000000000 " ,
})
req , _ := http . NewRequest ( " POST " , " https://api.playground.try.be/inventory/orders " , bytes . NewBuffer ( payload ))
req . Header . Set ( " Authorization " , " Bearer YOUR_API_KEY " )
req . Header . Set ( " Accept " , " application/json " )
req . Header . Set ( " Content-Type " , " application/json " )
resp , err := http . DefaultClient . Do ( req )
if err != nil {
panic ( err )
}
defer resp . Body . Close ()
var data map [ string ] interface {}
json . NewDecoder ( resp . Body ). Decode ( & data )
} 201 401 403 422
The inventory order was successfully retrieved
{
" data " : {
" id " : " 00000000-0000-0000-0000-000000000000 " ,
" status " : " draft " ,
" purchase_order_number " : " PO123 " ,
" supplier_id " : " 00000000-0000-0000-0000-000000000000 " ,
" supplier_name " : " Elemis " ,
" supplier_email " : " orders@example.com " ,
" subtotal " : 2000 ,
" currency " : " gbp " ,
" item_count " : 10 ,
" items_added " : false ,
" created_by_id " : " 00000000-0000-0000-0000-000000000000 " ,
" site_id " : " 00000000-0000-0000-0000-000000000000 " ,
" organisation_id " : " 00000000-0000-0000-0000-000000000000 " ,
" created_at " : " 2024-06-01T12:00:00Z " ,
" updated_at " : " 2024-06-01T12:00:00Z " ,
" submitted_at " : " 2024-06-01T12:00:00Z " ,
" last_submitted_at " : " 2024-06-02T12:00:00Z "
}
} {
" message " : " Unauthenticated "
} {
" message " : " This action is unauthorized. "
} {
" errors " : {},
" message " : " The request didn't pass validation "
}