Create purchase orders
The POST /pic/link/purchase-orders/create endpoint allows you to create purchase orders (POs) generated from an external system. ππΌπ€
Authorizationβ
This endpoint requires authentication through Basic Auth with the username and password of the backend that will consume it. To create and configure a backend, follow the backends tutorial
Request parametersβ
- π£ Path
- π Query
- πͺ Body
This request does not contain parameters of type Path
This request does not contain parameters of type Query
Request bodyβ
{
"inputs": [
PurchaseOrder
]
}
| Name | Type | Default | Description |
|---|---|---|---|
inputs | Array[PurchaseOrder] | Required | List of purchase orders to create |
PurchaseOrderβ
{
"header": PurchaseOrderHeader,
"items": [
PurchaseOrderItem
]
}
| Name | Type | Default | Description |
|---|---|---|---|
header | PurchaseOrderHeader | Required | PO header data |
items | Array[PurchaseOrderItem] | Required | List of PO positions |
PurchaseOrderHeaderβ
{
"purchaseOrderId": string,
"purchaseOrderType": PurchaseOrderType,
"accountingEntityId": string,
"vendorBusinessPartnerId": string,
"currencyId": string,
}
| Name | Type | Default | Description |
|---|---|---|---|
purchaseOrderId | string | Required | PO Identifier |
purchaseOrderType | PurchaseOrderType | Required | PO Type |
accountingEntityId | string | Required | Identifier of the tax entity that processes the OC |
vendorBusinessPartnerId | string | Required | Identifier of the business partner that provides the PO |
currencyId | string | Required | PC Currency |
The accountingEntityId and vendorBusinessPartnerId must correspond to the external mapping of an AppliQloud accounting entity and business partner.
PurchaseOrderTypeβ
Possible values: [LOCAL, IMPORT]
PurchaseOrderItemβ
{
"itemId": string,
"itemType": PurchaseOrderItemType,
"ascriptionType": PurchaseOrderAscriptionType,
"productGroupId": string,
"productId": string,
"locationId": string | null,
"storageId": string | null,
"requiredDeliveryDate": string | null,
"quantity": int,
"unitId": string,
"netUnitPrice": float
}
| Name | Type | Default | Description |
|---|---|---|---|
itemId | string | Required | Item identifier |
itemType | PurchaseOrderItemType | Required | Type of the item |
ascriptionType | PurchaseOrderAscriptionType | Required | Ascription type of the item |
productGroupId | string | Required | External identifier of the product group |
productId | string | Required | External identifier of the product |
locationId | string | null | null | External identifier of the delivery location |
storageId | string | null | null | Storage where the product will be stored |
requiredDeliveryDate | string | null | null | Required delivery date of the item |
quantity | int | Required | Quantity to buy |
unitId | string | false | Unit of measurement of quantity |
netUnitPrice | float | Required | Unit price of the product |
The ascriptionType value INVENTORY is only allowed when itemType value is GOODS. itemTypes with value SERVICE must have an ascriptionType value of EXPENSE.
The productGroupId, productId and locationId fields must correspond to external mapping values of an AppliQloud product group, product and location. The locationId field is optional unless the itemType field is INVENTORY, then it is required. Additionally, the product that the productId field corresponds to, must be a part of the product group that the productGroupId field corresponds to.
PurchaseOrderItemTypeβ
Possible values: [GOODS, SERVICE]
PurchaseOrderAscriptionTypeβ
Possible values: [INVENTORY, EXPENSE]
Examplesβ
- cURL
curl --location 'https://<identifier>.api.appliqloud.com/pic/link/purchase-orders/create' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic <token>' \
--data '{
"inputs": [
{
"header": {
"purchaseOrderId": "450000001",
"purchaseOrderType": "IMPORT",
"accountingEntityId": "AE1",
"vendorBusinessPartnerId": "9715",
"currencyId": "MXN"
},
"items": [
{
"itemId": "10",
"itemType": "GOODS",
"ascriptionType": "INVENTORY",
"productGroupId": "1",
"productId": "101",
"locationId": "MX-LOC",
"storageId": "123123",
"requiredDeliveryDate": "2024-07-22",
"quantity": 5,
"unitId": "EA",
"netUnitPrice": 6000
}
]
}
]
}'
Responsesβ
- β 201
- β οΈ 201 (with errors)
- π 401
- π§ 500
The purchase orders were created successfully
{
"success": [
{
"header": {
"purchaseOrderId": "450000001",
"purchaseOrderStatus": "OPEN",
"purchaseOrderType": "IMPORT",
"accountingEntityId": "AE1",
"vendorBusinessPartnerId": "9715",
"currencyId": "MXN",
"netTotalPrice": 6000.0
},
"items": [
{
"itemId": "10",
"itemType": "GOODS",
"ascriptionType": "EXPENSE",
"productGroupId": "1",
"productId": "101",
"locationId": "MX-LOC",
"storageId": "123123",
"requiredDeliveryDate": "2024-07-22",
"quantity": 5,
"unitId": "EA",
"netUnitPrice": 6000.0,
"netTotalPrice": 30000.0
}
]
}
],
"errors": []
}
There is an error in the request
{
"success": [],
"errors": [
{
"traceId": "3095a0a77f80436ba104eb2fc24ba343"
"cause": "InvalidProductException",
"message": "Product with external id 102 for backend SAP_APQ does not exist",
"context": {
"backendId": "SAP_APQ",
"productId": "102"
}
}
]
}
Authorization required or credentials are not correct
{
"traceId": "3095a0a77f80436ba104eb2fc24ba343"
"cause": "UnauthorizedException",
"message": "Authorization required"
}
Internal application error (contact support@appliqloud.com or open a support ticket)
{
"traceId": "3095a0a77f80436ba104eb2fc24ba343"
"cause": "InternalServerError",
"message": "Internal server error"
}