Перейти до вмісту

Get a purchase order

POST
/purchaseOrders.get
curl --request POST \
--url https://api.sancho-wms.pl/v1/purchaseOrders.get \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "id": 1, "integrationId": 1 }'

Returns one purchase order with its lines (items). Identify it by integrationId and the id the list gives it. Its integrationType names the data model it follows, not the integration’s own type: a custom integration can return orders in the comarch-optima data model.

Media typeapplication/json
object
id
required
number | string
integrationId
required
number

Example generated

{
"id": 1,
"integrationId": 1
}

Successful response

Media typeapplication/json
PurchaseOrderDetails
One of: discriminator: integrationType
ComarchOptimaPurchaseOrderDetails
object
id
required
number | string
type
required
string
Allowed value: purchaseOrder
kind
required
string
Allowed values: order
documentNumber
required
string | null
externalNumber
required
string | null
orderDate
required
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
expectedDate
required
Any of:
string format: date
/^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))$/
warehouse
required
Any of:
object
id
required
number | string | null
code
required
string | null
name
required
string | null
supplier
required
Any of:
object
id
required
number | string
code
required
string | null
name
required
string
taxId
required
string | null
address
required
string | null
city
required
string | null
postalCode
required
string | null
country
required
string | null
countryCode
required
string | null
status
required
string
Allowed values: draft committed
active
required
boolean | null
vatTransactionKind
required
Any of:
string
Allowed values: domestic nonEu nonEuVatRefund intraCommunity intraCommunityTriangular domesticBuyerLiable outsideCountry outsideCountryNp intraCommunityBuyerLiable nonEuBuyerLiable ossProcedure smeProcedure
taxIdCountry
required
string | null
currency
required
string | null
province
required
string | null
phone
required
string | null
email
required
string | null
website
required
string | null
fax
required
string | null
regon
required
string | null
status
required
string
Allowed values: draft committed cancelled
currency
required
string | null
totalNet
required
number | null
totalGross
required
number | null
totalVat
required
number | null
items
required
Array<object>
object
productId
required
number | string | null
productCode
required
string | null
productName
required
string | null
quantity
required
number | null
unit
required
string | null
priceNet
required
number | null
valueNet
required
number | null
valueGross
required
number | null
vatRate
required
number | null
relatedDocuments
required
Array<object>
default:
RelatedDocumentOutput
One of: discriminator: integrationType
IntegrationRelatedDocumentOutput
One of: discriminator: integrationType
object
label
required
string | null
linkId
required
number | null
integrationType
required
string
Allowed values: comarch-optima erp-next fakturownia comarch-bmp custom
integrationId
required
number
id
required
number | string
type
required
string
Allowed value: goodsReceivedNote
kind
required
string
Allowed values: external internal
visualizationPath
required
string | null
integrationId
required
number
integrationType
required
string
Allowed value: comarch-optima

Example

{
"type": "purchaseOrder",
"kind": "order",
"supplier": {
"countryCode": null,
"status": "draft",
"vatTransactionKind": null,
"taxIdCountry": null,
"currency": null,
"province": null,
"phone": null,
"email": null,
"website": null,
"fax": null,
"regon": null
},
"status": "draft",
"relatedDocuments": [],
"integrationType": "comarch-optima"
}

Bad request

Media typeapplication/json
error.BAD_REQUEST

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "BAD_REQUEST",
"message": "Bad request",
"issues": []
}

Unauthorized

Media typeapplication/json
error.UNAUTHORIZED

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "UNAUTHORIZED",
"message": "Unauthorized",
"issues": []
}

Payment required

Media typeapplication/json
error.PAYMENT_REQUIRED

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "PAYMENT_REQUIRED",
"message": "Payment required",
"issues": []
}

Forbidden

Media typeapplication/json
error.FORBIDDEN

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "FORBIDDEN",
"message": "Forbidden",
"issues": []
}

Not found

Media typeapplication/json
error.NOT_FOUND

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "NOT_FOUND",
"message": "Not found",
"issues": []
}

Unprocessable content

Media typeapplication/json
error.UNPROCESSABLE_CONTENT

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "UNPROCESSABLE_CONTENT",
"message": "Unprocessable content",
"issues": []
}

Too many requests

Media typeapplication/json
error.TOO_MANY_REQUESTS

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "TOO_MANY_REQUESTS",
"message": "Too many requests",
"issues": []
}

Internal server error

Media typeapplication/json
error.INTERNAL_SERVER_ERROR

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}

Service unavailable

Media typeapplication/json
error.SERVICE_UNAVAILABLE

The error information

object
message
required

The error message

string
code
required

The error code

string
issues

An array of issues that were responsible for the error

Array<object>
object
message
required
string

Example

{
"code": "SERVICE_UNAVAILABLE",
"message": "Service unavailable",
"issues": []
}