cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/purchase_invoices" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"purchase_invoice": {
"account_id": "ACC0001",
"lines": [
{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": {
"pricing_rule": {
"price": 5
}
}
}
]
}
}'from exsited import build_client
client = build_client()
response = client.purchase_invoices.create_purchase_invoice(
{
"purchase_invoice": {
"account_id": "ACC0001",
"lines": [
{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": {"pricing_rule": {"price": 5}},
}
],
}
}
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.purchaseInvoices.createPurchaseInvoice({
purchase_invoice: {
account_id: 'ACC0001',
lines: [{item_name: 'Copy paper A4', item_quantity: 1, item_price_snapshot: {pricing_rule: {price: 5}}}],
},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->purchaseInvoices->createPurchaseInvoice([
'purchase_invoice' => [
'account_id' => 'ACC0001',
'lines' => [
[
'item_name' => 'Copy paper A4',
'item_quantity' => 1,
'item_price_snapshot' => ['pricing_rule' => ['price' => 5]],
],
],
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.purchase_invoices.purchase_invoices_dto.PurchaseInvoicesDto.PurchaseInvoiceRead;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<PurchaseInvoiceRead> response = client.purchaseInvoices().createPurchaseInvoice(
Map.of(
"purchase_invoice", Map.of(
"account_id", "ACC0001",
"lines", List.of(
Map.of(
"item_name", "Copy paper A4",
"item_quantity", 1,
"item_price_snapshot", Map.of(
"pricing_rule", Map.of("price", 5)))))));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.PurchaseInvoices.CreatePurchaseInvoiceAsync(new Dictionary<string, object?>
{
["purchase_invoice"] = new Dictionary<string, object?>
{
["account_id"] = "ACC0001",
["lines"] = new List<object?>
{
new Dictionary<string, object?>
{
["item_name"] = "Copy paper A4",
["item_quantity"] = 1,
["item_price_snapshot"] = new Dictionary<string, object?>
{
["pricing_rule"] = new Dictionary<string, object?>
{
["price"] = 5,
},
},
},
},
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.purchaseInvoices.createPurchaseInvoice({
'purchase_invoice': {
'account_id': 'ACC0001',
'lines': [
{
'item_name': 'Copy paper A4',
'item_quantity': 1,
'item_price_snapshot': {
'pricing_rule': {'price': 5},
},
},
],
},
});
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.PurchaseInvoices().CreatePurchaseInvoice(context.Background(), map[string]any{
"purchase_invoice": map[string]any{
"account_id": "ACC0001",
"lines": []any{
map[string]any{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": map[string]any{
"pricing_rule": map[string]any{"price": 5},
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"purchase_invoice": {
"account": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"activity_logs": [
"<unknown>"
],
"alternate_due_date": "<string>",
"alternate_issue_date": "<string>",
"created_by": {
"name": "<string>",
"object": "<string>"
},
"created_on": "<string>",
"currency": {
"code": "<string>",
"href": "<string>",
"id": "<string>",
"name": "<string>",
"object": "<string>"
},
"custom_attributes": [
{
"href": "<string>",
"id": "<string>",
"name": "<string>",
"object": "<string>",
"type": "<string>",
"value": "<string>"
}
],
"custom_form": "<unknown>",
"due_date": "<string>",
"id": "<string>",
"issue_date": "<string>",
"kpis": {
"credit_applied": "<string>",
"credit_issued": "<string>",
"deleted_on": "<unknown>",
"last_amended_on": "<unknown>",
"last_cancelled_on": "<unknown>",
"last_payment_date": "<unknown>",
"last_reactivated_on": "<unknown>",
"object": "<string>",
"outstanding": "<string>",
"overdue": "<string>",
"payment_applied": "<string>",
"voided_on": "<unknown>"
},
"last_updated_by": {
"name": "<string>",
"object": "<string>"
},
"last_updated_on": "<string>",
"lines": [
{
"accounting_code": "<string>",
"id": "<string>",
"item": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"object": "<string>",
"quantity": 123,
"subtotal": "<string>",
"tax": "<string>",
"total": "<string>",
"uom": "<string>",
"version": 123,
"warehouse": "<string>"
}
],
"object": "<string>",
"origin": "<string>",
"payment_status": "<string>",
"price_tax_inclusive": true,
"purchase_order": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
},
"status": "<string>",
"subtotal": "<string>",
"tax": "<string>",
"total": "<string>",
"uuid": "<string>",
"version": 123
}
}Purchase invoices
Create a purchase invoice
Creates a purchase invoice for a supplier and returns it under purchase_invoice.
POST
/
purchase_invoices
cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/purchase_invoices" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"purchase_invoice": {
"account_id": "ACC0001",
"lines": [
{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": {
"pricing_rule": {
"price": 5
}
}
}
]
}
}'from exsited import build_client
client = build_client()
response = client.purchase_invoices.create_purchase_invoice(
{
"purchase_invoice": {
"account_id": "ACC0001",
"lines": [
{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": {"pricing_rule": {"price": 5}},
}
],
}
}
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.purchaseInvoices.createPurchaseInvoice({
purchase_invoice: {
account_id: 'ACC0001',
lines: [{item_name: 'Copy paper A4', item_quantity: 1, item_price_snapshot: {pricing_rule: {price: 5}}}],
},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->purchaseInvoices->createPurchaseInvoice([
'purchase_invoice' => [
'account_id' => 'ACC0001',
'lines' => [
[
'item_name' => 'Copy paper A4',
'item_quantity' => 1,
'item_price_snapshot' => ['pricing_rule' => ['price' => 5]],
],
],
],
]);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.purchase_invoices.purchase_invoices_dto.PurchaseInvoicesDto.PurchaseInvoiceRead;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<PurchaseInvoiceRead> response = client.purchaseInvoices().createPurchaseInvoice(
Map.of(
"purchase_invoice", Map.of(
"account_id", "ACC0001",
"lines", List.of(
Map.of(
"item_name", "Copy paper A4",
"item_quantity", 1,
"item_price_snapshot", Map.of(
"pricing_rule", Map.of("price", 5)))))));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.PurchaseInvoices.CreatePurchaseInvoiceAsync(new Dictionary<string, object?>
{
["purchase_invoice"] = new Dictionary<string, object?>
{
["account_id"] = "ACC0001",
["lines"] = new List<object?>
{
new Dictionary<string, object?>
{
["item_name"] = "Copy paper A4",
["item_quantity"] = 1,
["item_price_snapshot"] = new Dictionary<string, object?>
{
["pricing_rule"] = new Dictionary<string, object?>
{
["price"] = 5,
},
},
},
},
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.purchaseInvoices.createPurchaseInvoice({
'purchase_invoice': {
'account_id': 'ACC0001',
'lines': [
{
'item_name': 'Copy paper A4',
'item_quantity': 1,
'item_price_snapshot': {
'pricing_rule': {'price': 5},
},
},
],
},
});
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.PurchaseInvoices().CreatePurchaseInvoice(context.Background(), map[string]any{
"purchase_invoice": map[string]any{
"account_id": "ACC0001",
"lines": []any{
map[string]any{
"item_name": "Copy paper A4",
"item_quantity": 1,
"item_price_snapshot": map[string]any{
"pricing_rule": map[string]any{"price": 5},
},
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"purchase_invoice": {
"account": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"activity_logs": [
"<unknown>"
],
"alternate_due_date": "<string>",
"alternate_issue_date": "<string>",
"created_by": {
"name": "<string>",
"object": "<string>"
},
"created_on": "<string>",
"currency": {
"code": "<string>",
"href": "<string>",
"id": "<string>",
"name": "<string>",
"object": "<string>"
},
"custom_attributes": [
{
"href": "<string>",
"id": "<string>",
"name": "<string>",
"object": "<string>",
"type": "<string>",
"value": "<string>"
}
],
"custom_form": "<unknown>",
"due_date": "<string>",
"id": "<string>",
"issue_date": "<string>",
"kpis": {
"credit_applied": "<string>",
"credit_issued": "<string>",
"deleted_on": "<unknown>",
"last_amended_on": "<unknown>",
"last_cancelled_on": "<unknown>",
"last_payment_date": "<unknown>",
"last_reactivated_on": "<unknown>",
"object": "<string>",
"outstanding": "<string>",
"overdue": "<string>",
"payment_applied": "<string>",
"voided_on": "<unknown>"
},
"last_updated_by": {
"name": "<string>",
"object": "<string>"
},
"last_updated_on": "<string>",
"lines": [
{
"accounting_code": "<string>",
"id": "<string>",
"item": {
"object": "<string>",
"id": "<string>",
"name": "<string>",
"href": "<string>"
},
"object": "<string>",
"quantity": 123,
"subtotal": "<string>",
"tax": "<string>",
"total": "<string>",
"uom": "<string>",
"version": 123,
"warehouse": "<string>"
}
],
"object": "<string>",
"origin": "<string>",
"payment_status": "<string>",
"price_tax_inclusive": true,
"purchase_order": {
"href": "<string>",
"id": "<string>",
"object": "<string>"
},
"status": "<string>",
"subtotal": "<string>",
"tax": "<string>",
"total": "<string>",
"uuid": "<string>",
"version": 123
}
}Creates a purchase invoice from a supplier’s
account_id and its lines, wrapped in purchase_invoice. A line takes an existing item by item_id, or a new one by item_name with a price under item_price_snapshot. The new invoice is active.
The SDK samples get their client from credentials your app registers once when it starts, as shown in Authentication. To try the call here, click Try it, set
host to your Exsited API host name and paste an access token from Get an access token. To send a raw JSON body instead of filling in fields, copy the cURL sample and edit its -d payload.Authorizations
An access token from POST /api/v4/oauth2/token. The SDKs get and renew it for you.
Body
application/json
Show child attributes
Show child attributes
Response
201 - application/json
The new purchase invoice, under purchase_invoice.
Show child attributes
Show child attributes