Error 400 when trying to do post or put using shopifySDK

I can read products and delete products but I cannot create or update.

I’m using the phpclassic/shopifysdk

I’ve checked the json and it’s valid, I’m totally stuck

public function __construct()
{
    $config = array(
        "ShopUrl" => $_ENV["SHOPIFY_SHOP_URL"],
        "AccessToken" => $_ENV["SHOPIFY_ACCESS_TOKEN"],
        "Curl" => array(
            CURLOPT_TIMEOUT => 10,
            CURLOPT_FOLLOWLOCATION => true
        )
    );

    $this->shopify = new ShopifySDK($config);

}

public function apiAddProduct($data) : void
{

    $jsonData = json_encode($data, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT);

    try {
        $response = $this->shopify->Product->post($jsonData);
        error_log("Response: " . print_r($response, true));
    } catch (CurlException $e) {
        $this->addError("product", $e->getMessage());
        error_log("CurlException: " . $e->getMessage());
    } catch (\Exception $e) {
        $this->addError("product", $e->getMessage());
        error_log("Exception: " . $e->getMessage());
    }
}

Every time i try to submit the data I get a 400 response, with no other details or errors.

Hi Rich,

Since this is a 3rd party SDK I’d recommend opening an issue in the repo here: https://github.com/phpclassic/php-shopify/issues

Ok thanks

I have contacted them - I note that I get the 400 error using the ordinary shopify SDK too

When I make requests direct through guzzle, nothing happens, a 200 response and the product does not update

With GraphQL , I get nothing , I cannot connect at all