I want to create a waybill for my customers who ordered from my website with aramex
the problem that show every time to me in this image it says there is problem with date format
this is the code i use:
import datetime
def send_issue_policy(request):
url = "https://ws.sbx.aramex.net/ShippingAPI.V2/Shipping/Service_1_0.svc/json/CreateShipments"
headers = {
"Content-Type": "application/json",
"Accept": "application/json"
}
payload = {
"ClientInfo": {
"UserName": "testingapi@aramex.com",
"Password": "R123456789$r",
"Version": "v1",
"AccountNumber": "4004636",
"AccountPin": "432432",
"AccountEntity": "RUH",
"AccountCountryCode": "SA",
"Source": 24
},
"Shipments": [
{
"Reference1": "",
"Reference2": "",
"Reference3": "",
"Shipper": {
"Reference1": "TEst mutli label",
"Reference2": "",
"AccountNumber": "4004636",
"PartyAddress": {
"Line1": "Test TEST",
"Line2": "",
"Line3": "",
"City": "riyadh",
"StateOrProvinceCode": "",
"PostCode": "",
"CountryCode": "sa",
"Longitude": 0,
"Latitude": 0,
"BuildingNumber": "null",
"BuildingName": "null",
"Floor": "null",
"Apartment": "null",
"POBox": "null",
"Description": "null"
},
"Contact": {
"Department": "",
"PersonName": "aramex",
"Title": "",
"CompanyName": "aramex",
"PhoneNumber1": "966512345678",
"PhoneNumber1Ext": "",
"PhoneNumber2": "",
"PhoneNumber2Ext": "",
"FaxNumber": "",
"CellPhone": "966512345678",
"EmailAddress": "test@test.com",
"Type": ""
}
},
"Consignee": {
"Reference1": "",
"Reference2": "",
"AccountNumber": "71500004",
"PartyAddress": {
"Line1": "Test",
"Line2": "",
"Line3": "",
"City": "riyadh",
"StateOrProvinceCode": "",
"PostCode": "",
"CountryCode": "sa",
"Longitude": 0,
"Latitude": 0,
"BuildingNumber": "",
"BuildingName": "",
"Floor": "",
"Apartment": "",
"POBox": "null",
"Description": ""
},
"Contact": {
"Department": "",
"PersonName": "aramex",
"Title": "",
"CompanyName": "aramex",
"PhoneNumber1": "966512345678",
"PhoneNumber1Ext": "",
"PhoneNumber2": "",
"PhoneNumber2Ext": "",
"FaxNumber": "",
"CellPhone": "966512345678",
"EmailAddress": "test@test.com",
"Type": ""
}
},
"ThirdParty": {
"Reference1": "",
"Reference2": "",
"AccountNumber": "71500004",
"PartyAddress": {
"Line1": "Test",
"Line2": "",
"Line3": "",
"City": "riyadh",
"StateOrProvinceCode": "3079",
"PostCode": "",
"CountryCode": "sa",
"Longitude": 0,
"Latitude": 0,
"BuildingNumber": "null",
"BuildingName": "null",
"Floor": "null",
"Apartment": "null",
"POBox": "null",
"Description": "null"
},
"Contact": {
"Department": "",
"PersonName": "test",
"Title": "",
"CompanyName": "test",
"PhoneNumber1": "966512345678",
"PhoneNumber1Ext": "",
"PhoneNumber2": "",
"PhoneNumber2Ext": "",
"FaxNumber": "",
"CellPhone": "966512345678",
"EmailAddress": "",
"Type": ""
}
},
"ShippingDateTime": "\/Date(1708718162000)\/",
"DueDate": "\/Date(1708718162000)\/",
"Comments": "",
"PickupLocation": "",
"OperationsInstructions": "",
"AccountingInstrcutions": "",
"Details": {
"Dimensions": "null",
"ActualWeight": {
"Unit": "KG",
"Value": 0.5
},
"ChargeableWeight": "null",
"DescriptionOfGoods": "Books",
"GoodsOriginCountry": "sa",
"NumberOfPieces": 1,
"ProductGroup": "DOM",
"ProductType": "CDS",
"PaymentType": "P",
"PaymentOptions": "",
"CustomsValueAmount": "null",
"CashOnDeliveryAmount": {
"CurrencyCode": "SAR",
"Value": 1.0
},
"InsuranceAmount": "null",
"CashAdditionalAmount": "null",
"CashAdditionalAmountDescription": "",
"CollectAmount": "null",
"Services": "CODS",
"Items": []
},
"Attachments": [],
"ForeignHAWB": "",
"TransportType ": 0,
"PickupGUID": "",
"Number": "",
"ScheduledDelivery": "null"
}
],
"Transaction": {
"Reference1": "",
"Reference2": "",
"Reference3": "",
"Reference4": "",
"Reference5": ""
}
}
response = requests.post(url, headers=headers, json=payload)
if response.status_code == 200:
# Request successful
data = response.json()
# Process the response data as needed
print(data)
else:
# Request unsuccessful
print(f"Request failed with status code {response.status_code}")
print(response.text)
i want to send the request to aramex to create new lable i want to return the lable number so i can use it with print lable or tracking or give the user number of his lable The problem here is when I want to send the order to Aramex, a time-related problem occurs in "ShippingDateTime" i tried many times put none of them works.