Purchase Orders
Create purchase order
Creates a new purchase order
POST
/
v1
/
purchase-orders
Create purchase order
curl --request POST \
--url https://api.light.inc/v1/purchase-orders \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "USD",
"purchaseOrderDate": "2023-12-25",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"description": "<string>",
"lines": [
{
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
'import requests
url = "https://api.light.inc/v1/purchase-orders"
payload = {
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "USD",
"purchaseOrderDate": "2023-12-25",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"description": "<string>",
"lines": [
{
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
vendorId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
companyEntityId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
ownerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
currency: 'USD',
purchaseOrderDate: '2023-12-25',
deliveryAddress: '<string>',
deliveryDate: '2023-12-25',
description: '<string>',
lines: [
{
description: '<string>',
costCenterId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
taxCodeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
unitPrice: 123,
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
}
],
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
})
};
fetch('https://api.light.inc/v1/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://api.light.inc/v1/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([
'vendorId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'companyEntityId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'ownerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'currency' => 'USD',
'purchaseOrderDate' => '2023-12-25',
'deliveryAddress' => '<string>',
'deliveryDate' => '2023-12-25',
'description' => '<string>',
'lines' => [
[
'description' => '<string>',
'costCenterId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'taxCodeId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'unitPrice' => 123,
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]
],
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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.light.inc/v1/purchase-orders"
payload := strings.NewReader("{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
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.light.inc/v1/purchase-orders")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/purchase-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseRequestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "IN_DRAFT",
"totalAmount": 123,
"totalNetAmount": 123,
"totalTaxAmount": 123,
"erpNumber": "<string>",
"description": "<string>",
"currency": "USD",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorEmail": "<string>",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"documentKey": "<string>",
"failureContext": {
"name": "<string>",
"type": "BAD_REQUEST",
"errors": [
{
"type": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"context": {}
}
]
},
"editStatus": "ALL_EDITS_ALLOWED",
"purchaseOrderDate": "2023-12-25",
"erpSyncedAt": "2023-11-07T05:31:56Z",
"lockedAt": "2023-11-07T05:31:56Z",
"closedAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"amount": 123,
"netAmount": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}Authorizations
apiKeyAuthbearerAuth
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
Body
application/json;charset=UTF-8
Example:
"USD"
Show child attributes
Show child attributes
List of custom properties to set on the vendor. Replaces the existing set.
Show child attributes
Show child attributes
Response
default - application/json;charset=UTF-8
default response
⚠️ This enum is not exhaustive; new values may be added in the future.
Available options:
IN_DRAFT, RESET_PENDING, APPROVED_ACCOUNTING_ENTRY_PENDING, OPEN, CLOSE_PENDING, CLOSED, CANCEL_PENDING, CANCELLED Example:
"USD"
Failure context when vendor onboarding fails.
Show child attributes
Show child attributes
⚠️ This enum is not exhaustive; new values may be added in the future.
Available options:
ALL_EDITS_ALLOWED, ALL_EDITS_LOCKED, CORE_EDITS_LOCKED Show child attributes
Show child attributes
Custom properties set on the vendor.
Show child attributes
Show child attributes
⌘I
Create purchase order
curl --request POST \
--url https://api.light.inc/v1/purchase-orders \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "USD",
"purchaseOrderDate": "2023-12-25",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"description": "<string>",
"lines": [
{
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"inlineValues": [
"<string>"
]
}
]
}
'import requests
url = "https://api.light.inc/v1/purchase-orders"
payload = {
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"currency": "USD",
"purchaseOrderDate": "2023-12-25",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"description": "<string>",
"lines": [
{
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"valueIds": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"],
"inlineValues": ["<string>"]
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({
vendorId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
companyEntityId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
ownerId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
currency: 'USD',
purchaseOrderDate: '2023-12-25',
deliveryAddress: '<string>',
deliveryDate: '2023-12-25',
description: '<string>',
lines: [
{
description: '<string>',
costCenterId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
accountId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
taxCodeId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
quantity: 123,
unitPrice: 123,
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
}
],
customProperties: [
{
groupId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
valueIds: ['3c90c3cc-0d44-4b50-8888-8dd25736052a'],
inlineValues: ['<string>']
}
]
})
};
fetch('https://api.light.inc/v1/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://api.light.inc/v1/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([
'vendorId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'companyEntityId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'ownerId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'currency' => 'USD',
'purchaseOrderDate' => '2023-12-25',
'deliveryAddress' => '<string>',
'deliveryDate' => '2023-12-25',
'description' => '<string>',
'lines' => [
[
'description' => '<string>',
'costCenterId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'accountId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'taxCodeId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'quantity' => 123,
'unitPrice' => 123,
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]
],
'customProperties' => [
[
'groupId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'valueIds' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
],
'inlineValues' => [
'<string>'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$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.light.inc/v1/purchase-orders"
payload := strings.NewReader("{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
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.light.inc/v1/purchase-orders")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/purchase-orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"vendorId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"companyEntityId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"ownerId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"currency\": \"USD\",\n \"purchaseOrderDate\": \"2023-12-25\",\n \"deliveryAddress\": \"<string>\",\n \"deliveryDate\": \"2023-12-25\",\n \"description\": \"<string>\",\n \"lines\": [\n {\n \"description\": \"<string>\",\n \"costCenterId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"accountId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"taxCodeId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"quantity\": 123,\n \"unitPrice\": 123,\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n }\n ],\n \"customProperties\": [\n {\n \"groupId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"valueIds\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ],\n \"inlineValues\": [\n \"<string>\"\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"createdBy": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyEntityId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseRequestId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"state": "IN_DRAFT",
"totalAmount": 123,
"totalNetAmount": 123,
"totalTaxAmount": 123,
"erpNumber": "<string>",
"description": "<string>",
"currency": "USD",
"ownerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"vendorEmail": "<string>",
"deliveryAddress": "<string>",
"deliveryDate": "2023-12-25",
"documentKey": "<string>",
"failureContext": {
"name": "<string>",
"type": "BAD_REQUEST",
"errors": [
{
"type": "<string>",
"message": "<string>",
"path": [
"<string>"
],
"context": {}
}
]
},
"editStatus": "ALL_EDITS_ALLOWED",
"purchaseOrderDate": "2023-12-25",
"erpSyncedAt": "2023-11-07T05:31:56Z",
"lockedAt": "2023-11-07T05:31:56Z",
"closedAt": "2023-11-07T05:31:56Z",
"cancelledAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"lines": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"purchaseOrderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"description": "<string>",
"costCenterId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"accountId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"taxCodeId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"quantity": 123,
"unitPrice": 123,
"amount": 123,
"netAmount": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}
],
"customProperties": [
{
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"values": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"groupInternalName": "<string>",
"companyId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"internalName": "<string>",
"label": "<string>",
"context": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
]
}
]
}