-1

I'm trying to make a request to the Walmart API (Item Associations) to retrieve shippingTemplate and shipNode per items. I'm following this guide. https://developer.walmart.com/api/us/mp/items#operation/getItemAssociations

I set the required field to CURLOPT_POSTFIELDS and I encountered this error. Result from Walmart API

This is my code: `

    $url_returns ="https://marketplace.walmartapis.com/v3/items/associations";
    
    $ch_returns      = curl_init();
    $qos_returns     = uniqid();


    $fields = ['items' => ['123456','778990'] ]; // note: not the real data.

    $options_returns = array(
        CURLOPT_URL            => $url_returns,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_TIMEOUT        => 60,
        CURLOPT_HEADER         => false,
        CURLOPT_HTTPHEADER     => array(
            "WM_SVC.NAME: Walmart Marketplace",
            "WM_QOS.CORRELATION_ID: $qos_returns",
            "Authorization: Basic $authorization_key",
            "WM_SEC.ACCESS_TOKEN:$token",
            "Accept: application/json",

        ),
         CURLOPT_POSTFIELDS  =>  json_encode($fields),
    );

    curl_setopt_array($ch_returns, $options_returns);

    $response_returns = curl_exec($ch_returns);
    $code_returns     = curl_getinfo($ch_returns, CURLINFO_HTTP_CODE);
    curl_close($ch_returns);


   $response_returns = json_decode($response_returns,true);`

Am I missing something? Thank you in advance.

  • You are trying to pass plain numbers in `items`, whereas the example data shown in the docs clearly suggests, that these would need to be objects of the form `{ "sku": "..." }` – CBroe Feb 21 '22 at 12:56

1 Answers1

0

Looks like the list of items whose associations you are trying to fetch are invalid.

Also, could you please double check WM_SVC.NAME header param value

Regards, Firdos IOSupport

IOSupport
  • 11
  • 1