Integration Description for Shipment APIs

Job ID: 38351547

Budget: $8 – $15 USD

Integration Description for Shipment APIs

**Objective:**
Integrate the shipment creation API from `my.ship24go.com` into your shipping platform, enabling your users to create shipments directly through your system.

**Endpoint:**
`POST https://my.ship24go.com/api/shipments/create`

**Parameters and Description:**

1. **token (Required)**
- **Description:** Authentication token for the API.
- **Details:** It must be sent in the header.
- **Example Value:** `OF4XbUwuQ0yj2bSO2Ejyg8PcllMGKzyRr0nA3W62JCLWi8siNk0IxwgUDNzDCopy`

2. **Shipment[type] (Required)**
- **Description:** Type of shipment.
- **Allowed Values:** `1` (Pickup) / `2` (Drop off)

3. **Shipment[branch_id] (Required)**
- **Description:** ID of the branch.
- **Allowed Values:** `1`, `2`, `3`, `4`, `5`, `6`, `7`

4. **Shipment[shipping_date] (Required)**
- **Description:** Shipping date.
- **Format:** `DD/MM/YYYY`
- **Example Value:** `17-07-2024`

5. **Shipment[client_phone] (Optional)**
- **Description:** Client's phone number.
- **Default Value:** The authenticated user's phone number.

6. **Shipment[client_address] (Required)**
- **Description:** Client's address.

7. **Shipment[reciver_name] (Required)**
- **Description:** Receiver's name.

8. **Shipment[reciver_phone] (Required)**
- **Description:** Receiver's phone number.

9. **Shipment[reciver_address] (Required)**
- **Description:** Receiver's address.

10. **Shipment[from_country_id] (Required)**
- **Description:** ID of the origin country.

11. **Shipment[to_country_id] (Required)**
- **Description:** ID of the destination country.

12. **Shipment[from_state_id] (Required)**
- **Description:** ID of the origin state.

13. **Shipment[to_state_id] (Required)**
- **Description:** ID of the destination state.

14. **Shipment[from_area_id] (Required)**
- **Description:** ID of the origin area.

15. **Shipment[to_area_id] (Required)**
- **Description:** ID of the destination area.

16. **Shipment[payment_type] (Required)**
- **Description:** Type of payment.
- **Allowed Values:** `1` (Postpaid) / `2` (Prepaid)

17. **Shipment[payment_method_id] (Required)**
- **Description:** ID of the payment method.

18. **Shipment[attachments_before_shipping] (Optional)**
- **Description:** Attachments before shipping.

19. **Package[package_index][package_id] (Required)**
- **Description:** ID of the package.

20. **Package[package_index][description] (Optional)**
- **Description:** Description of the package.

21. **Package[package_index][qty] (Optional)**
- **Description:** Quantity of packages.
- **Default Value:** `1`

22. **Package[package_index][weight] (Optional)**
- **Description:** Weight of the package.
- **Default Value:** `1`

23. **Package[package_index][length] (Optional)**
- **Description:** Length of the package.
- **Default Value:** `1`

24. **Package[package_index][width] (Optional)**
- **Description:** Width of the package.
- **Default Value:** `1`

25. **Package[package_index][height] (Optional)**
- **Description:** Height of the package.
- **Default Value:** `1`

26. **Shipment[amount_to_be_collected] (Optional)**
- **Description:** Amount to be collected.
- **Default Value:** `0`

27. **Shipment[order_id] (Optional)**
- **Description:** Order ID.

28. **Shipment[delivery_time] (Optional)**
- **Description:** Delivery time.

29. **Shipment[collection_time] (Optional)**
- **Description:** Collection time.
- **Example Value:** `01:12:22 AM`

### Implementation in Your Platform

1. **Authentication:**
- Include the authentication token in the header of your HTTP request.

2. **HTTP Request:**
- Make a `POST` request to the endpoint `https://my.ship24go.com/api/shipments/create` with the required parameters in the body of the request.

3. **Response Handling:**
- Process the server's response to confirm shipment creation and handle any errors or success messages.

### Example Request

```json
{
"Shipment": {
"type": 1,
"branch_id": 1,
"shipping_date": "17-07-2024",
"client_address": "Client Address",
"reciver_name": "Receiver Name",
"reciver_phone": "Receiver Phone",
"reciver_address": "Receiver Address",
"from_country_id": 1,
"to_country_id": 1,
"from_state_id": 1,
"to_state_id": 1,
"from_area_id": 1,
"to_area_id": 1,
"payment_type": 1,
"payment_method_id": 1
},
"Package": {
"0": {
"package_id": 1,
"description": "Package Description",
"qty": 1,
"weight": 1,
"length": 1,
"width": 1,
"height": 1
}
}
}
```

### Example Code in PHP (using cURL)

```php
<?php
$curl = curl_init();

$data = array(
"Shipment" => array(
"type" => 1,
"branch_id" => 1,
"shipping_date" => "17-07-2024",
"client_address" => "Client Address",
"reciver_name" => "Receiver Name",
"reciver_phone" => "Receiver Phone",
"reciver_address" => "Receiver Address",
"from_country_id" => 1,
"to_country_id" => 1,
"from_state_id" => 1,
"to_state_id" => 1,
"from_area_id" => 1,
"to_area_id" => 1,
"payment_type" => 1,
"payment_method_id" => 1
),
"Package" => array(
"0" => array(
"package_id" => 1,
"description" => "Package Description",
"qty" => 1,
"weight" => 1,
"length" => 1,
"width" => 1,
"height" => 1
)
)
);

$jsonData = json_encode($data);

curl_setopt_array($curl, array(
CURLOPT_URL => "https://my.ship24go.com/api/shipments/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $jsonData,
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer OF4XbUwuQ0yj2bSO2Ejyg8PcllMGKzyRr0nA3W62JCLWi8siNk0IxwgUDNzDCopy",
"Content-Type: application/json"
),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
?>
```

### Conclusion

With this guide, you will be able to integrate the shipment creation API from `my.ship24go.com` into your shipping platform. Make sure to adjust the parameter values according to your system's needs and thoroughly test the integration to ensure successful implementation.
Related categories: Laravel Instagram API API