WPCargo API add on Routes

These guides cover:


The following list are the API routes

1. mysite.com/wp-json/wpcargo/v1/api/api_key

This route will display user all created shipments or assigned shipments, the default number of shipment display is 12, to display succeeding shipment use this route mysite.com/wp-json/wpcargo/v1/api/api_key/page/page_number.

Request:

/api/###############

Sample Data Response

 {
        "ID": "2689",
        "post_author": "1",
        "post_date": "2020-06-16 00:01:27",
        "post_date_gmt": "2020-06-16 00:01:27",
        "post_title": "PCW01474680-CARGO",
        "post_name": "pcw01474680-cargo",
        "post_modified": "2020-06-16 07:34:00",
        "post_modified_gmt": "2020-06-16 07:34:00",
        "registered_shipper": "Arni Cinco",
        "registered_receiver": "",
        "wpcargo_driver": "Mark Rooster",
        "shipment_history": [
            {
                "date": "2020-06-16",
                "time": "05:08am",
                "location": "san Lorenzo Lucas",
                "status": "Processing",
                "updated-name": "Mark Rooster",
                "remarks": "item out for delivery\r\n\r\n"
            }
        ],
        "wpcargo_shipper_name": "Marco Polo",
        "wpcargo_shipper_phone": "955447778",
        "wpcargo_shipper_address": "San Juan St.",
        "wpcargo_shipper_email": "jdegayojr@woosteps.com",
        "wpcargo_receiver_name": "Juana Julia",
        "wpcargo_receiver_phone": "955447778",
        "wpcargo_receiver_address": "7 Sweetland Road",
        "wpcargo_receiver_email": "democlient@mail.com",
        "wpcargo_type_of_shipment": "",
        "wpcargo_weight": "",
        "wpcargo_courier": "",
        "wpcargo_packages": "",
        "wpcargo_mode_field": "SAS",
        "wpcargo_product": "",
        "wpcargo_qty": "",
        "payment_wpcargo_mode_field": "Cheque",
        "wpcargo_total_freight": "",
        "wpccf_attachment": "",
        "hello": "",
        "wpcargo_carrier_ref_number": "",
        "wpcargo_departure_time_picker": "",
        "wpcargo_origin_field": "",
        "wpcargo_destination": "",
        "wpcargo_pickup_date_picker": "",
        "wpcargo_comments": "",
        "file_upload": "",
        "shipment_images": "",
        "wpc-multiple-package": [
            {
                "wpc-pm-qty": "1",
                "wpc-pm-piece-type": "Carton",
                "wpc-pm-description": "RTW",
                "wpc-pm-length": "120 cm",
                "wpc-pm-width": "120 cm",
                "wpc-pm-height": "120 cm",
                "wpc-pm-weight": "12 lbs"
            }
        ]
    }

2. mysite.com/wp-json/wpcargo/v1/api/api_key/driver

This route is exclusive only for the WPCargo Driver role, it will display all the shipments assigned to driver. the default number of shipment display is 12, to display succeeding shipment use this route mysite.com/wp-json/wpcargo/v1/api/api_key/driver/page/page_number.
Request:

/api/###############/driver

