def test_purchase_order():
url = 'https://ssa.safeguardeurope.com/Sicon.Sage200.WebAPI/api/' + 'POPTest/CreatePurchaseOrder?company_id=4'
from datetime import datetime, timedelta
payload = {
"DocumentNo": "206-0607633308-0231562",
"DocumentType": "Order",
"Header": {'SupplierReference': 'EDIN01',
"Address": {
"Description": "",
"PostalName": "John Doe",
"AddressLine1": "123 Main St",
"AddressLine2": "Apt 4B",
"AddressLine3": "District",
"AddressLine4": "City",
"PostCode": "12345",
"City": "",
"County": "",
"Country": "",
"CountryCode": "",
"Contact": "",
"TelephoneNo": "",
"Fax": "",
"EmailAddress": "",
"TaxCode": ""},
"CreatedByUsername": "username",
"DocumentDate": "2023-08-22T10:15:00Z",
"CustomerDocumentNo": "206-0607633308-0231562",
"RequestedDate": "2023-08-22T09:00:00Z",
},
"NewStandardLines": [{"WarehouseName": "HOR",
"ItemCode": "TM-NOPE-MOTH-KIT"}],
"NewFreeTextLines": [
{
"ItemDescription": "string"
}],
"NewAdditionalChargeLines": [
{"ItemCode": "DELIVERY"}
],
"NewCommentLines": [
{"ItemDescription": "Test Description"}
]
}
response = request('POST', url, data=payload, headers=get_headers())
print(response.content)