Create New Purchase Order

Updated 1 month ago ​by nussi

Overview

In order to create new purchase order, you can consume the endpoint presented in this article. In order to consume it, you must:

  • Be authenticated user

For information on how you can authenticate, see: Authentication

As soon as you do authentication and receive a valid token, it needs to be passed to the service call.

Endpoint

Example for such endpoint for TT server is:

https://tt.api.sellercloud.com/rest/api/PurchaseOrders​​

For your server endpoint will be:

https://{your_server_id}.api.sellercloud.com/rest/api/PurchaseOrders

Request

Information about expected request parameters can be found on swagger UI https://tt/api.sellercloud.com/rest/swagger.

  • Method Type: HttpPost
  • Authorization: Use Bearer Token (where 'Token' is the token received from token authentication)
  • Header info: Content-Type: application/json
  • Request Body:
{
"CompanyID": 0,
"VendorID": 0,
"POType": "PurchaseOrder",
"CaseQtyMode": true,
"DefaultWarehouseID": 0,
"Description": "string",
"VendorNote": "string",
"PaymentTermID": 0,
"ExpectedDeliveryDate": "2020-05-25T21:58:33.197Z",
"Products": [
{
"ProductID": "string",
"QtyUnitsOrdered": 0,
"UnitPrice": 0,
"QtyCasesOrdered": 0,
"QtyUnitsPerCase": 0,
"CasePrice": 0,
"DiscountType": "FixedAmount",
"DiscountValue": 0,
"WarehouseID": 0
}
],
"BillingAddress": {
"FirstName": "string",
"LastName": "string",
"MiddleName": "string",
"ZipCode": "string",
"City": "string",
"Country": "string",
"ContactName": "string",
"Business": "string",
"AddressLine1": "string",
"AddressLine2": "string",
"Fax": "string",
"Region": "string",
"State": "string",
"Phone": "string"
},
"ShippingAddress": {
"FirstName": "string",
"LastName": "string",
"MiddleName": "string",
"ZipCode": "string",
"City": "string",
"Country": "string",
"ContactName": "string",
"Business": "string",
"AddressLine1": "string",
"AddressLine2": "string",
"Fax": "string",
"Region": "string",
"State": "string",
"Phone": "string"
}
}

Parameter

Data Type

Description

Is Required

CompanyID

integer

PO company ID

true

VendorID

integer

PO vendor ID

true

POType

enum

PO type.

Possible values can be found here.

true

CaseQtyMode

bool

PO case quantity mode.

true

DefaultWarehouseID

integer

PO warehouse ID.

If provided this warehouse will be set for the PO and for all PO products.

Set to null or omit in the request if not needed.

false

Description

string

PO description

Set to null or omit in the request if not needed.

false

VendorNote

string

PO vendor note

Set to null or omit in the request if not needed.

false

PaymentTermID

int

Payment term ID.

Possible values can be obtained using this endpoint.

Set to null or omit in the request if not needed.

false

ExpectedDeliveryDate

date

PO expected delivery date. Should only be provided if client setting 'Force user to enter Expected Delivery Date' is enabled.

Set to null or omit in the request if not needed.

false

Products

List

List with PO product items

true

Product.ProductID

string

Product ID

true

Product.QtyUnitsOrdered

integer

Quantity of ordered units of this product.

Should only be set if case quantity mode is set to false.

Set to null or omit in the request if not needed.

false

Product.UnitPrice

decimal

Unit price.

Should only be set if case quantity mode is set to false.

false

Product.QtyCasesOrdered

integer

Quantity of ordered cases with this product.

Should only be set if case quantity mode is set to true.

Set to null or omit in the request if not needed.

false

Product.QtyUnitsPerCase

integer

Quantity of unites per case for this product.

Should only be set if case quantity mode is set to true.

Set to null or omit in the request if not needed.

false

Product.CasePrice

decimal

Price per case for this product.

Should only be set if case quantity mode is set to true.

Set to null or omit in the request if not needed.

false

Product.DiscountType

enum

Product discount type.

Possible values can be found here.

Can only be provided if client setting 'Enable Multi Discount for Purchase Order' is disabled.

Set to null or omit in the request if not needed.

false

Product.DiscountValue

decimal

Product discount value.

Can only be provided if client setting 'Enable Multi Discount for Purchase Order' is disabled.

Set to null or omit in the request if not needed.

false

Product.BillingAddress

Address

PO billing address.

Can only be provided if client setting 'Enable BillTo address for Purchase Orders' is enabled.

Set to null or omit in the request if not needed.

false

Product.ShippingAddress

Address

PO shipping address

Set to null or omit in the request if not needed.

false

Address.FirstName

string

First name

false

Address.LastName

string

Last name

false

Address.MiddleName

string

Middle name

false

Address.ZipCode

string

Zip code

false

Address.City

string

City

false

Address.Country

string

Two letter country code

true

Address.ContactName

string

Contact name

false

Address.Business

string

Business name

false

Address.AddressLine1

string

Address line 1

false

Address.AddressLine2

string

Address line 2

false

Address.Fax

string

Fax

false

Address.Region

string

Region

false

Address.State

string

State

false

Adress.Phone

string

Phone

false

Response

  • If user is authenticated and create purchase order is successful, then response will be Status Code 200 => OK and ID of the created purchase order is returned.
  • If user is not authenticated, then response will be Status Code 401 => Not Valid Token
  • In case of error, response will be Status Code 500 => Internal Server Error


How did we do?