Sample Data Response

 {
        "ID": "2689",
        "post_author": "1",
        "post_date": "2020-06-16 00:01:27",
        "post_date_gmt": "2020-06-16 00:01:27",
        "post_title": "PCW01474680-CARGO",
        "post_name": "pcw01474680-cargo",
        "post_modified": "2020-06-16 07:34:00",
        "post_modified_gmt": "2020-06-16 07:34:00",
        "registered_shipper": "Arni Cinco",
        "registered_receiver": "",
        "wpcargo_driver": "Mark Rooster",
        "shipment_history": [
            {
                "date": "2020-06-16",
                "time": "05:08am",
                "location": "san Lorenzo Lucas",
                "status": "Processing",
                "updated-name": "Mark Rooster",
                "remarks": "item out for delivery\r\n\r\n"
            }
        ],
        "wpcargo_shipper_name": "Marco Polo",
        "wpcargo_shipper_phone": "955447778",
        "wpcargo_shipper_address": "San Juan St.",
        "wpcargo_shipper_email": "jdegayojr@woosteps.com",
        "wpcargo_receiver_name": "Juana Julia",
        "wpcargo_receiver_phone": "955447778",
        "wpcargo_receiver_address": "7 Sweetland Road",
        "wpcargo_receiver_email": "democlient@mail.com",
        "wpcargo_type_of_shipment": "",
        "wpcargo_weight": "",
        "wpcargo_courier": "",
        "wpcargo_packages": "",
        "wpcargo_mode_field": "SAS",
        "wpcargo_product": "",
        "wpcargo_qty": "",
        "payment_wpcargo_mode_field": "Cheque",
        "wpcargo_total_freight": "",
        "wpccf_attachment": "",
        "hello": "",
        "wpcargo_carrier_ref_number": "",
        "wpcargo_departure_time_picker": "",
        "wpcargo_origin_field": "",
        "wpcargo_destination": "",
        "wpcargo_pickup_date_picker": "",
        "wpcargo_comments": "",
        "file_upload": "",
        "shipment_images": "",
        "wpc-multiple-package": [
            {
                "wpc-pm-qty": "1",
                "wpc-pm-piece-type": "Carton",
                "wpc-pm-description": "RTW",
                "wpc-pm-length": "120 cm",
                "wpc-pm-width": "120 cm",
                "wpc-pm-height": "120 cm",
                "wpc-pm-weight": "12 lbs"
            }
        ]
    }

3. mysite.com/wp-json/wpcargo/v1/api/api_key/shipment/add

This route is use in adding shipments using the WPCargo API, please refer to this How to add shipment using API through AJAX documentation on how to use it.
Request:

{
    'wpcargo_shipper_name' : 'Juan dela Cruz',
    'wpcargo_shipper_phone' : '1234567890',
    'wpcargo_shipper_address' : 'San Pablo',
    'wpcargo_shipper_email' : 'juandelacruz@mail.com',
    'wpcargo_receiver_name' : 'Jane Cruz',
    'wpcargo_receiver_phone' : '1234567890',
    'wpcargo_receiver_address' : 'San Lucas',
    'wpcargo_receiver_email' : 'jane@mail.com',
}

Sample Data Response

{
    "id": 1234,
    "shipment_number": "PCW01685734-CARGO",
    "message": "Shipment Added",
    "status": "success",
    "upload_error": [],
    "attachment": []
}

4. mysite.com/wp-json/wpcargo/v1/api/api_key/shipment/update

This route is use in updating shipments using the WPCargo API, please refer to this How to update shipment using API through AJAX documentation on how to use it.
Request:

{
    'shipment' : 'PCW01685734-CARGO',
    'wpcargo_shipper_name' : 'Juan dela Cruz',
    'wpcargo_shipper_phone' : '1234567890',
    'wpcargo_shipper_address' : 'San Pablo',
    'wpcargo_shipper_email' : 'juandelacruz@mail.com',
    'wpcargo_receiver_name' : 'Jane Cruz',
    'wpcargo_receiver_phone' : '1234567890',
    'wpcargo_receiver_address' : 'San Lucas',
    'wpcargo_receiver_email' : 'jane@mail.com',
}

Sample Data Response

{
    "id": "1234",
    "shipment_number": "PCW01685734-CARGO",
    "message": "Shipment Updated",
    "status": "success",
    "upload_error": [],
    "attachment": []
}

5. mysite.com/wp-json/wpcargo/v1/api/api_key/shipment/track/{shipment_number}

This route is use in tracking shipments using the WPCargo API.
Request:

/api/###############/shipment/track/PCW01474680-CARGO

