ForSURE.orders.returns_endpoint

baseURL = '{domain}/saas/returns'

Base URL for all requests

POST {baseURL}
async def add_returns()

Post a list of returns in the following format using the exact keys to add them to our system. You can define how to handle errors (not required),

  • SKIP, which will ignore the duplicates
  • WARN_AND_SKIP, which will ignore them, but will respond with the orders that were skipped (default)
  • WARN_AND_ADD, which will ignore them, but will respond with the orders that were skipped
  • RAISE, which will throw an error and not add anything

You can define the error handling for these cases:

  • duplicates: How to handle duplicate returns received
  • order_missing: How to handle returns where the corresponding order is missing
  • negative_quantity: How to handle returns where more items have been returned than have been ordered
Parameters
  • returns:

    {
        "returns": [
            {
                "sku": "481769825",
                "title": "Example Product 1",
                "orderid": "FS1234",
                "quantity": 2,
                "return_date": "2024-01-27T22:16:25.365Z"
            },
            {
                "sku": "903419029",
                "title": "Example Product 2",
                "orderid": "FS1235",
                "quantity": 3,
                "return_date": "2024-01-27T22:17:25.365Z"
            }
        ],
        "duplicates": "WARN_AND_SKIP"
        "order_missing": "WARN_AND_SKIP"
        "negative_quantity": "WARN_AND_SKIP"
    }
    
Returns

Successful response

{
    "status": "success",
    "duplicates": [],
    "order_missing": [],
    "negative_quantity": []
}

Successful response with warning If you have orders that have been added before, and the duplicates flag is set to WARN, you will receive this response

{
    "status": "success",
    "duplicates": [],
    "order_missing": [],
    "negative_quantity": [
        {
            "orderid": "FS1234",
            "sku": "481769825",
            "title": "Example Product 1",
            "quantity": 2,
            "return_date": "2024-01-27T22:16:25.365000Z"
        }
    ]
}

Invalid data If you have any relevant entries missing, the API will respond with this payload, directing you to the invalid entry:

{
    "detail": [
        {
            "type": "missing",
            "loc": [
                "body",
                "returns",
                1,
                "sku"
            ],
            "msg": "Field required",
            "input": {
                "title": "Example Product 2",
                "orderid": "FS1235",
                "quantity": 5,
                "date": "2024-01-27T22:17:25.365Z"
            },
            "url": "https://errors.pydantic.dev/2.11/v/missing"
        }
    ]
}