I’ll start by saying I am quite new to API’s so sorry if this is a stupid question. I have been using API’s for a few weeks and been quite successful, however I have come across an issue that i just cannot solve, but i guess it is pretty easy.
I am wanting to get a list of rates back from a shipping API, so obviously I have to give it some information, however some of this information has to be in an object and I have no idea how to pass an object in the API. Infact I cannot get the API to initialise in the plugin section as I dont know the format. Below is what I need to send to the API. This is the raw body text from POSTMAN
{
"origin_address": {
"line_1": "125 Any Street",
"line_2": "Dalton",
"state": "Newport",
"city": "South Wales",
"postal_code": "HD1 5RR",
"country_alpha2": "GB",
"company_name": "Company Name",
"contact_name": "Contact Name",
"contact_phone": "074014585635",
"contact_email": "[email protected]"
},
"destination_address": {
"line_1": "Sttutter Gart",
"line_2": "Somewhere in DE",
"state": "Somweher else in DE",
"city": "Berlin",
"postal_code": "123456",
"country_alpha2": "DE",
"company_name": "Company name",
"contact_name": "Contact Name",
"contact_phone": "003198989898",
"contact_email": "[email protected]"
},
"incoterms": "DDU",
"insurance": {
"is_insured": true,
"insured_amount": 150,
"insured_currency": "GBP"
},
"courier_selection": {
"apply_shipping_rules": true
},
"shipping_settings": {
"units": {
"weight": "kg",
"dimension": "cm"
}
},
"parcels": [
{
"box": {
"length": 5,
"width": 5,
"height": 5
},
"items": [
{
"quantity": 1,
"description": "clothes",
"category": "Fashion",
"hs_code": "12345",
"origin_country_alpha2": "GB",
"declared_currency": "GBP",
"declared_customs_value": 10
},
{
"quantity": 5,
"description": "more stuff",
"category": "Fashion",
"hs_code": "1234555",
"origin_country_alpha2": "GB",
"declared_currency": "GBP",
"declared_customs_value": 2
}
],
"total_actual_weight": 0.2
}
]
}