Search code examples
xmlshopping-cartsoap1.2

How to update 3D Cart Product Options Stock


How can I update the 3D Cart's Product Options Stock using the Advanced SOAP 1.2 API's runQuery command?

To be clear, I don't mean updateProductInventory which is exposed using the Basic SOAP 1.2 API.

Below is my request, without the header and using dummy store and key.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <runQuery xmlns="http://3dcart.com/">
            <storeUrl>mystore.3dcartstores.com</storeUrl>
            <userKey>12345678901234567890123456789012</userKey>
            <sqlStatement> update options_Advanced SET AO_Stock = 117 WHERE AO_Suffix = '1346106BLK'</sqlStatement>
            <callBackURL/>
        </runQuery>
    </soap:Body>
</soap:Envelope>

I receive the below cryptic response.

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <runQueryResponse xmlns="http://3dcart.com/">
            <runQueryResult>
                <runQueryResponse xmlns="">
                    <Error>
                        <Id>99</Id>
                        <Description>No value given for one or more required parameters.</Description>
                    </Error>
                </runQueryResponse>
            </runQueryResult>
        </runQueryResponse>
    </soap:Body>
</soap:Envelope>

Solution

  • After consulting 3D Cart support, I found the following answer.

    Try this: update options_Advanced SET AO_Stock = 117 WHERE AO_Sufix = '1346106BLK' Unfortunately we have a typo in our database field. So, instead of AO_Suffix you should use AO_Sufix

    The database documentation still incorrectly identifies the column as AO_Suffix.

    The correct request would be the following.

    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Body>
            <runQuery xmlns="http://3dcart.com/">
                <storeUrl>mystore.3dcartstores.com</storeUrl>
                <userKey>12345678901234567890123456789012</userKey>
                <sqlStatement> update options_Advanced SET AO_Stock = 117 WHERE AO_Sufix = '1346106BLK'</sqlStatement>
                <callBackURL/>
            </runQuery>
        </soap:Body>
    </soap:Envelope>