Sample Data Response

 {
        "ID": "123",
        "post_author": "1",
        "post_date": "2020-06-16 00:01:27",
        "post_date_gmt": "2020-06-16 00:01:27",
        "post_title": "PCW01474680-CARGO",
        "post_name": "pcw01474680-cargo",
        "post_modified": "2020-06-16 07:34:00",
        "post_modified_gmt": "2020-06-16 07:34:00",
        "registered_shipper": "Arni Cinco",
        "registered_receiver": "",
        "wpcargo_driver": "Mark Rooster",
        "shipment_history": [
            {
                "date": "2020-06-16",
                "time": "05:08am",
                "location": "san Lorenzo Lucas",
                "status": "Processing",
                "updated-name": "Mark Rooster",
                "remarks": "item out for delivery\r\n\r\n"
            }
        ],
        "wpcargo_shipper_name": "Marco Polo",
        "wpcargo_shipper_phone": "955447778",
        "wpcargo_shipper_address": "San Juan St.",
        "wpcargo_shipper_email": "jdegayojr@woosteps.com",
        "wpcargo_receiver_name": "Juana Julia",
        "wpcargo_receiver_phone": "955447778",
        "wpcargo_receiver_address": "7 Sweetland Road",
        "wpcargo_receiver_email": "democlient@mail.com",
        "wpcargo_type_of_shipment": "",
        "wpcargo_weight": "",
        "wpcargo_courier": "",
        "wpcargo_packages": "",
        "wpcargo_mode_field": "SAS",
        "wpcargo_product": "",
        "wpcargo_qty": "",
        "payment_wpcargo_mode_field": "Cheque",
        "wpcargo_total_freight": "",
        "wpccf_attachment": "",
        "hello": "",
        "wpcargo_carrier_ref_number": "",
        "wpcargo_departure_time_picker": "",
        "wpcargo_origin_field": "",
        "wpcargo_destination": "",
        "wpcargo_pickup_date_picker": "",
        "wpcargo_comments": "",
        "file_upload": "",
        "shipment_images": "",
        "wpc-multiple-package": [
            {
                "wpc-pm-qty": "1",
                "wpc-pm-piece-type": "Carton",
                "wpc-pm-description": "RTW",
                "wpc-pm-length": "120 cm",
                "wpc-pm-width": "120 cm",
                "wpc-pm-height": "120 cm",
                "wpc-pm-weight": "12 lbs"
            }
        ]
    }

6. mysite.com/wp-json/wpcargo/v1/api/api_key/page-total

This route is use to get total number of shipment page. This route will response the number of pages available

7. mysite.com/wp-json/wpcargo/v1/api/api_key/page/number

This route is use to get shipment data per page. “number” accepts numeric value. This will display the shipment list under the selected page.
Request:

/api/###############/page/2

Sample Data Response

 {
        "ID": "2689",
        "post_author": "1",
        "post_date": "2020-06-16 00:01:27",
        "post_date_gmt": "2020-06-16 00:01:27",
        "post_title": "PCW01474680-CARGO",
        "post_name": "pcw01474680-cargo",
        "post_modified": "2020-06-16 07:34:00",
        "post_modified_gmt": "2020-06-16 07:34:00",
        "registered_shipper": "Arni Cinco",
        "registered_receiver": "",
        "wpcargo_driver": "Mark Rooster",
        "shipment_history": [
            {
                "date": "2020-06-16",
                "time": "05:08am",
                "location": "san Lorenzo Lucas",
                "status": "Processing",
                "updated-name": "Mark Rooster",
                "remarks": "item out for delivery\r\n\r\n"
            }
        ],
        "wpcargo_shipper_name": "Marco Polo",
        "wpcargo_shipper_phone": "955447778",
        "wpcargo_shipper_address": "San Juan St.",
        "wpcargo_shipper_email": "jdegayojr@woosteps.com",
        "wpcargo_receiver_name": "Juana Julia",
        "wpcargo_receiver_phone": "955447778",
        "wpcargo_receiver_address": "7 Sweetland Road",
        "wpcargo_receiver_email": "democlient@mail.com",
        "wpcargo_type_of_shipment": "",
        "wpcargo_weight": "",
        "wpcargo_courier": "",
        "wpcargo_packages": "",
        "wpcargo_mode_field": "SAS",
        "wpcargo_product": "",
        "wpcargo_qty": "",
        "payment_wpcargo_mode_field": "Cheque",
        "wpcargo_total_freight": "",
        "wpccf_attachment": "",
        "hello": "",
        "wpcargo_carrier_ref_number": "",
        "wpcargo_departure_time_picker": "",
        "wpcargo_origin_field": "",
        "wpcargo_destination": "",
        "wpcargo_pickup_date_picker": "",
        "wpcargo_comments": "",
        "file_upload": "",
        "shipment_images": "",
        "wpc-multiple-package": [
            {
                "wpc-pm-qty": "1",
                "wpc-pm-piece-type": "Carton",
                "wpc-pm-description": "RTW",
                "wpc-pm-length": "120 cm",
                "wpc-pm-width": "120 cm",
                "wpc-pm-height": "120 cm",
                "wpc-pm-weight": "12 lbs"
            }
        ]
    }

