Introduction

Welcome to the API documentation. Here, you will find information on how to create, test, and manage your API requests and responses effectively.

Create a REST API


For a Mighty delivery system that operates with a REST API and key-based access, here’s how you might implement and manage API keys for secure access control:

Delivery Image

Select Add REST API. You’ll be taken to the Key Details screen.

API Key Details
  • Copy the key for future use.

    
                                curl -X POST https://example.com/save-external-order\
                                 {
                                    "date" : "2022-01-22",
                                    "api_token" : "rest_853WW742FV3247AD965ER82R32R0R",
                                    "customer":{
                                        "name":"",
                                        "mobile_number":"",
                                        "email_id":""
                                    },
                                    "pickup_point" : {
                                        "address": "Ved Road Bridge, Surat, Gujarat",
                                        "latitude": "22.3190806",
                                        "longitude": "70.7671176",
                                        "description": "",
                                        "name": "",
                                        "instruction": "",
                                        "contact_number": "+917405895728"
                                    },
                                    "delivery_point" : {
                                        "address": "Station Road, Khand Bazar, Varachha, Surat, Gujarat, India",
                                        "latitude": "21.2072495",
                                        "longitude": "72.8423258",
                                        "description": "",
                                        "name": "",
                                        "instruction": "",
                                        "contact_number": "+917405895728"
                                    },
                                    "extra_charges" :[
                                        {
                                            "key": "gst",
                                            "value": 10,
                                            "value_type": "fixed"
                                        },
                                        {
                                            "key": "sgst",
                                            "value": 2,
                                            "value_type": "percentage"
                                        }
                                    ],
                                    "parcel_type" : "documents",
                                    "total_weight" : 5,
                                    "parcel_number":1,
                                    "payment_collect_from" : "on_delivery",
                                    "payment_type" : "online/cash",
                                    "packaging_symbols": [
                                        {"title": "Do Not Use Hooks", "key": "do_not_use_hooks"},
                                        {"title": "Bike Delivery", "key": "bike_delivery"},
                                        {"title": "Hazardous Material", "key": "hazardous_material"}
                                    ]
                                }

  • If the customer's email matches an existing record, the ID will be updated. If it's a new user, a new ID will be generated, and the default password will 1 and 8.

  • 
                                curl -X GET https://example.com/get-code\
                                {
                                    "success": true,
                                    "distance": 5.78,
                                    "total_weight": 5,
                                    "total_parcel_number": 1,
                                    "delivery_charge": 1,
                                    "extra_charges": [
                                        {
                                            "key": "gst",
                                            "value": 5,
                                            "value_type": "percentage"
                                        },
                                        {
                                            "key": "sgst",
                                            "value": 7,
                                            "value_type": "percentage"
                                        }
                                    ],
                                    "total_amount": 36.99
                                }
                            

    Test API

    Ensure that your test API responses are properly formatted and include all necessary headers for authentication.

    Get Response Order Charges

    Success than return response and message

    
                {
                    "success": true,
                    "distance": 5.78,
                    "total_weight": 5,
                    "total_parcel_number": 1,
                    "delivery_charge": 1,
                    "extra_charges": [
                        {
                            "key": "gst",
                            "value": 5,
                            "value_type": "percentage"
                        },
                        {
                            "key": "sgst",
                            "value": 7,
                            "value_type": "percentage"
                        }
                    ],
                    "total_amount": 36.99
                }
            

    Success Response

    Success than return response and message

    
                {
                    "order_id": 513,
                    "message": "Order has been saved successfully",
                    "status": true
                }

    Error Response

    When an invalid API token error occurs, the API will return a response with the appropriate status and message.

    
            {
            "message": "Invalid Token",
            "success": false
            }

    Error Response

    When a customer's email is null, the API will return a response with an appropriate status and message.

    
                {
                    "message": "Email Required",
                    "success": false
                }

    Error Response

    When a customer's Details is null, the API will return a response with an appropriate status and message.

    
                {
                    "message": "Please Fill Customer Details Is Valid",
                    "success": false
                }
    Value

    Error Response

    When a Pickup Delivery Details is null, the API will return a response with an appropriate status and message.

    
                {
                    "message": "Please Fill Valid Delivery Point",
                    "success": false
                }

    Error Response

    When a Enter Minus Value, the API will return a response with an appropriate status and message.

    
                {
                    "message": "Invalid Value Minus",
                    "success": false
                }

    Error Response

    When a Enter date formate invalid, the API will return a response with an appropriate status and message.

    
                {
                    "message": "The date does not match the format Y-m-d.`",
                    "success": false
                }

    Error Response

    When a Enter Packaging Symbols Invalid, the API will return a response with an appropriate status and message.

    
                {
                    "message": "Packaging_Symbols_Invalid",
                    "success": false,
                    "invalid_keys": [
                        "recycleppppppppp"
                    ]
                }

    API Attributes Table

    Below are the attributes used in the API request:

    Attribute Type Description
    date datetime date formate: y-m-d
    customer Object (JSON) Contains customer information such as name, mobile number, and email ID. || Required Details: email_id
    pickup_point Object (JSON) Pickup point details including address, latitude, longitude, and contact number. || Required Details:address,latitude,longitude
    delivery_point Object (JSON) Delivery point details including addresss, latitude, longitude, and contact number. || Required Details:address,latitude,longitude
    extra_charges Array (JSON) Extra charges for the order, e.g., GST.
    parcel_type String Type of parcel being shipped, e.g., documents, electronics.
    total_weight Integer Total weight of the parcel in kilograms.
    payment_type String Method of payment, either online or cash on delivery. || valid details: cash,online.
    payment_collect_from String valid details: on_pickup,on_delivery.
    parcel_number Integer Enter Parcel Number.
    packaging_symbols Array (JSON) A list of packaging symbols for the parcel, each containing a title and key. || valid details: this_way_up,do_not_stack,temperature_sensitive,do_not_use_hooks,explosive_material,hazardous_material,bike_delivery,keep_dry,perishable,recycle,do_not_open_with_sharp_objects,fragile