Home » API Documentations » OMS APIs » Returns » Returns API
Returns API
API RETURNS
- Method: CreateReturn
- Creates a return from an order sent from ShipEdge.
- HTTP: POST /API/Returns/CreateReturn
BASE
https://<wms>.shipedge.com/API/Returns/CreateReturn
Format: JSON
| Parameter | Type | Description |
|---|---|---|
| ApiKey (*) | varchar | Unique key. This will be found in your ShipEdge account. Preferences>API Integration> Key. |
| AccountID (*) | int | ID of your account. This will be found in your ShipEdge account. Preferences>API Integration>AccountID |
| ShippingNum (*) | int | Shipping # of the order that you wish to request the return. Only orders with the “shipped” status can be requested. |
| Comment | varchar | You can use comments to give some special information to the warehouse. |
| Label | Enum (YES,NO) | If you wish to generate a return labels to send to your client. Is only valid for orders sent to the US. |
| Sku (*) | varchar | The sku’s name is unique by product. It has to be included in your inventory. Also it has to be included in the order which you are requesting the return. |
| QtyGood (*) | int | Quantity of the product in good quality which is expected to return. This quantity must be minor or the same amount sent to the solicited order. |
| QtyHurt (*) | int | Quantity of the product in hurt quality which is expected to return. This quantity must be minor or the same amount sent to the solicited order. |
(*) Required Parameters
- In the request doesn’t require a QtyGood or QtyHurt you can send the information with zero value.
Request:
{
"ApiKey":"08d5546a598eac012a042702161d9b62",
"AccountID":"123", "ShippingNum":"10001",
"Comment":"Any Comment",
"Label":"NO",
"Items":[ {"Sku":"sku1",”QtyGood":"1","QtyHurt":"0"},
{"Sku":"sku2","QtyGood":"0","QtyHurt":"1"},
{"Sku":"sku3",”QtyGood":"1","QtyHurt":"1"} ]
}
Answers:
Answer 1
{"Status":"Error","Description":"InvalidAcountID"}
| Status | Description |
|---|---|
| Error | InvalidAcountIDInvalidApiKeyThereturnalreadyexists |
| Error | InvalidShippingNum |
| Error | InvalidSku |
| Error | InvalidQtyGoodorQtyHurt |
Answer 2
{"Status":"Successful","Rma":"123"}
| Status | Rma |
|---|---|
| Successful | Unique Return ID created in Shipedge. |
PHP
Example
<?php
$data = array(
"ApiKey" => "08d5546a598eac012a042702161d9b62",
"AccountID" => "123",
"ShippingNum" => "10001",
"Comment" => "Hello",
"Label" => "NO",
"Items" => array(
array(
"Sku" => "sku1",
"QtyGood" => "1",
"QtyHurt" => "0"
),
array(
"Sku" => "sku1",
"QtyGood" => "0",
"QtyHurt" => "1"
),
array(
"Sku" => "sku1",
"QtyGood" => "1",
"QtyHurt" => "1"
)
)
);
$data = json_encode($data);
$url = "https://demo.shipedge.com/API/Returns/CreateReturn";
$curl = curl_init();
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data)
));
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$x = curl_exec($curl);
print_r($x);
?>
(*) The URL depends on the warehouse where the order was sent. In the example, we are using a Demo test server.
GETTING RETURNS INFORMATION
This is the standard way to make the call at this endpoint.
END POINT POST: https://<integration>.shipedge.com/API/Rest/v3/Returns/get_returns
The request body here is using the page and calling all status.
BODY: {
"key": "123abc",
"warehouse": "wh01",
"account_id": 1,
"page": 1,
"status": "all"
}
RESPONSE: {
"status": "successful",
"total_returns": "4",
"total_pages": 1,
"returns": [{
"rma_id": "1",
"order_id": "1049",
"order_number": "1046_cp_RO",
"reference_number": "",
"date": "2022-09-22 16:38:33",
"last_update": "2022-09-22 16:38:33",
"returnTrackingNum": null,
"returnTrackingAwblink": "",
"received_date": null,
"requested_date": "2022-09-22 16:38:33",
"processed_date": null,
"status": "all",
"items": {
"in order": [{
"item_id": "1",
"sku": "MESA-001",
"quantity": "1"
}],
"requested": [{
"item_id": "2",
"sku": "MESA-001",
"quantity_good": "1",
"quantity_hurt": "0"
}]
}
}, {
"rma_id": "2",
"order_id": "1048",
"order_number": "1048_RO",
"reference_number": "",
"date": "2022-09-22 16:53:04",
"last_update": "2022-09-22 16:53:04",
"returnTrackingNum": null,
"returnTrackingAwblink": "",
"received_date": null,
"requested_date": "2022-09-22 16:53:04",
"processed_date": null,
"status": "all",
"items": {
"in order": [{
"item_id": "3",
"sku": "MESA-001",
"quantity": "1"
}],
"requested": [{
"item_id": "4",
"sku": "MESA-001",
"quantity_good": "1",
"quantity_hurt": "0"
}]
}
}, {
"rma_id": "3",
"order_id": "1046",
"order_number": "1046_RO",
"reference_number": "",
"date": "2022-09-22 18:16:46",
"last_update": "2022-09-22 18:16:46",
"returnTrackingNum": null,
"returnTrackingAwblink": "",
"received_date": null,
"requested_date": "2022-09-22 18:16:46",
"processed_date": null,
"status": "all",
"items": {
"in order": [{
"item_id": "5",
"sku": "MESA-001",
"quantity": "1"
}],
"requested": [{
"item_id": "6",
"sku": "MESA-001",
"quantity_good": "1",
"quantity_hurt": "0"
}]
}
}, {
"rma_id": "4",
"order_id": "1203",
"order_number": "1203_RO",
"reference_number": "",
"date": "2022-10-05 17:45:09",
"last_update": "2022-10-05 17:45:09",
"returnTrackingNum": null,
"returnTrackingAwblink": "",
"received_date": null,
"requested_date": "2022-10-05 17:45:09",
"processed_date": null,
"status": "all",
"items": {
"in order": [{
"item_id": "7",
"sku": "MESA-001",
"quantity": "1"
}]
}
}]
}
When using an specific shipping or order number. Calling all the status.
END POINT: https://<integration>.shipedge.com/API/Rest/v3/Returns/get_returns
BODY: {
"key": "123abc",
"warehouse": "wh01",
"account_id": 8,
"ship_number": "1203",
"order_number": "",
"page": 1,
"status": "all"
}
RESPONSE: {
"status": "successful",
"total_returns": "4",
"total_pages": 1,
"returns": [{
"rma_id": "4",
"order_id": "1203",
"order_number": "1203_RO",
"reference_number": "",
"date": "2022-10-05 17:45:09",
"last_update": "2022-10-05 17:45:09",
"returnTrackingNum": null,
"returnTrackingAwblink": "",
"received_date": null,
"requested_date": "2022-10-05 17:45:09",
"processed_date": null,
"status": "all",
"items": {
"in order": [{
"item_id": "7",
"sku": "MESA-001",
"quantity": "1"
}]
}
}]
}
This call is a successful one, but it is returning an empty array. Which means there’s no data for any return to retrive.
{
"status": "successful",
"total_returns": "0",
"total_pages": 0,
"returns": []
}