8. mysite.com/wp-json/wpcargo/v1/api/api_key/shipment/fields

This route is use view available shipment form fields
Request:

/api/###############/shipment/fields

Sample Data response

{
    "shipper_info": [
        {
            "id": "1",
            "label": "Shipper Name",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_shipper_name",
            "required": "",
            "weight": "0",
            "section": "shipper_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "2",
            "label": "Phone Number",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_shipper_phone",
            "required": "",
            "weight": "1",
            "section": "shipper_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "3",
            "label": "Address",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_shipper_address",
            "required": "",
            "weight": "2",
            "section": "shipper_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "4",
            "label": "Email",
            "description": "",
            "field_type": "email",
            "field_key": "wpcargo_shipper_email",
            "required": "",
            "weight": "3",
            "section": "shipper_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "36",
            "label": "Attachment",
            "description": "",
            "field_type": "file",
            "field_key": "wpccf_attachment",
            "required": "",
            "weight": "26",
            "section": "shipper_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        }
    ],
    "receiver_info": [
        {
            "id": "5",
            "label": "Receiver Name",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_receiver_name",
            "required": "",
            "weight": "4",
            "section": "receiver_info",
            "display_flags": [
                "multi-receiver",
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "6",
            "label": "Phone Number",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_receiver_phone",
            "required": "",
            "weight": "5",
            "section": "receiver_info",
            "display_flags": [
                "multi-receiver",
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "7",
            "label": "Address",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_receiver_address",
            "required": "",
            "weight": "6",
            "section": "receiver_info",
            "display_flags": [
                "multi-receiver",
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "8",
            "label": "Email",
            "description": "",
            "field_type": "email",
            "field_key": "wpcargo_receiver_email",
            "required": "",
            "weight": "7",
            "section": "receiver_info",
            "display_flags": [
                "multi-receiver",
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "14",
            "label": "Mode",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_mode_field",
            "required": "",
            "weight": "15",
            "section": "receiver_info",
            "display_flags": [
                "result",
                "editor",
                "contributor",
                "subscriber",
                "customer",
                "shop_manager",
                "wpseo_manager",
                "wpseo_editor",
                "wpcargo_driver"
            ],
            "field_data": [
                "Level 1",
                " Level 2",
                " Level 3",
                " Level 4"
            ],
            "status": ""
        },
        {
            "id": "17",
            "label": "Payment Mode",
            "description": "",
            "field_type": "radio",
            "field_key": "payment_wpcargo_mode_field",
            "required": "",
            "weight": "17",
            "section": "receiver_info",
            "display_flags": [
                "multi-receiver",
                "result"
            ],
            "field_data": [
                "Cash",
                " BAC",
                " Cheque"
            ],
            "status": ""
        },
        {
            "id": "35",
            "label": "File Upload",
            "description": "",
            "field_type": "file",
            "field_key": "file_upload",
            "required": "",
            "weight": "25",
            "section": "receiver_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                "FREE",
                " Standard",
                " Premium"
            ],
            "status": ""
        }
    ],
    "shipment_info": [
        {
            "id": "10",
            "label": "Type of Shipment",
            "description": "",
            "field_type": "select",
            "field_key": "wpcargo_type_of_shipment",
            "required": "",
            "weight": "9",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                "Test 1",
                " Test2"
            ],
            "status": ""
        },
        {
            "id": "11",
            "label": "Weight",
            "description": "",
            "field_type": "number",
            "field_key": "wpcargo_weight",
            "required": "",
            "weight": "10",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "13",
            "label": "Packages",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_packages",
            "required": "",
            "weight": "12",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "15",
            "label": "Product",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_product",
            "required": "",
            "weight": "13",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "16",
            "label": "Quantity",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_qty",
            "required": "",
            "weight": "14",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "18",
            "label": "Total Freight",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_total_freight",
            "required": "",
            "weight": "18",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "20",
            "label": "Carrier Reference No.",
            "description": "",
            "field_type": "text",
            "field_key": "wpcargo_carrier_ref_number",
            "required": "",
            "weight": "19",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "21",
            "label": "Departure Time",
            "description": "",
            "field_type": "time",
            "field_key": "wpcargo_departure_time_picker",
            "required": "",
            "weight": "21",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        },
        {
            "id": "22",
            "label": "Origin",
            "description": "",
            "field_type": "select",
            "field_key": "wpcargo_origin_field",
            "required": "",
            "weight": "22",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                "Iloilo",
                " Manila",
                " Cebu"
            ],
            "status": ""
        },
        {
            "id": "23",
            "label": "Destination",
            "description": "",
            "field_type": "select",
            "field_key": "wpcargo_destination",
            "required": "",
            "weight": "23",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": [
                "Iloilo",
                " Manila",
                " Cebu"
            ],
            "status": ""
        },
        {
            "id": "24",
            "label": "Pickup Date",
            "description": "",
            "field_type": "datetime",
            "field_key": "wpcargo_pickup_date_picker",
            "required": "",
            "weight": "20",
            "section": "shipment_info",
            "display_flags": [
                "result",
                "account_page"
            ],
            "field_data": [
                ""
            ],
            "status": ""
        },
        {
            "id": "28",
            "label": "Comments",
            "description": "",
            "field_type": "textarea",
            "field_key": "wpcargo_comments",
            "required": "",
            "weight": "24",
            "section": "shipment_info",
            "display_flags": [
                "result"
            ],
            "field_data": "",
            "status": ""
        }
    ],
    "wpc-multiple-package": {
        "wpc-pm-qty": {
            "label": "Qty.",
            "field": "number",
            "required": false,
            "options": []
        },
        "wpc-pm-piece-type": {
            "label": "Piece Type",
            "field": "select",
            "required": false,
            "options": [
                "Pallet",
                "Carton",
                "Crate",
                "Loose",
                "Others"
            ]
        },
        "wpc-pm-description": {
            "label": "Description",
            "field": "textarea",
            "required": false,
            "options": []
        },
        "wpc-pm-length": {
            "label": "Length(cm)",
            "field": "number",
            "required": false,
            "options": []
        },
        "wpc-pm-width": {
            "label": "Width(cm)",
            "field": "number",
            "required": false,
            "options": []
        },
        "wpc-pm-height": {
            "label": "Height(cm)",
            "field": "number",
            "required": false,
            "options": []
        },
        "wpc-pm-weight": {
            "label": "Weight (kg)",
            "field": "number",
            "required": false,
            "options": []
        },
        "wpc-pm-value": {
            "label": "Value (₱)",
            "field": "text",
            "required": false,
            "options": []
        }
    },
    "shipment_history": {
        "date": {
            "label": "Date",
            "field": "text",
            "required": "false",
            "options": []
        },
        "time": {
            "label": "Time",
            "field": "text",
            "required": "false",
            "options": []
        },
        "location": {
            "label": "Location",
            "field": "text",
            "required": "false",
            "options": []
        },
        "status": {
            "label": "Status",
            "field": "select",
            "required": "false",
            "options": [
                "Pending Payment",
                "Pending",
                "On Hold",
                "Processing",
                "In Transit",
                "In Route",
                "Delivered",
                "Payment Received",
                "Ready for Payment",
                "Info Received",
                "Scheduled",
                "In Progress",
                "Completed",
                "Partially Completed",
                "Failed",
                "Return",
                "Heading To",
                "Pending Quotation",
                "Pending For Approval",
                "Quotation Approved",
                "Awaiting Payments"
            ]
        },
        "updated-name": {
            "label": "Updated By",
            "field": "text",
            "required": "false",
            "options": []
        },
        "remarks": {
            "label": "Remarks",
            "field": "textarea",
            "required": "false",
            "options": []
        }
    },
    "registered_shipper": "registered_shipper",
    "registered_receiver": "registered_receiver",
    "assigned_driver": "wpcargo_driver"
}

9. mysite.com/wp-json/wpcargo/v1/api/authorize

This route is use to authenticate. this will accept two parameter “username” and “password” using post method.
Request:

{
    'username' : 'juandelacruz@mail.com',
    'password' : 'samplepassword'
}

Sample Data Response

{
    "result": "success",
    "message": "Access Granted!",
    "data": {
        "user_login": "juandelacruz",
        "user_nicename": "juandelacruz",
        "user_email": "juandelacruz@mail.com",
        "display_name": "Juan dele Cruz",
        "api_key": "XXXXXXXXXXXXXXXXXXXXX"
    }
}

10. mysite.com/wp-json/wpcargo/v1/api/api_key/address/type

This route is use to get the user address list. “type” parameter can either “shipper” or “receiver”.
Request:

/api/###############/address/shipper

Sample Data Response

{
        "id": "1802",
        "wpcargo_shipper_name": "Dave",
        "wpcargo_shipper_phone": "09078241982",
        "wpcargo_shipper_address": "San Francisco",
        "wpcargo_shipper_email": "dave@mail.com",
    },
    {
        "id": "1801",
        "wpcargo_shipper_name": "Mike Ross",
        "wpcargo_shipper_phone": "142556",
        "wpcargo_shipper_address": "New York",
        "wpcargo_shipper_email": "mike@mail.com",
    },

11. mysite.com/wp-json/wpcargo/v1/api/api_key/address/type/page/number

This route is use to get user address list by page number (pagination). “number” parameter is the address page number to display and “type” parameter can either “shipper” or “receiver”.

12. mysite.com/wp-json/wpcargo/v1/api/api_key/address/type/page-total

This route is use to get the total number of pages of address.

13. mysite.com/wp-json/wpcargo/v1/api/api_key/address/fields/type

This route is use to get what field name to user to add or update address. “type” can either “shipper’ or “receiver”.
Request:

/api/###############/address/fields/shipper

Sample Data response

    {
        "id": "1",
        "label": "Shipper Name",
        "description": "",
        "field_type": "text",
        "field_key": "wpcargo_shipper_name",
        "required": "",
        "weight": "0",
        "section": "shipper_info",
        "display_flags": "a:1:{i:0;s:6:\"result\";}",
        "field_data": "a:1:{i:0;s:0:\"\";}",
        "status": ""
    },
    {
        "id": "2",
        "label": "Phone Number",
        "description": "",
        "field_type": "text",
        "field_key": "wpcargo_shipper_phone",
        "required": "",
        "weight": "1",
        "section": "shipper_info",
        "display_flags": "a:1:{i:0;s:6:\"result\";}",
        "field_data": "s:0:\"\";",
        "status": ""
    }

14. mysite.com/wp-json/wpcargo/v1/api/api_key/address/type/add

This route is use to add address. Try this sample code on how to add address using API
Request:

{
    'wpcargo_shipper_name' : 'Juan dela Cruz',
    'wpcargo_shipper_phone' : '1234567890',
    'wpcargo_shipper_address' : 'San Pablo',
    'wpcargo_shipper_email' : 'juandelacruz@mail.com'
}

Sample Data Response

{
    "id": 123,
    "message": "Address Added",
    "status": "success"
}

14. mysite.com/wp-json/wpcargo/v1/api/api_key/address/type/update

This route is use to update address. Try this sample code on how to update address using API
Request:

{
    'address_id' : 123
    'wpcargo_shipper_name' : 'Juan dela Cruz',
    'wpcargo_shipper_phone' : '1234567890',
    'wpcargo_shipper_address' : 'San Pablo',
    'wpcargo_shipper_email' : 'juandelacruz@mail.com'
}

Sample Data response

{
    "id": 123,
    "message": "Address Updated",
    "status": "success"
}
0
    0
    Your Cart
    Your cart is emptyReturn to Shop